Ejemplo n.º 1
0
        /// <summary>
        /// Проверить акт на дубли.
        /// </summary>
        /// <param name="contractStatement">Акт.</param>
        /// <param name="businessUnit">НОР.</param>
        /// <param name="registrationNumber">Рег. номер.</param>
        /// <param name="registrationDate">Дата регистрации.</param>
        /// <param name="counterparty">Контрагент.</param>
        /// <param name="leadingDocument">Ведущий документ.</param>
        /// <returns>Признак дублей.</returns>
        public static bool HaveDuplicates(IContractStatement contractStatement,
                                          Sungero.Company.IBusinessUnit businessUnit,
                                          string registrationNumber,
                                          DateTime?registrationDate,
                                          Sungero.Parties.ICounterparty counterparty,
                                          Docflow.IOfficialDocument leadingDocument)
        {
            if (contractStatement == null ||
                businessUnit == null ||
                string.IsNullOrWhiteSpace(registrationNumber) ||
                registrationDate == null ||
                counterparty == null ||
                leadingDocument == null)
            {
                return(false);
            }

            return(Functions.ContractStatement.Remote.GetDuplicates(contractStatement,
                                                                    businessUnit,
                                                                    registrationNumber,
                                                                    registrationDate,
                                                                    counterparty,
                                                                    leadingDocument)
                   .Any());
        }
Ejemplo n.º 2
0
 public override void SendAnswer(Sungero.ExchangeCore.IBusinessUnitBox box, Sungero.Parties.ICounterparty party, ICertificate certificate, bool isAgent)
 {
     if (_obj.IsFormalized == true)
     {
         Exchange.PublicFunctions.Module.SendBuyerTitle(_obj, box, certificate, isAgent);
     }
     else
     {
         base.SendAnswer(box, party, certificate, isAgent);
     }
 }
Ejemplo n.º 3
0
        public override Sungero.Company.IEmployee GetExchangeDocumentResponsible(Sungero.Parties.ICounterparty counterparty, List <Sungero.Exchange.IExchangeDocumentInfo> infos)
        {
            var company = Parties.CompanyBases.As(counterparty);

            if (_obj.Routing == ExchangeCore.BoxBase.Routing.CPResponsible && company != null && company.Responsible != null)
            {
                return(_obj.Status == ExchangeCore.DepartmentBox.Status.Active ? company.Responsible : Functions.BoxBase.GetExchangeDocumentResponsible(_obj.ParentBox, counterparty, infos));
            }

            return(ExchangeCore.PublicFunctions.BoxBase.GetResponsible(_obj));
        }
Ejemplo n.º 4
0
        public virtual Sungero.Company.IEmployee GetExchangeDocumentResponsible(Sungero.Parties.ICounterparty counterparty, List <Sungero.Exchange.IExchangeDocumentInfo> infos)
        {
            var company = Parties.CompanyBases.As(counterparty);

            if (_obj.Routing == ExchangeCore.BoxBase.Routing.CPResponsible && company != null && company.Responsible != null)
            {
                return(company.Responsible);
            }

            return(ExchangeCore.PublicFunctions.BoxBase.GetResponsible(_obj));
        }
 public static IQueryable <IContractBase> GetDuplicates(IContractBase contract,
                                                        Sungero.Company.IBusinessUnit businessUnit,
                                                        string registrationNumber,
                                                        DateTime?registrationDate,
                                                        Sungero.Parties.ICounterparty counterparty)
 {
     return(ContractBases.GetAll()
            .Where(l => Equals(contract.DocumentKind, l.DocumentKind))
            .Where(l => Equals(businessUnit, l.BusinessUnit))
            .Where(l => registrationDate == l.RegistrationDate)
            .Where(l => registrationNumber == l.RegistrationNumber)
            .Where(l => Equals(counterparty, l.Counterparty))
            .Where(l => !Equals(contract, l)));
 }
Ejemplo n.º 6
0
 public static IQueryable <IContractStatement> GetDuplicates(IContractStatement contractStatement,
                                                             Sungero.Company.IBusinessUnit businessUnit,
                                                             string registrationNumber,
                                                             DateTime?registrationDate,
                                                             Sungero.Parties.ICounterparty counterparty,
                                                             Docflow.IOfficialDocument leadingDocument)
 {
     return(ContractStatements.GetAll()
            .Where(l => Equals(contractStatement.DocumentKind, l.DocumentKind))
            .Where(l => Equals(businessUnit, l.BusinessUnit))
            .Where(l => registrationDate == l.RegistrationDate)
            .Where(l => registrationNumber == l.RegistrationNumber)
            .Where(l => Equals(counterparty, l.Counterparty))
            .Where(l => Equals(leadingDocument, l.LeadingDocument))
            .Where(l => !Equals(contractStatement, l)));
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Проверить договор на дубли.
        /// </summary>
        /// <param name="contract">Договор.</param>
        /// <param name="businessUnit">Наша организация.</param>
        /// <param name="registrationNumber">Номер договора.</param>
        /// <param name="registrationDate">Дата договора.</param>
        /// <param name="counterparty">Контрагент.</param>
        /// <returns>Признак наличия дублей.</returns>
        public static bool HaveDuplicates(IContractBase contract,
                                          Sungero.Company.IBusinessUnit businessUnit,
                                          string registrationNumber,
                                          DateTime?registrationDate,
                                          Sungero.Parties.ICounterparty counterparty)
        {
            if (contract == null ||
                businessUnit == null ||
                string.IsNullOrWhiteSpace(registrationNumber) ||
                registrationDate == null ||
                counterparty == null)
            {
                return(false);
            }

            return(Functions.ContractBase.Remote.GetDuplicates(contract,
                                                               businessUnit,
                                                               registrationNumber,
                                                               registrationDate,
                                                               counterparty)
                   .Any());
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
 public void SearchDocumentsWithCounterparties(Sungero.Parties.ICounterparty counterparty)
 {
     Functions.Module.Remote.GetDocumentsWithCounterparties(counterparty).Show(counterparty.Name);
 }