/* 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 — Sales Incentive Compliance (SIR). // Self-review dashboard modeled on GM's annual Sales Incentive Review. Scans // posted/working deals for the high-risk audit issues SIR flags — bona fide // sold-order eligibility, delivery reporting & customer qualification, cash // reporting, and sale-for-resale/export risk — and provides the SIR best- // practice self-review checklist. Read-only over the live deal ledger. const sirMoney = (n) => "$" + (Number(n) || 0).toLocaleString("en-US", { maximumFractionDigits: 0 }); const sirDays = (iso) => iso ? Math.floor((Date.now() - new Date(iso)) / 86400000) : 0; // Risk rules over a deal. Each returns a flag {sev, label, why} or null. function sirFlags(d) { const flags = []; const status = (d.status || "").toLowerCase(); // Sold Not Delivered aging — bona fide sold orders must be delivered timely if (status.includes("sold not delivered") || (d.sold && !d.delivered)) { const age = sirDays(d.soldDate || d.created); if (age >= 30) flags.push({ sev: "high", label: "Sold-not-delivered " + age + "d", why: "Bona fide sold orders must be delivered to the same purchaser timely. Aged SND is a top SIR chargeback risk." }); } // Customer qualification — missing identity on a reported delivery if (d.postedToGL && !d.custNum) flags.push({ sev: "high", label: "Customer not qualified", why: "Delivery reported without a verified customer record (name/phone). SIR requires proper customer qualification." }); // Cash reporting — IRS 8300 on cash > $10k if ((+d.cashDown || 0) > 10000) flags.push({ sev: "med", label: "8300 cash > $10k", why: "Cash received over $10,000 requires IRS/FinCEN Form 8300 within 15 days." }); // Sale for resale / export risk — out-of-pattern buyer signals if (/resale|resell|export|dealer|wholesale/i.test((d.buyer || "") + " " + (d.notes || ""))) flags.push({ sev: "high", label: "Resale / export risk", why: "Possible sale-for-resale or sale-for-export — ineligible for retail incentives and a flagged SIR issue." }); // PPT eligibility / firm price — incentive stacked beyond firm price if ((+d.rebate || 0) > 0 && status.includes("working")) flags.push({ sev: "low", label: "Verify PPT/firm price", why: "Confirm incentive program applicable at delivery matches the firm price on the original sold order." }); return flags; } const SIR_CHECKLIST = [ { k: "boniFide", label: "Every sold order has a signed order with model, quantity & firm price" }, { k: "delivery", label: "Deliveries reported only after bona fide commitment + payment/contract" }, { k: "custQual", label: "Customer identity verified & qualified before reporting delivery" }, { k: "ppt", label: "Incentive program at delivery reconciles to the original firm price" }, { k: "courtesy", label: "Courtesy Transportation claims tie to valid, documented repairs" }, { k: "resale", label: "No sale-for-resale or sale-for-export on retail-incentivized units" }, { k: "controls", label: "Internal controls: separation of duties on incentive submission" }, { k: "training", label: "All key dealership personnel reviewed the current SIR materials" }, ]; const SIR_CK_KEY = "jbrews-sir-checklist-v1"; const SalesIncentive = ({ onClose, go }) => { const D = window.DMS; const [, force] = React.useReducer(n => n + 1, 0); React.useEffect(() => (D && D.subscribe) ? D.subscribe(force) : undefined, []); const deals = (D && D.deals) ? D.deals() : []; const [ck, setCk] = React.useState(() => { try { return JSON.parse(localStorage.getItem(SIR_CK_KEY) || "{}"); } catch (e) { return {}; } }); const setCheck = (k, v) => { const next = { ...ck, [k]: v }; setCk(next); try { localStorage.setItem(SIR_CK_KEY, JSON.stringify(next)); } catch (e) {} }; const flagged = deals.map(d => ({ d, flags: sirFlags(d) })).filter(x => x.flags.length); const highCount = flagged.reduce((s, x) => s + x.flags.filter(f => f.sev === "high").length, 0); const ckDone = SIR_CHECKLIST.filter(q => ck[q.k]).length; const compliancePct = Math.round((ckDone / SIR_CHECKLIST.length) * 100); // Compliance-credit eligibility: all checklist items + no high-risk open flags const eligible = ckDone === SIR_CHECKLIST.length && highCount === 0; const sevTone = (s) => s === "high" ? { bg: "#FBE9E7", fg: "#B23A2E" } : s === "med" ? { bg: "#F6E2C5", fg: "#9A6700" } : { bg: "#E7F0FB", fg: "#1456A0" }; return (
{}} onMax={() => {}} />
{/* left — risk scan */}
{[["Deals Scanned", deals.length, "var(--jb-navy)"], ["Flagged Deals", flagged.length, flagged.length ? "var(--jb-amber, #9A6700)" : "var(--jb-green)"], ["High-Risk Issues", highCount, highCount ? "var(--jb-red)" : "var(--jb-green)"]].map(([lab, val, c], i) => (
{lab}
{val}
))}
Out-of-Line Practices — Self-Review
{flagged.length === 0 ? (
✓ No incentive-compliance flags on current deals.
) : flagged.map(({ d, flags }) => (
{d.id} {d.buyer} {d.vehicle || ""}
{flags.map((f, i) => { const t = sevTone(f.sev); return ( {f.label} ); })}
))}
Bona fide sold order: an order executed by Dealer and customer setting model, quantity and firm price, delivered to the same purchaser at that firm price. Sold = bona fide commitment evidenced by a signed order plus full payment, a signed finance/lease contract, or a valid A/R established.
{/* right — checklist + eligibility */}
Compliance Credit
{eligible ? "Eligible" : "Not Yet Eligible"}
{eligible ? "All self-review items complete and no high-risk issues open." : `${SIR_CHECKLIST.length - ckDone} checklist item(s) and ${highCount} high-risk issue(s) remain.`}
{compliancePct}% self-review complete
SIR Self-Review Checklist
{SIR_CHECKLIST.map(q => ( ))}
This self-review does not supersede the GM Dealer Sales & Service Agreement, the Dealer Sales Allowance and Incentive Manual, or individual program rules.
ESC-Close go && go("deal")}>Deals go && go("fcso")}>FCSO window.k2bPrintMediation && window.k2bPrintMediation()}>🖨 Request for Mediation window.k2bPrintRebate && window.k2bPrintRebate()}>🖨 Rebate Claim
); }; Object.assign(window, { SalesIncentive });