Esempio n. 1
0
        //private csValuta GetValutaByBankAccount(Session ses, crmBankAccount bankAccount) {
        //    //XPQuery<csValuta> valutas = new XPQuery<csValuta>(ses);
        //    //return (from valuta in valutas
        //    //                    where valuta.CodeCurrencyValue == bankAccount.Number.Substring(5, 3)
        //    //                    select valuta).First();
        //    return new XPQuery<csValuta>(ses).Where(p => p.CodeCurrencyValue == bankAccount.Number.Substring(5, 3)).First();
        //}

        private void AssignCommonProperty(fmCDocRCB paymentDoc, fmCSAStatementAccountDoc doc)
        {
            paymentDoc.AcceptanceDuration       = doc.AcceptanceDuration;
            paymentDoc.AccountNumberSupplier    = doc.AccountNumberSupplier;
            paymentDoc.AdvancedConditions       = doc.AdvancedConditions;
            paymentDoc.AkkreditiveKind          = doc.AkkreditiveKind;
            paymentDoc.CompilerStatus           = doc.CompilerStatus;
            paymentDoc.CompilerStatus           = doc.CompilerStatus;
            paymentDoc.DateIndicator            = doc.DateIndicator;
            paymentDoc.DeductedFromPayerAccount = doc.DeductedFromPayerAccount;
            paymentDoc.DocDate             = doc.DocDate;
            paymentDoc.DocNumber           = doc.DocNumber;
            paymentDoc.DocType             = doc.DocType; // 2012-04-12 раскомментил
            paymentDoc.DocumentSendingDate = doc.DocumentSendingDate;
            paymentDoc.KBKStatus           = doc.KBKStatus;
            paymentDoc.NumberIndicator     = doc.NumberIndicator;
            paymentDoc.OKATO                   = doc.OKATO;
            paymentDoc.OperationKind           = doc.OperationKind;
            paymentDoc.PaymentByRepresentation = doc.PaymentByRepresentation;
            paymentDoc.PaymentCondition        = doc.PaymentCondition;
            paymentDoc.PaymentCost             = doc.PaymentCost;
            paymentDoc.PaymentCostCopybook     = doc.PaymentCostCopybook;
            paymentDoc.PaymentDeadLine         = doc.PaymentDeadLine;
            //paymentDoc.PaymentDocument = doc.PaymentDocument;
            paymentDoc.PaymentFunction     = doc.PaymentFunction;
            paymentDoc.PaymentFunctionCode = doc.PaymentFunctionCode;
            paymentDoc.PaymentKind         = doc.PaymentKind;
            //paymentDoc.PaymentPayerRequisites = doc.PaymentPayerRequisites;   // 2012-04-11
            //paymentDoc.PaymentReceiverRequisites = doc.PaymentReceiverRequisites;   // 2012-04-11
            paymentDoc.PaymentResField         = doc.PaymentResField;
            paymentDoc.PaymentSequence         = doc.PaymentSequence;
            paymentDoc.PeriodIndicator         = doc.PeriodIndicator;
            paymentDoc.ReasonIndicator         = doc.ReasonIndicator;
            paymentDoc.ReceivedByPayerBankDate = doc.ReceivedByPayerBankDate;
            paymentDoc.TicketContent           = doc.TicketContent;
            paymentDoc.TicketDate    = doc.TicketDate;
            paymentDoc.TicketTime    = doc.TicketTime;
            paymentDoc.TypeIndicator = doc.TypeIndicator;

            AssignRequsites(paymentDoc.PaymentPayerRequisites, doc.PaymentPayerRequisites);
            AssignRequsites(paymentDoc.PaymentReceiverRequisites, doc.PaymentReceiverRequisites);
        }
Esempio n. 2
0
        static public void PostProcess(IObjectSpace os, fmCSATaskImporter taskImporter, fmCSAImportResult importResult)
        {
            // Постобработка: Добавление банков, контрагентов, счетов
            if (importResult == null)
            {
                return;
            }

            using (IObjectSpace nos = os.CreateNestedObjectSpace()) {
                fmCSATaskImporter task   = nos.GetObject <fmCSATaskImporter>(taskImporter);
                fmCSAImportResult result = nos.GetObject <fmCSAImportResult>(importResult);

                // Определение и добавление банков
                foreach (fmCSAStatementAccount sa in result.StatementOfAccounts)
                {
                    foreach (fmCDocRCBRequisites requisites in sa.DocRCBRequisites)
                    {
                        fmCSAStatementAccountDoc sad = requisites.StatementOfAccountDoc;
                        task.Importer.RequisitesBankProccess(sad.PaymentPayerRequisites);
                        task.Importer.RequisitesBankProccess(sad.PaymentReceiverRequisites);
                        nos.CommitChanges();
                    }
                }

                // Определение стороны по банку, счёту и значению свойства предпочтительная сторона объекта BankAccount
                //task.Importer.PartyProccessByAccount(result);
                //nos.CommitChanges();
                foreach (fmCSAStatementAccount sa in result.StatementOfAccounts)
                {
                    foreach (fmCDocRCBRequisites requisites in sa.DocRCBRequisites)
                    {
                        fmCSAStatementAccountDoc sad = requisites.StatementOfAccountDoc;
                        task.Importer.PartyProccessByAccountRequisite(sad.PaymentPayerRequisites);
                        task.Importer.PartyProccessByAccountRequisite(sad.PaymentReceiverRequisites);
                        nos.CommitChanges();
                    }
                }

                // Определение стороны по ИНН и КПП (если не определилась на предыдущем шаге как предпочтительная сторона в счёте)
                foreach (fmCSAStatementAccount sa in result.StatementOfAccounts)
                {
                    foreach (fmCDocRCBRequisites requisites in sa.DocRCBRequisites)
                    {
                        fmCSAStatementAccountDoc sad = requisites.StatementOfAccountDoc;
                        task.Importer.RequisitesPartyProccessByINNandKPP(sad.PaymentPayerRequisites);
                        task.Importer.RequisitesPartyProccessByINNandKPP(sad.PaymentReceiverRequisites);
                        nos.CommitChanges();
                    }
                }

                // Создание счетов
                foreach (fmCSAStatementAccount sa in result.StatementOfAccounts)
                {
                    foreach (fmCDocRCBRequisites requisites in sa.DocRCBRequisites)
                    {
                        fmCSAStatementAccountDoc sad = requisites.StatementOfAccountDoc;
                        task.Importer.RequisitesStatementAccountProccess(sad.PaymentPayerRequisites);
                        task.Importer.RequisitesStatementAccountProccess(sad.PaymentReceiverRequisites);
                        nos.CommitChanges();
                    }
                }
            }

            importResult.ResultCode = 2;
        }