Add Sales Tax Liability report with PDF and CSV export

Invoice-basis report showing taxable vs non-taxable sales, tax billed
by GL account, monthly trend table/chart, and full invoice detail grid.
Non-taxable invoice rows shaded grey for easy scanning. Quick-preset
date buttons (This Month, Last Month, YTD, Last Year) for common filing
periods. CSV export formatted for accountants and tax-filing software.
Gated behind AllowAccounting() like other financial reports.

- SalesTaxReportDto + 3 supporting DTOs in FinancialReportDtos.cs
- GetSalesTaxReportAsync on IFinancialReportService + implementation
- GenerateSalesTaxReportPdfAsync on IPdfService + QuestPDF implementation
- SalesTax / SalesTaxPdf / SalesTaxCsv actions in ReportsController
- Views/Reports/SalesTax.cshtml with Chart.js monthly trend chart
- Landing page card added to Finance section
- HelpKnowledgeBase and Help/Reports.cshtml updated with full docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 12:27:08 -04:00
parent 7e0699d5bd
commit ca4fb959aa
11 changed files with 898 additions and 7 deletions
@@ -159,3 +159,65 @@ public class SalesInvoiceLineDto
public decimal AmountPaid { get; set; }
public decimal BalanceDue { get; set; }
}
// ============================================================
// SALES TAX REPORT
// ============================================================
public class SalesTaxReportDto
{
public DateTime From { get; set; }
public DateTime To { get; set; }
public string CompanyName { get; set; } = string.Empty;
/// <summary>Subtotal of invoices where TaxAmount > 0.</summary>
public decimal TotalTaxableSales { get; set; }
/// <summary>Subtotal of invoices where TaxAmount == 0.</summary>
public decimal TotalNonTaxableSales { get; set; }
/// <summary>Sum of all TaxAmount values across the period.</summary>
public decimal TotalTaxBilled { get; set; }
public int TaxableInvoiceCount { get; set; }
public int NonTaxableInvoiceCount { get; set; }
public decimal EffectiveTaxRate => TotalTaxableSales == 0 ? 0
: Math.Round(TotalTaxBilled / TotalTaxableSales * 100, 2);
public List<SalesTaxByAccountDto> ByAccount { get; set; } = new();
public List<SalesTaxByMonthDto> ByMonth { get; set; } = new();
public List<SalesTaxInvoiceLineDto> Invoices { get; set; } = new();
}
public class SalesTaxByAccountDto
{
public int? AccountId { get; set; }
public string AccountName { get; set; } = string.Empty;
public string AccountNumber { get; set; } = string.Empty;
public decimal TaxableSales { get; set; }
public decimal TaxBilled { get; set; }
public int InvoiceCount { get; set; }
}
public class SalesTaxByMonthDto
{
public int Year { get; set; }
public int Month { get; set; }
public string Label { get; set; } = string.Empty;
public decimal TaxableSales { get; set; }
public decimal TaxBilled { get; set; }
public int InvoiceCount { get; set; }
}
public class SalesTaxInvoiceLineDto
{
public int InvoiceId { get; set; }
public string InvoiceNumber { get; set; } = string.Empty;
public string CustomerName { get; set; } = string.Empty;
public DateTime InvoiceDate { get; set; }
public string Status { get; set; } = string.Empty;
public decimal SubTotal { get; set; }
public decimal TaxPercent { get; set; }
public decimal TaxAmount { get; set; }
public decimal Total { get; set; }
public decimal AmountPaid { get; set; }
public decimal BalanceDue { get; set; }
public string TaxAccountName { get; set; } = string.Empty;
}