示例#1
0
        public virtual void OnOrganizationBranchSync(BranchMaint branchMaint,
                                                     Organization organization,
                                                     BranchMaint.BranchBAccount branchBaccountCopy,
                                                     Action <BranchMaint, Organization, BranchMaint.BranchBAccount> baseMethod)
        {
            baseMethod(branchMaint, organization, branchBaccountCopy);

            if (!PXAccess.FeatureInstalled <FeaturesSet.rutRotDeduction>())
            {
                return;
            }

            OrganizationRUTROT organizationRutRot = Base.OrganizationView.Cache.GetExtension <OrganizationRUTROT>(organization);

            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.allowsRUTROT>(branchBaccountCopy, organizationRutRot.AllowsRUTROT);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rUTROTCuryID>(branchBaccountCopy, organizationRutRot.RUTROTCuryID);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.balanceOnProcess>(branchBaccountCopy, organizationRutRot.BalanceOnProcess);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.defaultRUTROTType>(branchBaccountCopy, organizationRutRot.DefaultRUTROTType);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rOTDeductionPct>(branchBaccountCopy, organizationRutRot.ROTDeductionPct);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rOTExtraAllowanceLimit>(branchBaccountCopy, organizationRutRot.ROTExtraAllowanceLimit);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rOTPersonalAllowanceLimit>(branchBaccountCopy, organizationRutRot.ROTPersonalAllowanceLimit);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rUTDeductionPct>(branchBaccountCopy, organizationRutRot.RUTDeductionPct);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rUTExtraAllowanceLimit>(branchBaccountCopy, organizationRutRot.RUTExtraAllowanceLimit);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rUTPersonalAllowanceLimit>(branchBaccountCopy, organizationRutRot.RUTPersonalAllowanceLimit);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rUTROTClaimNextRefNbr>(branchBaccountCopy, organizationRutRot.RUTROTClaimNextRefNbr);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.rUTROTOrgNbrValidRegEx>(branchBaccountCopy, organizationRutRot.RUTROTOrgNbrValidRegEx);
            branchMaint.BAccount.Cache.SetValue <BranchBAccountRUTROT.taxAgencyAccountID>(branchBaccountCopy, organizationRutRot.TaxAgencyAccountID);
        }
示例#2
0
        public TransmitterTRecord CreateTransmitterRecord(BranchMaint.BranchBAccount branchRow,
                                                          Contact rowMainContact,
                                                          Address rowMainAddress,
                                                          MISC1099EFileFilter filter,
                                                          int totalPayeeB)
        {
            return(new TransmitterTRecord
            {
                RecordType = "T",
                PaymentYear = filter.FinYear,
                PriorYearDataIndicator = filter.IsPriorYear == true ? "P" : string.Empty,
                TransmitterTIN = branchRow.TaxRegistrationID,
                TransmitterControlCode = branchRow.TCC,
                Blank1 = string.Empty,
                TestFileIndicator = filter.IsTestMode == true ? "T" : string.Empty,
                ForeignEntityIndicator = branchRow.ForeignEntity == true ? "1" : string.Empty,

                TransmitterName = rowMainContact.FullName.Trim(),
                CompanyName = rowMainContact.FullName.Trim(),

                CompanyMailingAddress = string.Concat(rowMainAddress.AddressLine1, rowMainAddress.AddressLine2),
                CompanyCity = rowMainAddress.City,
                CompanyState = rowMainAddress.State,
                CompanyZipCode = rowMainAddress.PostalCode,
                Blank2 = string.Empty,
                //Setup at the end - dependent of Payee B records
                TotalNumberofPayees = totalPayeeB.ToString(),
                ContactName = branchRow.ContactName,
                ContactTelephoneAndExt = branchRow.CTelNumber,
                ContactEmailAddress = branchRow.CEmail,
                Blank3 = string.Empty,
                RecordSequenceNumber = (++RecordCounter).ToString(),
                Blank4 = string.Empty,

                VendorIndicator = "V",
                VendorName = TRecordVendorInfo.VendorName,
                VendorMailingAddress = TRecordVendorInfo.VendorMailingAddress,
                VendorCity = TRecordVendorInfo.VendorCity,
                VendorState = TRecordVendorInfo.VendorState,
                VendorZipCode = TRecordVendorInfo.VendorZipCode,
                VendorContactName = TRecordVendorInfo.VendorContactName,
                VendorContactTelephoneAndExt = TRecordVendorInfo.VendorContactTelephoneAndExt,

                Blank5 = string.Empty,

                #region Check - Vendor or Branch?
                VendorForeignEntityIndicator = TRecordVendorInfo.VendorForeignEntityIndicator,
                #endregion

                Blank6 = string.Empty,
                Blank7 = string.Empty,
            });
        }
