using System; using System.Collections.Generic; namespace AccountsDAL.DTO.AccountsReports { // Parsed/validated filter shape shared by AccountRegister and AccountRegisterSummary — // see AccountsBLL.AccountReports.AccountReportCriteriaParser for CriteriaDTO -> this mapping. public class AccountReportCriteria { public DateTime PeriodFromDate { get; set; } public DateTime PeriodToDate { get; set; } public int FinanceBookId { get; set; } public int BizTransactionTypeId { get; set; } public int BizTransactionClassId { get; set; } public int BizTransactionSubClassId { get; set; } public List VoucherDetailAccountIds { get; set; } = new(); public List OUIds { get; set; } = new(); public int OUGroupId { get; set; } = -1; public int DetailType { get; set; } = -1; public int CostCenterId { get; set; } public bool IncludeInformational { get; set; } // 0/1 today (0 = default/off, 1 = on) but modeled as int rather than bool since these are // expected to grow beyond a plain yes/no later (e.g. "summary only" vs "full breakdown") — // the DAL only checks ">0" today, so adding a new value later doesn't need a wire-shape change. public int NeedBillAllocation { get; set; } public int NeedCostCenter { get; set; } public int NeedInstrument { get; set; } public int NeedAddon { get; set; } public int NeedTDS { get; set; } public int CurrencyId { get; set; } public int PeriodId { get; set; } public string FromDocumentNumber { get; set; } public string ToDocumentNumber { get; set; } public int? FromDocumentId { get; set; } public int? ToDocumentId { get; set; } public decimal? FromAmount { get; set; } public decimal? ToAmount { get; set; } // Dimension-value filters — detail report only (the summary query never joins TBIZDIMENSION). public int V1Id { get; set; } public int V2Id { get; set; } public int V3Id { get; set; } public int V4Id { get; set; } public int V5Id { get; set; } public int? VoucherStatus { get; set; } // Mode-of-payment filter (TMMHEAD.MODEOFPAYMENT) — detail report only (summary never joins TMMHEAD). public List ModeOfPayment { get; set; } = new(); public int ControlAccountId { get; set; } public int AccountGroupId { get; set; } // Currency basis for reports that expose more than one amount axis (Ledger). 0 = OU/base // (VOUCHERAMOUNT), 1 = Transaction (VOUCHERAMOUNTFC/CURRENCYID), 2 = Customer/party // (VOUCHERAMOUNTAC/ACCURRENCYID, pre-computed on TVOUCHERDETAIL, confirmed live-populated), // 3 = Group (VOUCHERAMOUNTGC/GCCURRENCYCONVERSION, present but unpopulated on GB5DEMO today). public int CurrencyBasis { get; set; } // User/report-selectable target currency — 0 means "no conversion, use CurrencyBasis as-is". // When set, the DAL joins VEXCHANGEDATEWISE (by voucher date, OU/base -> this currency) to get // a date-wise CONVERSIONRATE and multiplies it into the base-currency amount. public int ReportCurrencyId { get; set; } // ── Outstanding (Receivable/Payable) report fields ── // As-of date for FNPENDINGBILL's dynamic pending-balance summing. Defaults to "today" if not // supplied by the caller (set by the parser, not here, since "today" depends on when Parse runs). public DateTime AsOnDate { get; set; } // Maps (inverted) to FNPENDINGBILL's @InfoRequired parameter — see AccountOutstandingReportsQB.cs // header comment for the confirmed-live polarity. Kept as the existing IncludeInformational flag // rather than a new field; the DAL performs the inversion at the call site. // Summary GroupType — Account(0, default)/AccountGroup(1)/ControlAccount(2)/InCharge(3)/ // PriceCategory(4)/Route(5)/OU(6). Matches legacy's GroupType enum values for the dimensions // actually wired up this phase ("Area" deferred — needs City/Address joins not yet validated). public int GroupType { get; set; } // 0 = overdue-only, 1 = not-yet-due, 2 = all (default). Independent of ageing buckets — this is // a due-date filter, ageing buckets (phase 1b) are bill-date based. public int Overdue { get; set; } = 2; // 0 = Receivable only, 1 = Payable only, 2 = Both (default) — matches legacy's ShowZeroBalance- // adjacent ReportType semantics for which side of the balance to show. public int ReportType { get; set; } = 2; public int InChargeId { get; set; } public int PriceCategoryId { get; set; } public int RouteId { get; set; } // ── Ageing report fields ── // Number of finite buckets to compute (1-9); legacy default is 5 (15/30/45/60/75). Anything // older than AgeBoundaries[NumberOfAge-1] falls into the Age10 "overflow" bucket. public int NumberOfAge { get; set; } = 5; // Day-boundary for each bucket's UPPER bound (inclusive) — bucket N covers // (AgeBoundaries[N-2]+1)..AgeBoundaries[N-1] days old (bucket 1 starts at 0). Always allocate 9 // slots regardless of NumberOfAge so callers can widen without a shape change. public int[] AgeBoundaries { get; set; } = { 15, 30, 45, 60, 75, 90, 105, 120, 135 }; // ── Settlement Register report field ── // Narrows the settlement trail down to a single original bill (TBILLALLOCATION.BILLALLOCATIONLINEID), // matching legacy's "BillAllocationId" criteria field. 0 = no filter (default). public int BillAllocationLineId { get; set; } // ── Collection/Payment Projection report field ── // Age threshold (days, measured from the real current date — matches legacy's literal GETDATE() // use here, not AsOnDate) for the "OverallAmount" aged-receivable flag. Legacy default: 90. public int OverallDays { get; set; } = 90; // ── Trial Balance Phase 3 (Detailed/Periodic/Comparative) fields ── // MGBPERIOD.PERIODTYPE — confirmed live values: 0=Daily, 1=Weekly, 2=Monthly, 3=Quarterly, // 4=HalfYearly, 5=Yearly, 6=48Week, 7=FN-48WeekFortnight, 8=FN-Daily, 9=FN-Weekly, // 10=FN-Monthly, 11=FN-Quarterly, 12=FN-HalfYearly ("FN-" = financial-year-aligned, e.g. FY // starting April; the plain ones are calendar-year Jan-Dec and can straddle two fiscal // years). Default 10 (FN-Monthly) per the user's own instruction — always caller-selectable, // never hardcoded by the report itself. public byte PeriodType { get; set; } = 10; // Comparative column axis: 0=OU (default), 1=Company, 2=Branch, 3=Division, 4=OUGroup. public byte ComparativeAxis { get; set; } = 0; // ── Nature-bucket drill-down filter (Finance Dashboard Migration) ── // 0=ACCOUNTSCHEDULENATURE (on MACCOUNT directly), 1=ACCOUNTGROUPNATURE (on MACCOUNTGROUP, // requires the AG join — only AccountRegisterDetailReport has it). Empty NatureValues = // no filter (default) — lets a P&L/Budget dashboard bucket click drill into the exact // vouchers that sum to that bucket's figure, same nature-value conventions already used by // WarehouseFactPostingQB/CashFlowReportQB. public byte NatureColumnType { get; set; } = 1; public List NatureValues { get; set; } = new(); // 0 = List, 1 = Summary public int OutstandingReportMode { get; set; } = 1; } }