Example #1
0
        public static IWaybill CreateWaybillDocument(string comment, Sungero.ExchangeCore.IBoxBase box, Sungero.Parties.ICounterparty counterparty, Sungero.Exchange.IExchangeDocumentInfo info)
        {
            var waybill = CreateDocument <IWaybill>(comment, box, counterparty, info);

            waybill.FormalizedServiceType = Docflow.AccountingDocumentBase.FormalizedServiceType.Waybill;

            var kind = Docflow.PublicFunctions.DocumentKind.GetNativeDocumentKind(Init.WaybillDocumentKind);

            if (kind != null)
            {
                waybill.DocumentKind = kind;
            }

            return(waybill);
        }
Example #2
0
        /// <summary>
        /// Создать документ из МКДО.
        /// </summary>
        /// <param name="comment">Комментарий.</param>
        /// <param name="box">Ящик обмена.</param>
        /// <param name="counterparty">Контрагент.</param>
        /// <param name="info">Информация о документе.</param>
        /// <returns>Созданный документ.</returns>
        private static T CreateDocument <T>(string comment, Sungero.ExchangeCore.IBoxBase box,
                                            Sungero.Parties.ICounterparty counterparty, Sungero.Exchange.IExchangeDocumentInfo info) where T : Docflow.IAccountingDocumentBase
        {
            var exchangeDoc = Sungero.Docflow.Shared.OfficialDocumentRepository <T> .Create();

            if (!string.IsNullOrEmpty(comment) && comment.Length > exchangeDoc.Info.Properties.Note.Length)
            {
                comment = comment.Substring(0, exchangeDoc.Info.Properties.Note.Length);
            }

            exchangeDoc.IsFormalized = true;
            exchangeDoc.Note         = comment;
            exchangeDoc.BusinessUnit = ExchangeCore.PublicFunctions.BoxBase.GetBusinessUnit(box);
            exchangeDoc.Counterparty = counterparty;

            return(exchangeDoc);
        }
Example #3
0
        public static FinancialArchive.IOutgoingTaxInvoice CreateOutgoingTaxInvoiceDocument(string comment, Sungero.ExchangeCore.IBoxBase box,
                                                                                            Sungero.Parties.ICounterparty counterparty, bool isAdjustment,
                                                                                            Sungero.Docflow.IAccountingDocumentBase corrected, Sungero.Exchange.IExchangeDocumentInfo info)
        {
            var outgoingTaxInvoice = CreateDocument <IOutgoingTaxInvoice>(comment, box, counterparty, info);

            outgoingTaxInvoice.FormalizedServiceType = Docflow.AccountingDocumentBase.FormalizedServiceType.Invoice;
            outgoingTaxInvoice.IsAdjustment          = isAdjustment;

            var kind = Docflow.PublicFunctions.DocumentKind.GetNativeDocumentKind(Init.OutgoingTaxInvoiceKind);

            if (kind != null)
            {
                outgoingTaxInvoice.DocumentKind = kind;
            }

            if (corrected != null)
            {
                outgoingTaxInvoice.Corrected       = corrected;
                outgoingTaxInvoice.LeadingDocument = corrected.LeadingDocument;
            }

            return(outgoingTaxInvoice);
        }
Example #4
0
        public static Docflow.IAccountingDocumentBase CreateUniversalBasic(string comment, Sungero.ExchangeCore.IBoxBase box,
                                                                           Sungero.Parties.ICounterparty counterparty, bool isAdjustment,
                                                                           Sungero.Docflow.IAccountingDocumentBase corrected, Sungero.Exchange.IExchangeDocumentInfo info)
        {
            var universalDocument = CreateDocument <IUniversalTransferDocument>(comment, box, counterparty, info);

            universalDocument.FormalizedServiceType = Docflow.AccountingDocumentBase.FormalizedServiceType.GeneralTransfer;
            universalDocument.IsAdjustment          = isAdjustment;

            var kind = Docflow.PublicFunctions.DocumentKind.GetNativeDocumentKind(Init.UniversalBasicKind);

            if (kind != null)
            {
                universalDocument.DocumentKind = kind;
            }

            if (corrected != null)
            {
                universalDocument.Corrected       = corrected;
                universalDocument.LeadingDocument = corrected.LeadingDocument;
            }

            return(universalDocument);
        }
Example #5
0
        public static IContractStatement CreateContractStatementDocument(string comment, Sungero.ExchangeCore.IBoxBase box, Sungero.Parties.ICounterparty counterparty, Sungero.Exchange.IExchangeDocumentInfo info)
        {
            var contractStatement = CreateDocument <IContractStatement>(comment, box, counterparty, info);

            contractStatement.FormalizedServiceType = Docflow.AccountingDocumentBase.FormalizedServiceType.Act;

            var kind = Docflow.PublicFunctions.DocumentKind.GetNativeDocumentKind(Init.ContractStatementKind);

            if (kind != null)
            {
                contractStatement.DocumentKind = kind;
            }

            return(contractStatement);
        }