示例#3
0
        public PayerRecordA CreatePayerARecord(BranchMaint.BranchBAccount branchRow,
                                               Contact rowMainContact,
                                               Address rowMainAddress,
                                               LocationExtAddress rowShipInfo,
                                               Contact rowShipContact,
                                               MISC1099EFileFilter filter)
        {
            string companyName1 = rowMainContact.FullName.Trim();
            string companyName2 = string.Empty;

            if (companyName1.Length > 40)
            {
                companyName2 = companyName1.Substring(40);
                companyName1 = companyName1.Substring(0, 40);
            }
            return(new PayerRecordA
            {
                RecordType = "A",
                PaymentYear = filter.FinYear,
                CombinedFederalORStateFiler = branchRow.CFSFiler == true ? "1" : string.Empty,
                Blank1 = string.Empty,
                PayerTaxpayerIdentificationNumberTIN = branchRow.TaxRegistrationID,

                PayerNameControl = branchRow.NameControl,

                LastFilingIndicator = filter.IsLastFiling == true ? "1" : string.Empty,

                TypeofReturn = "A",
                AmountCodes = (filter.ReportingDirectSalesOnly == true) ? "1" : "12345678ABCDE",

                Blank2 = string.Empty,
                ForeignEntityIndicator = branchRow.ForeignEntity == true ? "1" : string.Empty,
                FirstPayerNameLine = companyName1,
                SecondPayerNameLine = companyName2,

                #region Check with Gabriel, we need Transfer Agent or no
                TransferAgentIndicator = "0",
                #endregion

                PayerShippingAddress = string.Concat(rowShipInfo.AddressLine1, rowShipInfo.AddressLine2),
                PayerCity = rowShipInfo.City,
                PayerState = rowShipInfo.State,
                PayerZipCode = rowShipInfo.PostalCode,

                PayerTelephoneAndExt = rowShipContact.Phone1,

                Blank3 = string.Empty,
                RecordSequenceNumber = (++RecordCounter).ToString(),
                Blank4 = string.Empty,
                Blank5 = string.Empty
            });
        }
