var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var FProcurementsPlanAttach;
(function (FProcurementsPlanAttach) {
    var ExcelExport = (function () {
        function ExcelExport(_document) {
            this._document = _document;
        }
        ExcelExport.prototype.GetBossPost = function () {
            return ObasExportHelper.GetBossPost();
        };
        ExcelExport.prototype.GetBossName = function () {
            return ObasExportHelper.GetBossName();
        };
        ExcelExport.prototype.GetCreateDate = function () {
            return ObasHelper.ConvertToString(ObasTableCollection.RroProcurementPlanTable.CreateDate, DateFormat.Middle);
        };
        ExcelExport.prototype.GetDate1 = function () {
            var procurementPlanTable = ObasTableCollection.RroProcurementPlanTable;
            if ((procurementPlanTable.NumVersion.Value === 0) && (procurementPlanTable.Status != ProcurementPlanStatuses.Approved)) {
                return "";
            }
            else if (procurementPlanTable.Status === ProcurementPlanStatuses.Approved) {
                return this.GetApprovedDate();
            }
            else {
                return ObasExportHelper.GetMiddleDate();
            }
        };
        ExcelExport.prototype.GetAttachName = function () {
            result = "\u041F\u041B\u0410\u041D\n\r \u0437\u0430\u043A\u0443\u043F\u043E\u043A \u0442\u043E\u0432\u0430\u0440\u043E\u0432, \u0440\u0430\u0431\u043E\u0442, \u0443\u0441\u043B\u0443\u0433 \u0434\u043B\u044F \u043E\u0431\u0435\u0441\u043F\u0435\u0447\u0435\u043D\u0438\u044F \u0444\u0435\u0434\u0435\u0440\u0430\u043B\u044C\u043D\u044B\u0445 \u043D\u0443\u0436\u0434 \u043D\u0430 " +
                (ObasStageSettings.CurrentYear + " \u0444\u0438\u043D\u0430\u043D\u0441\u043E\u0432\u044B\u0439 \u0433\u043E\u0434\n\r \u0438 \u043D\u0430 \u043F\u043B\u0430\u043D\u043E\u0432\u044B\u0439 \u043F\u0435\u0440\u0438\u043E\u0434 ") +
                (ObasStageSettings.CurrentYear + 1 + " \u0438 " + (ObasStageSettings.CurrentYear + 2) + " \u0433\u043E\u0434\u043E\u0432 ");
            return result;
        };
        ExcelExport.prototype.GetRecipientName = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("Recipient_Name");
        };
        ExcelExport.prototype.GetLegalForm = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("LegalForm");
        };
        ExcelExport.prototype.GetOwnershipForm = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("OwnershipForm");
        };
        ExcelExport.prototype.GetContactInfo = function () {
            var selectedFoivTable = ObasTableCollection.SelectedFoivTable;
            return selectedFoivTable.GetFieldValue("Address") + ", " + selectedFoivTable.GetFieldValue("Telefon") +
                ", " + selectedFoivTable.GetFieldValue("Email");
        };
        ExcelExport.prototype.GetDate2 = function () {
            var procurementPlanTable = ObasTableCollection.RroProcurementPlanTable;
            if ((procurementPlanTable.NumVersion.Value === 0) && (procurementPlanTable.Status != ProcurementPlanStatuses.Approved)) {
                return ObasExportHelper.GetShortDate();
            }
            else if (procurementPlanTable.Status === ProcurementPlanStatuses.Approved) {
                return ObasHelper.ConvertToString(ObasTableCollection.RroProcurementPlanTable.ApprovedDate.Value, DateFormat.Short);
            }
            else {
                return ObasExportHelper.GetShortDate();
            }
        };
        ExcelExport.prototype.GetRecipientCode = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("Recipient_Code");
        };
        ExcelExport.prototype.GetINN = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("INN");
        };
        ExcelExport.prototype.GetKPP = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("KPP");
        };
        ExcelExport.prototype.GetOKOPF = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("OKOPF");
        };
        ExcelExport.prototype.GetOKFS = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("OKFS");
        };
        ExcelExport.prototype.GetRecipientOktmoCode = function () {
            return ObasTableCollection.SelectedFoivTable.GetFieldValue("Recipient_OktmoCode");
        };
        ExcelExport.prototype.GetDocKind = function () {
            var procurementPlanTable = ObasTableCollection.RroProcurementPlanTable;
            if (procurementPlanTable.RowCount === 0) {
                return "";
            }
            else {
                if (procurementPlanTable.NumVersion.Value === 0) {
                    return "\u0411\u0430\u0437\u043E\u0432\u044B\u0439";
                }
                else if (procurementPlanTable.NumVersion.Value > 0) {
                    return "\u0418\u0437\u043C\u0435\u043D\u0435\u043D\u043D\u044B\u0439";
                }
            }
        };
        ExcelExport.prototype.GetPerfPost = function () {
            return ObasExportHelper.GetPerfPost();
        };
        ExcelExport.prototype.GetPerfName = function () {
            return ObasExportHelper.GetPerfName();
        };
        ExcelExport.prototype.GetNumVersion = function () {
            var procurementPlanTable = ObasTableCollection.RroProcurementPlanTable;
            if (procurementPlanTable.RowCount === 0) {
                return "";
            }
            else {
                return procurementPlanTable.NumVersion.Value.toString();
            }
        };
        ExcelExport.prototype.GetBossNameAndPost = function () {
            return this.GetBossName() + ", " + this.GetBossPost();
        };
        ExcelExport.prototype.GetPerfNameAndPost = function () {
            return this.GetPerfName() + ", " + this.GetPerfPost();
        };
        ExcelExport.prototype.GetApprovedDate = function () {
            return ObasHelper.ConvertToString(ObasTableCollection.RroProcurementPlanTable.ApprovedDate.Value, DateFormat.Middle);
        };
        return ExcelExport;
    }());
    FProcurementsPlanAttach.ExcelExport = ExcelExport;
})(FProcurementsPlanAttach || (FProcurementsPlanAttach = {}));
