/* eslint-disable */ /* ยฉ 2026 K2B NETWORK SOLUTIONS LLC. All rights reserved. Proprietary and confidential. Unauthorized copying, distribution, or use of this file, via any medium, is strictly prohibited. Original work product. */ // JBREWS DMS โ€” A/R Reports (scan 4). // A landing menu of the seven legacy reports + a viewer screen with a left // rail so every report button lands on a real, working report. const AR_REPORTS = [ { key: "list", label: "Customer List", desc: "All A/R accounts & terms", icon: "๐Ÿ“‹" }, { key: "stmt", label: "Statement Analysis",desc: "Per-account aging matrix", icon: "โ–ฆ" }, { key: "tb", label: "Trial Balance", desc: "A/R balances tie to GL 220", icon: "โ‰ก" }, { key: "delinq", label: "Delinquency Report",desc: "Past-due accounts by age", icon: "โš " }, { key: "deposit",label: "Deposit Report", desc: "Cash receipts by day", icon: "๐Ÿ’ต" }, { key: "letters",label: "Send Letters", desc: "Generate & log dunning letters", icon: "โœ‰" }, { key: "audit", label: "AR Audit", desc: "A/R activity trail", icon: "๐Ÿ”" }, ]; const ARReportsMenu = ({ go, onClose }) => ( ({ label: r.label, desc: r.desc, icon: r.icon, target: "arreportview", pre: () => { window.__arReport = r.key; }, })) }]} /> ); const ARReportView = ({ onClose, go }) => { const [, force] = React.useReducer(n => n + 1, 0); React.useEffect(() => DMS.subscribe(force), []); const [rep, setRep] = React.useState(() => { const h = (typeof window !== "undefined" && window.__arReport) || "list"; if (typeof window !== "undefined") window.__arReport = null; return h; }); const summary = DMS.arSummary(); const customers = DMS.arCustomers(); const meta = AR_REPORTS.find(r => r.key === rep) || AR_REPORTS[0]; return (
{/* left rail */}
{AR_REPORTS.map(r => { const active = r.key === rep; return (
setRep(r.key)} style={{ padding: "9px 14px", cursor: "pointer", display: "flex", gap: 9, alignItems: "center", background: active ? "var(--jb-blue-tint)" : "transparent", borderLeft: "3px solid " + (active ? "var(--jb-blue)" : "transparent") }}> {r.icon} {r.label}
); })}
{/* content */}
{meta.label}
{window.K2BStore ? (window.K2BStore.pageId() || "") + " โ€” " + window.K2BStore.branding().dba : ""} ยท {new Date().toLocaleDateString()}
{rep === "list" && } {rep === "stmt" && } {rep === "tb" && } {rep === "delinq" && } {rep === "deposit"&& } {rep === "letters"&& } {rep === "audit" && }
ESC-Close window.k2bToast && window.k2bToast(`${meta.label} queued to printer LP1.`, "ok")}>F9-Print window.k2bToast && window.k2bToast(`${meta.label} exported to ar_${rep}.csv`, "ok")}>F8-Export CSV go && go("aracct")}>F2-Accounts
); }; const repTable = { width: "100%", borderCollapse: "collapse", fontSize: 12.5 }; /* 1 โ€” Customer List */ const ARRepList = ({ customers }) => ( {customers.map(c => ( ))}
AcctNameTypeTerms ContactPhoneCredit LimitBalance
{c.acct}{c.name} {AR_TYPE_NAME[c.type] || c.type}{c.terms} {c.contact || "โ€”"}{c.phone} {arMoney(c.creditLimit)}{arMoney(DMS.arAge(c.acct).balance)}
); /* 2 โ€” Statement Analysis (aging matrix) */ const ARRepStatementAnalysis = ({ summary }) => ( {summary.rows.map(r => ( ))}
AcctName Current31โ€“6061โ€“9090+Balance
{r.acct}{r.name} {arMoney(r.buckets["0-30"])} 0 ? "var(--jb-amber)" : undefined }}>{arMoney(r.buckets["31-60"])} 0 ? "#C0651A" : undefined }}>{arMoney(r.buckets["61-90"])} 0 ? "var(--jb-red)" : undefined }}>{arMoney(r.buckets["90+"])} {arMoney(r.balance)}
TOTALS {arMoney(summary.totals["0-30"])}{arMoney(summary.totals["31-60"])} {arMoney(summary.totals["61-90"])}{arMoney(summary.totals["90+"])} {arMoney(summary.totals.balance)}
); /* 3 โ€” Trial Balance (ties to GL 220) */ const ARRepTrialBalance = ({ summary }) => { const d = DMS.arDefaults(); return ( <> {summary.rows.filter(r => Math.abs(r.balance) > 0.005).map(r => ( ))}
AcctCustomerTypeBalance
{r.acct}{r.name} {AR_TYPE_NAME[r.type] || r.type}{arMoney(r.balance)}
A/R sub-ledger total{arMoney(summary.totals.balance)}
โœ“ Sub-ledger total ties to General Ledger account {d.arAccount} โ€” {d.arAccountName}. Reconcile via GL โ€บ Schedules.
); }; /* 4 โ€” Delinquency */ const ARRepDelinquency = ({ summary }) => { const rows = summary.rows.filter(r => r.pastDue > 0.005).sort((a, b) => b.oldest - a.oldest); return rows.length === 0 ?
โœ“ No delinquent accounts. All balances current.
: ( {rows.map(r => ( ))}
AcctNameOldest 31โ€“6061โ€“9090+Past Due
{r.acct}{r.name} 90 ? "var(--jb-red)" : r.oldest > 60 ? "#C0651A" : "var(--jb-amber)", fontWeight: 700 }}>{r.oldest}d {arMoney(r.buckets["31-60"])}{arMoney(r.buckets["61-90"])} {arMoney(r.buckets["90+"])}{arMoney(r.pastDue)}
); }; /* 5 โ€” Deposit Report */ const ARRepDeposits = () => { const deps = DMS.arDeposits(); if (deps.length === 0) return
No cash receipts recorded.
; return (
{deps.map(day => (
Deposit โ€” {day.day} {arMoney(day.total)}
{day.items.map((it, i) => ( ))}
{it.acct}{it.name} {it.ref}{it.desc} {arMoney(it.amount)}
))}
); }; /* 6 โ€” Send Letters */ const ARRepLetters = () => { const [, force] = React.useReducer(n => n + 1, 0); const letters = DMS.arLetters(); const summary = DMS.arSummary(); const eligible = summary.rows.filter(r => r.pastDue > 0.005).length; return ( <>
{ _arToast(DMS.arSendLetters("31-60")); force(); }}>Generate 31+ Day Letters { _arToast(DMS.arSendLetters("61-90")); force(); }}>Generate 61+ Day Letters { _arToast(DMS.arSendLetters("90+")); force(); }}>Final Demand (90+) {eligible} account(s) currently past due
Letter History
{letters.length === 0 ?
No letters generated yet.
: ( {letters.map((l, i) => ( ))}
SentAcctNameTemplateBucketBalance
{new Date(l.sent).toLocaleDateString()}{l.acct} {l.name}{l.template} โ€” {l.templateName} {l.bucket}{arMoney(l.balance)}
)} ); }; /* 7 โ€” AR Audit */ const ARRepAudit = () => { const audit = DMS.audit().filter(e => /A\/R|AR /i.test(e.action || "") || /220|finance charge/i.test(e.detail || "")); return audit.length === 0 ?
No A/R activity recorded yet. Post a charge or payment to populate the trail.
: ( {audit.map((e, i) => ( ))}
TimestampUserActionDetail
{new Date(e.ts).toLocaleString()}{e.user} {e.action}{e.detail}
); }; Object.assign(window, { ARReportsMenu, ARReportView, AR_REPORTS });