コード例 #1
0
        private CompanyRecord CreateCompanyRecord(GAFPeriod gafPeriod, GSTAuditFile gstAuditFile, DateTime creationDate)
        {
            var companyRecord = new CompanyRecord();

            var branch      = _gafRepository.GetBranchByID(gafPeriod.BranchID);
            var baccount    = _gafRepository.GetBAccountByID(branch.BAccountID);
            var mainContact = _gafRepository.GetContact(baccount.DefContactID);

            companyRecord.CompanyName      = mainContact.FullName;
            companyRecord.CompanyBRN       = baccount.AcctReferenceNbr;
            companyRecord.CompanyGSTNumber = baccount.TaxRegistrationID;

            var taxPeriod = _gafRepository.GetTaxPeriodByKey(gafPeriod.BranchID, gafPeriod.TaxAgencyID, gafPeriod.TaxPeriodID);

            companyRecord.PeriodStartDate = taxPeriod.StartDate.Value;
            companyRecord.PeriodEndDate   = taxPeriod.EndDateUI.Value;

            companyRecord.FileCreationDate = creationDate;

            var acumaticaVersion = _gafRepository.GetAcumaticaVersion();

            companyRecord.ProductVersion = String.Concat("Acumatica", acumaticaVersion.CurrentVersion);
            companyRecord.GAFVersion     = String.Format(GafVersionTemplate, gstAuditFile.MajorVersion, GafVersionDelimiter,
                                                         gstAuditFile.MinorVersion);

            return(companyRecord);
        }
コード例 #2
0
        private string GetContragentCompanyNameIfApplicable(GLTran tran)
        {
            if (tran.ReferenceID != null)
            {
                int?defContactID;

                if (tran.Module == BatchModule.AP || tran.Module == BatchModule.PO)
                {
                    var vendor = _gafRepository.GetVendorsByIDs(tran.ReferenceID.SingleToArray())
                                 .Single();

                    defContactID = vendor.DefContactID;
                }
                else
                {
                    var customer = _gafRepository.GetCustomersByIDs(tran.ReferenceID.SingleToArray())
                                   .Single();

                    defContactID = customer.DefContactID;
                }

                var contact = _gafRepository.GetContact(defContactID);

                return(contact.FullName);
            }

            return(null);
        }