mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
Cash Disbursement: exclude manual journal entries
Only actual payments (bill/check/register payments and Buildium-pulled payments) are disbursements. Skip manual JEs, reclasses, opening-balance entries, import adjustments and transfers (external_source null or in the excluded set) so adjustments no longer appear as cash disbursements. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,18 @@ type VendorGroup = { vendor: string; entries: Disbursement[]; subtotal: number }
|
||||
|
||||
const NO_VENDOR = "No vendor on record";
|
||||
|
||||
// Manual journal entries (adjustments, reclasses, opening balances, ad-hoc JEs)
|
||||
// are not cash disbursements — only actual payments (bills/checks/register
|
||||
// payments and Buildium-pulled payments) belong here. Skip these sources.
|
||||
const EXCLUDED_SOURCES = new Set([
|
||||
"acmacc_xfer", // bank-to-bank transfer
|
||||
"acmacc_manual", // manual journal entry posted in-app
|
||||
"acmacc_recl", // reclassification journal entry
|
||||
"acmacc_opening", // opening-balance entry
|
||||
"manual", // manual journal entry
|
||||
"import_adjustment",// import balancing adjustment
|
||||
]);
|
||||
|
||||
function monthStart() { const d = new Date(); return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-01`; }
|
||||
function today() { return new Date().toISOString().slice(0, 10); }
|
||||
|
||||
@@ -126,7 +138,9 @@ export function CashDisbursementReport({ companyId, companyName, logoUrl, from:
|
||||
let grandTotal = 0;
|
||||
|
||||
for (const { je, lines } of byJe.values()) {
|
||||
if (je.external_source === "acmacc_xfer") continue; // bank-to-bank transfers aren't disbursements
|
||||
// Manual journal entries / transfers / opening balances aren't disbursements.
|
||||
// (external_source null = an ad-hoc manual JE.)
|
||||
if (je.external_source == null || EXCLUDED_SOURCES.has(je.external_source)) continue;
|
||||
|
||||
const bankCredits = lines.filter((l) => Number(l.credit || 0) > 0 && acctById.get(l.account_id)?.is_bank);
|
||||
if (bankCredits.length === 0) continue;
|
||||
|
||||
Reference in New Issue
Block a user