示例#4
0
        public PayeeRecordB CreatePayeeBRecord(BranchMaint graph, BranchMaint.BranchBAccount branchRow, MISC1099EFileProcessingInfo Record1099, MISC1099EFileFilter filter)
        {
            PayeeRecordB bRecord;

            graph.Caches <AP1099History>().ClearQueryCache();
            using (new PXReadBranchRestrictedScope(Record1099.PayerBranchID))
            {
                VendorR rowVendor = PXSelect <VendorR, Where <VendorR.bAccountID, Equal <Required <VendorR.bAccountID> > > > .Select(graph, Record1099.VendorID);

                Contact rowVendorContact = PXSelect <Contact,
                                                     Where <Contact.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                                            And <Contact.contactID, Equal <Required <BAccount.defContactID> > > > > .Select(graph, rowVendor.BAccountID, rowVendor.DefContactID);

                Address rowVendorAddress = PXSelect <Address,
                                                     Where <Address.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                                            And <Address.addressID, Equal <Required <BAccount.defAddressID> > > > > .Select(graph, rowVendor.BAccountID, rowVendor.DefAddressID);

                LocationExtAddress rowVendorShipInfo = PXSelect <LocationExtAddress,
                                                                 Where <LocationExtAddress.locationBAccountID, Equal <Required <BAccount.bAccountID> >,
                                                                        And <LocationExtAddress.locationID, Equal <Required <BAccount.defLocationID> > > > > .Select(graph, rowVendor.BAccountID, rowVendor.DefLocationID);

                List <AP1099History> amtList1099 = PXSelectJoinGroupBy <AP1099History,
                                                                        InnerJoin <AP1099Box, On <AP1099History.boxNbr, Equal <AP1099Box.boxNbr> > >,
                                                                        Where <AP1099History.vendorID, Equal <Required <AP1099History.vendorID> >,
                                                                               And <AP1099History.finYear, Equal <Required <AP1099History.finYear> > > >,
                                                                        Aggregate <
                                                                            GroupBy <AP1099History.boxNbr,
                                                                                     Sum <AP1099History.histAmt> > > >
                                                   .Select(graph, Record1099.VendorID, filter.FinYear)
                                                   .Where(res => res.GetItem <AP1099History>().HistAmt >= res.GetItem <AP1099Box>().MinReportAmt)
                                                   .RowCast <AP1099History>()
                                                   .ToList();

                if ((amtList1099.Sum(hist => hist.HistAmt) ?? 0m) == 0m)
                {
                    return(null);
                }

                bRecord = new PayeeRecordB
                {
                    RecordType  = "B",
                    PaymentYear = filter.FinYear,

                    //ALWAYS G since we have one Payee record per file.
                    CorrectedReturnIndicator = filter.IsCorrectionReturn == true ? "G" : string.Empty,

                    NameControl = string.Empty,

                    #region confirmed with Gabriel - ALWAYS Business
                    TypeOfTIN = "1",
                    #endregion

                    PayerTaxpayerIdentificationNumberTIN = rowVendorShipInfo.TaxRegistrationID,

                    PayerAccountNumberForPayee = rowVendor.AcctCD,

                    #region Check with Gabriel, not sure about this
                    PayerOfficeCode = string.Empty,
                    #endregion

                    Blank1 = string.Empty,

                    PaymentAmount1 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 1)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount2 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 2)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount3 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 3)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount4 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 4)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount5 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 5)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount6 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 6)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount7 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 7)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmount8 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 8)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    //
                    //Need Box 11???
                    PaymentAmount9 = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 9)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    //
                    PaymentAmountA = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 10)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmountB = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 13)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmountC = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 14)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    Payment        = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 151)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmountE = filter.ReportingDirectSalesOnly == true ? 0m : Math.Round((amtList1099.FirstOrDefault(v => (v != null && v.BoxNbr == 152)) ?? new AP1099Hist {
                        HistAmt = 0m
                    }).HistAmt ?? 0m, 2),
                    PaymentAmountF = 0m,
                    PaymentAmountG = 0m,

                    ForeignCountryIndicator = rowVendor.ForeignEntity == true ? "1" : string.Empty,
                    PayeeNameLine           = rowVendorContact.FullName,

                    Blank2 = string.Empty,

                    PayeeMailingAddress = string.Concat(rowVendorAddress.AddressLine1, rowVendorAddress.AddressLine2),

                    Blank3 = string.Empty,

                    PayeeCity    = rowVendorAddress.City,
                    PayeeState   = rowVendorAddress.State,
                    PayeeZipCode = rowVendorAddress.PostalCode,

                    Blank4 = string.Empty,

                    RecordSequenceNumber = (++RecordCounter).ToString(),

                    Blank5 = string.Empty,

                    #region Confirmed with Gabriel, Skip for now
                    SecondTINNotice = string.Empty,
                    #endregion

                    Blank6 = string.Empty,

                    #region Check - Dependent on Box 9 - check in 3rd party
                    DirectSalesIndicator = GetDirectSaleIndicator(graph, Record1099.VendorID.Value, filter.FinYear),
                    #endregion

                    FATCA = rowVendor.FATCA == true ? "1": string.Empty,

                    Blank7 = string.Empty,

                    #region Confirmed with Gabriel, skip for now
                    SpecialDataEntries     = string.Empty,
                    StateIncomeTaxWithheld = string.Empty,
                    LocalIncomeTaxWithheld = string.Empty,
                    #endregion

                    CombineFederalOrStateCode = branchRow.CFSFiler == true?GetCombinedFederalOrStateCode(rowVendorAddress.State) : string.Empty,

                                                    Blank8 = string.Empty,
                };
            }
            return(bRecord);
        }