public TaxBucketsCalculation(string taxTypeForCalculation, PXGraph aGraph, RoundingManager rmanager, Currency aCurrency, CurrencyRateByDate curyRateByDate, Func <TaxReportLine, bool> showTaxReportLine) { taxType = taxTypeForCalculation; roundingManager = rmanager; graph = aGraph; currency = aCurrency; rateByDate = curyRateByDate; int curVendorBaccountID = roundingManager.CurrentVendor.BAccountID.Value; aggregatesTable = TaxReportMaint.AnalyseBuckets(graph, curVendorBaccountID, taxTypeForCalculation, CalcWithZones, showTaxReportLine); linesWithRelatedAggregatesTable = TransposeDictionary(aggregatesTable); }
public static PXResultset <TaxReportLine, TaxHistory> GetPreviewReport(PXGraph graph, Vendor vendor, PXResultset <TaxReportLine, TaxHistory> records, Func <TaxReportLine, bool> ShowTaxReportLine = null) { if (records.Count == 0) { return(records); } const bool calcWithZones = true; int vendorbAccountID = vendor.BAccountID.Value; RoundingManager rmanager = new RoundingManager(vendor); Dictionary <int, List <int> > taxAggregatesDict = TaxReportMaint.AnalyseBuckets(graph, vendorbAccountID, TaxReportLineType.TaxAmount, calcWithZones, ShowTaxReportLine) ?? new Dictionary <int, List <int> >(); Dictionary <int, List <int> > taxableAggregatesDict = TaxReportMaint.AnalyseBuckets(graph, vendorbAccountID, TaxReportLineType.TaxableAmount, calcWithZones, ShowTaxReportLine) ?? new Dictionary <int, List <int> >(); var recordsByLineNumberTable = new Dictionary <int, PXResult <TaxReportLine, TaxHistory> >(); foreach (PXResult <TaxReportLine, TaxHistory> record in records) { TaxReportLine taxLine = record; TaxHistory taxHistory = record; taxHistory.ReportUnfiledAmt = rmanager.Round(taxHistory.ReportUnfiledAmt); recordsByLineNumberTable[taxLine.LineNbr.Value] = record; } CalculateReportUnfiledAmtForAggregatedTaxLines(taxAggregatesDict, recordsByLineNumberTable); CalculateReportUnfiledAmtForAggregatedTaxLines(taxableAggregatesDict, recordsByLineNumberTable); return(records); }