/* 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 — Missouri deal forms.
// Faithful, auto-filling printable templates for the Missouri DOR documents a
// dealership packet needs. Each form pulls live data from a selected deal
// (DMS.deals() + matched inventory). Print one, or the whole delivery packet.
//
// NOTE: these recreate the layout/fields of the official Missouri Department of
// Revenue forms as working templates. Validate against the current DOR revision
// before live use — DOR updates revision dates and fee schedules periodically.
// RC35 (brd): the ACTIVE store, read at print time from K2BPrint (name = the print name, license = the license line - what RC34 printed)
const MO_DEALER = { get name() { return K2BPrint.party.print(); }, get license() { return K2BPrint.party.license(); }, get addr1() { return K2BPrint.party.addr1(); }, get addr2() { return K2BPrint.party.addr2(); } };
const _moEsc = (s) => String(s ?? "").replace(/&/g, "&").replace(//g, ">");
const _moMoney = (n) => { const v = parseFloat(n); return isNaN(v) ? "" : "$" + v.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }); };
const _moChk = (on, label) => `${on ? "☒" : "☐"} ${_moEsc(label)} `;
const _moLine = (label, val, mono) => `
`;
const _moHead = () => (typeof dealerHeadHtml === "function") ? dealerHeadHtml() : `${_moEsc(MO_DEALER.name)}
`;
// Extra CSS injected into the print window for MO-form specifics.
const MO_EXTRA_CSS = `
.mo-formno { text-align:right; font-size:7.5pt; color:#444; margin-bottom:2px; letter-spacing:0.5px; }
.mo-formno b { color:#0b1424; }
.mo-banner { background:#0b1424; color:#fff; text-align:center; padding:5px; font-size:11pt; font-weight:700; letter-spacing:1.5px; }
.mo-sub { text-align:center; font-size:8pt; color:#555; margin:3px 0 10px; }
.mo-note { font-size:7pt; color:#555; margin-top:4px; }
.mo-chkrow { padding:6px 8px; border:1px solid #000; border-top:0; font-size:9.5pt; }
.mo-cert { border:1px solid #000; border-top:0; padding:7px 9px; font-size:8pt; line-height:1.4; text-align:justify; }
.mo-watermark { text-align:center; font-size:7pt; color:#999; letter-spacing:2px; margin:8px 0 0; }
.mo-twocol { display:grid; grid-template-columns:1fr 1fr; gap:0; border:1px solid #000; }
.mo-twocol > div { padding:5px 8px; border-right:1px solid #000; }
.mo-twocol > div:last-child { border-right:0; }
`;
// Map a DMS deal → the field set the MO forms need.
const moDealData = (deal) => {
if (!deal) return {};
const inv = ((window.DMS && window.DMS.inventory()) || []).find(v => v.stock === deal.stock) || {};
const vparts = String(deal.vehicle || "").split(" ");
const bparts = String(deal.buyer || "").split(",").map(s => s.trim());
return {
dealId: deal.id || "",
buyerName: deal.buyer || "",
buyerLast: bparts[0] || "", buyerFirst: bparts[1] || "",
vin: inv.vin || deal.vin || "",
year: inv.yr || vparts[0] || "", make: inv.mk || vparts[1] || "",
model: inv.mdl || vparts.slice(2).join(" ") || "",
body: inv.type || "", color: deal.color || "",
newUsed: (deal.type || "").toUpperCase().includes("USED") ? "Used" : "New",
stock: deal.stock || "",
odometer: deal.odometer || "",
salePrice: deal.salePrice || 0, docFee: deal.docFee || 0, titleFee: deal.titleFee || 0,
tax: deal.tax || 0, tradeAllow: deal.tradeAllow || 0, tradePayoff: deal.tradePayoff || 0,
tradeVeh: deal.tradeVeh || "", tradeVin: deal.tradeVin || "",
rebate: deal.rebate || 0, cashDown: deal.cashDown || 0, amtFinanced: deal.amtFinanced || 0,
lender: deal.lender || "", salesperson: deal.salesperson || "",
date: new Date().toLocaleDateString("en-US", { year: "numeric", month: "2-digit", day: "2-digit" }),
};
};
/* ── form builders (return html) ─────────────────────────────────── */
const moBuild = {
// DOR-108 — Application for Missouri Title and License
title108(d) {
return `${_moHead()}
Form DOR-108 (Rev. template) · Missouri Department of Revenue
APPLICATION FOR MISSOURI TITLE AND LICENSE
Motor Vehicle / Trailer · Deal ${_moEsc(d.dealId)} · ${_moEsc(d.date)}
Owner / Applicant
${_moLine("Owner Name (Last, First, MI)", d.buyerName)}${_moLine("Driver License / DOR ID No.", "")}
${_moLine("Mailing Address", "")}${_moLine("County of Residence", "")}
${_moLine("City", "")}${_moLine("State / ZIP", "MO")}
Vehicle Description
${_moLine("Vehicle Identification No. (VIN)", d.vin, true)}${_moLine("Year", d.year, true)}
${_moLine("Make", d.make)}${_moLine("Model", d.model)}
${_moLine("Body Type", d.body)}${_moLine("Odometer Reading", d.odometer, true)}
${_moLine("New or Used", d.newUsed)}${_moLine("Fuel Type", "Gas")}
Tax & Fee Computation
Purchase Price ${_moMoney(d.salePrice)}
Less Trade-In Allowance (${_moMoney(d.tradeAllow)})
Net Taxable Amount ${_moMoney(Math.max(0, d.salePrice - d.tradeAllow))}
State & Local Sales/Use Tax ${_moMoney(d.tax)}
Title Fee ${_moMoney(d.titleFee)}
Registration / License (est.) ${_moMoney(0)}
TOTAL DUE TO DOR ${_moMoney((+d.tax) + (+d.titleFee))}
I certify under penalties of perjury that the statements on this application are true and complete.
Application for title must be made within 30 days of purchase to avoid late title penalty (RSMo 301.190).
Owner Signature / Date
Co-Owner Signature / Date
TEMPLATE — VALIDATE AGAINST CURRENT DOR-108 BEFORE FILING
`;
},
// DOR-1957 — Bill of Sale
billOfSale1957(d) {
return `${_moHead()}
Form DOR-1957 (template) · Missouri Department of Revenue
BILL OF SALE
Deal ${_moEsc(d.dealId)} · ${_moEsc(d.date)}
Seller ${_moEsc(MO_DEALER.name)} ${_moEsc(MO_DEALER.addr1 || "")} ${_moEsc(MO_DEALER.addr2 || "")}
Purchaser ${_moEsc(d.buyerName)}
Vehicle
${_moLine("Year / Make", [d.year, d.make].filter(Boolean).join(" "))}${_moLine("Model", d.model)}
${_moLine("VIN", d.vin, true)}${_moLine("Odometer", d.odometer, true)}
Consideration
Sale Price ${_moMoney(d.salePrice)}
Documentary / Admin Fee ${_moMoney(d.docFee)}
TOTAL CONSIDERATION ${_moMoney((+d.salePrice) + (+d.docFee))}
The seller certifies that the above vehicle is sold and conveyed to the purchaser, and warrants the vehicle is
free of all liens and encumbrances except as disclosed in writing. The odometer reading is certified on the accompanying Odometer Disclosure Statement.
Seller (Dealer Rep) / Date
Purchaser / Date
`;
},
// DOR-3019 — Odometer Disclosure (Missouri / federal 49 CFR 580)
odometer3019(d) {
return `${_moHead()}
Form DOR-3019 (template) · Federal 49 CFR Part 580
ODOMETER DISCLOSURE STATEMENT
Required by Federal & State Law · Deal ${_moEsc(d.dealId)}
${_moLine("Year / Make / Model", [d.year, d.make, d.model].filter(Boolean).join(" "))}${_moLine("Body Type", d.body)}
${_moLine("Vehicle Identification No.", d.vin, true)}${_moLine("Odometer (no tenths)", d.odometer, true)}
I, the transferor, certify that to the best of my knowledge the odometer reading reflects the ACTUAL MILEAGE, unless one of the following is checked:
${_moChk(false, "(1) Mileage is IN EXCESS of its mechanical limits.")}
${_moChk(false, "(2) Odometer reading is NOT the actual mileage. WARNING — ODOMETER DISCREPANCY.")}
Transferor (Seller) ${_moEsc(MO_DEALER.name)} Signature: ____________________ Date: ${_moEsc(d.date)}
Transferee (Buyer) ${_moEsc(d.buyerName)} Signature: ____________________ Date: ____________
Federal and state law (49 U.S.C. 32705) require that you state the mileage upon transfer of ownership. Failure to complete
or providing a false statement may result in fines and/or imprisonment.
`;
},
// DOR-4809 — Notice of Lien
lien4809(d) {
return `${_moHead()}
Form DOR-4809 (template) · Missouri Department of Revenue
NOTICE OF LIEN / LIEN RELEASE / AUTHORIZATION
Deal ${_moEsc(d.dealId)} · ${_moEsc(d.date)}
${_moLine("Owner Name", d.buyerName)}${_moLine("VIN", d.vin, true)}
${_moLine("Year / Make / Model", [d.year, d.make, d.model].filter(Boolean).join(" "))}${_moLine("Title No.", "")}
Lienholder
${_moLine("Lienholder Name", d.lender)}${_moLine("Amount Financed", _moMoney(d.amtFinanced))}
${_moLine("Lienholder Mailing Address", "")}${_moLine("Date of Lien", d.date)}
${_moChk(!!d.lender, "ADD lien (perfect security interest)")} ${_moChk(false, "RELEASE lien")} ${_moChk(false, "Authorization to add/remove name")}
The lien shown is to be recorded against the certificate of title for the vehicle described above. The Director of Revenue is
authorized to note the lien on the Missouri title and deliver the title to the first lienholder.
Owner Signature / Date
Lienholder / Agent Signature / Date
`;
},
// DOR-5049 — Notice of Sale or Transfer
noticeOfSale5049(d) {
return `${_moHead()}
Form DOR-5049 (template) · Missouri Department of Revenue
NOTICE OF SALE OR TRANSFER
Seller's record of sale · Deal ${_moEsc(d.dealId)} · ${_moEsc(d.date)}
${_moLine("Year / Make / Model", [d.year, d.make, d.model].filter(Boolean).join(" "))}${_moLine("VIN", d.vin, true)}
${_moLine("Date of Sale", d.date)}${_moLine("Selling Price", _moMoney(d.salePrice))}
${_moLine("Purchaser Name", d.buyerName)}${_moLine("Purchaser Address", "")}
This notice records the transfer of ownership of the vehicle described above and relieves the seller of liability as of the
date of sale. Submit to the Missouri Department of Revenue or file electronically within five (5) days of sale (RSMo 301.196).
Seller Signature / Date
Dealer Representative / Date
`;
},
// RC37 (forms37): the secure Power of Attorney is DOR Form 5086 (the dealer's copy: REV. 05-2013), a SECURE form the State issues. In a
// packet the DMS prints the plain-paper REFERENCE COPY (K2BForms); the data goes onto the real form with "Onto DOR form" (K2BForms.moOverlay).
poa4789(d) {
if (window.K2BForms) { const dl = ((window.DMS && window.DMS.deals && window.DMS.deals()) || []).find(x => x && x.id === d.dealId) || null; return window.K2BForms.bodyFor("moSecurePoa", dl ? { deal: dl } : { noDeal: true }); }
return `${_moHead()}
Form DOR-4789 (template) · Missouri Department of Revenue
SECURE POWER OF ATTORNEY
Odometer & title assignment · Deal ${_moEsc(d.dealId)}
${_moLine("Year / Make / Model", [d.year, d.make, d.model].filter(Boolean).join(" "))}${_moLine("VIN", d.vin, true)}
${_moLine("Odometer Reading", d.odometer, true)}${_moLine("Title No.", "")}
I/we, ${_moEsc(d.buyerName)} , hereby appoint ${_moEsc(MO_DEALER.name)} as my/our attorney-in-fact to sign and
complete the title assignment and odometer disclosure for the vehicle described above. This power of attorney is limited to this transaction.
Grantor Signature / Date
Attorney-in-Fact / Date
`;
},
// Missouri Motor Vehicle Sales Tax Computation worksheet
salesTaxCalc(d) {
const net = Math.max(0, (+d.salePrice) - (+d.tradeAllow));
return `${_moHead()}
Worksheet (template) · Missouri Motor Vehicle Sales/Use Tax
MISSOURI SALES TAX COMPUTATION
RSMo 144.020 · Trade-in credit allowed · Deal ${_moEsc(d.dealId)}
1. Purchase Price of Vehicle ${_moMoney(d.salePrice)}
2. Less: Trade-In Allowance (RSMo 144.025) (${_moMoney(d.tradeAllow)})
3. Net Taxable Purchase (Line 1 − Line 2) ${_moMoney(net)}
4. State Tax @ 4.225% ${_moMoney(net * 0.04225)}
5. Local / County / City Tax (varies by residence) ${_moMoney(Math.max(0, (+d.tax) - net * 0.04225))}
6. TOTAL SALES / USE TAX DUE ${_moMoney(d.tax)}
Local rates are determined by the purchaser's address of residence, not the dealership location. Verify the current
combined rate on the DOR sales-tax rate lookup before titling.
`;
},
// FTC Buyers Guide (used vehicles) - RC37 (forms37): the dealer's FTC Buyers Guide (K2BForms, 16 CFR 455 wording, front + back)
buyersGuide(d) {
if (window.K2BForms) { const dl = ((window.DMS && window.DMS.deals && window.DMS.deals()) || []).find(x => x && x.id === d.dealId) || null; return window.K2BForms.bodyFor("buyerGuide", dl ? { deal: dl } : { noDeal: true }); }
const isUsed = d.newUsed === "Used";
return `${_moHead()}
Federal Trade Commission · 16 CFR Part 455 (template)
BUYERS GUIDE
${_moEsc([d.year, d.make, d.model].filter(Boolean).join(" "))} · VIN ${_moEsc(d.vin)} · Stock ${_moEsc(d.stock)}
${isUsed ? "☒" : "☐"} AS IS — NO DEALER WARRANTY
The dealer does not provide a warranty for any repairs after sale.
${isUsed ? "☐" : "☒"} DEALER WARRANTY
${isUsed ? "Full / Limited warranty if checked — see terms." : "New-vehicle manufacturer warranty applies."}
Spoken promises are difficult to enforce. Ask the dealer to put all promises in writing. Keep this form.
Under state law, "implied warranties" may give you additional rights. The information on this form is part of any contract to buy this vehicle.
A completed Buyers Guide must be displayed in the window of every used vehicle offered for sale.
Buyer acknowledges receipt / Date
Dealer Representative / Date
`;
},
};
// Catalog used by the screen.
const MO_FORMS = [
{ key: "title108", no: "DOR-108", name: "Application for Missouri Title & License", cat: "Title", build: "title108" },
{ key: "billOfSale1957", no: "DOR-1957", name: "Bill of Sale", cat: "Sale", build: "billOfSale1957" },
{ key: "odometer3019", no: "DOR-3019", name: "Odometer Disclosure Statement", cat: "Sale", build: "odometer3019" },
{ key: "lien4809", no: "DOR-4809", name: "Notice of Lien / Lien Release", cat: "Title", build: "lien4809" },
{ key: "noticeOfSale5049", no: "DOR-5049", name: "Notice of Sale or Transfer", cat: "Title", build: "noticeOfSale5049" },
{ key: "poa4789", no: "DOR-5086", name: "Secure Power of Attorney (reference copy)", cat: "Title", build: "poa4789" }, // RC37 (forms37): the form is DOR 5086 (the key stays)
{ key: "salesTaxCalc", no: "WORKSHEET",name: "Missouri Sales Tax Computation", cat: "Tax", build: "salesTaxCalc" },
{ key: "buyersGuide", no: "FTC 455", name: "FTC Buyers Guide (As-Is / Warranty)", cat: "F&I", build: "buyersGuide" },
];
// Print a single form, or a packet (page-break between forms).
const moPrint = (formKeys, deal) => {
const d = moDealData(deal);
const keys = Array.isArray(formKeys) ? formKeys : [formKeys];
const bodies = keys.map(k => { const f = MO_FORMS.find(x => x.key === k); return f ? moBuild[f.build](d) : ""; });
const html = `` + bodies.join('
');
const title = keys.length > 1 ? `MO Delivery Packet — ${deal ? deal.id : ""}` : (MO_FORMS.find(x => x.key === keys[0]) || {}).name;
if (window.k2bPrint) window.k2bPrint(html, { title });
else window.k2bToast && window.k2bToast("Print engine not ready.", "warn");
};
/* ── Screen ─────────────────────────────────────────────────────────────── */
const MOForms = ({ onClose, go }) => {
const [, force] = React.useReducer(n => n + 1, 0);
React.useEffect(() => DMS.subscribe(force), []);
const deals = (DMS.deals() || []).filter(d => d.buyer);
const [dealId, setDealId] = React.useState(deals[0] ? deals[0].id : null);
const deal = deals.find(d => d.id === dealId) || deals[0];
const d = moDealData(deal);
const [sel, setSel] = React.useState(() => Object.fromEntries(MO_FORMS.map(f => [f.key, true])));
const chosen = MO_FORMS.filter(f => sel[f.key]).map(f => f.key);
return (
Deal
setDealId(e.target.value)} style={{ fontSize: 14, padding: "5px 8px", minWidth: 320 }}>
{deals.map(dl => {dl.id} — {dl.buyer} · {dl.vehicle} )}
moPrint(chosen, deal)} disabled={!chosen.length}>🖨 Print Delivery Packet ({chosen.length})
{deal && (
Buyer: {d.buyerName || "—"}
Vehicle: {[d.year, d.make, d.model].filter(Boolean).join(" ") || "—"}
VIN: {d.vin || "—"}
Price: {_moMoney(d.salePrice)}
Tax: {_moMoney(d.tax)}
Lien: {d.lender || "Cash"}
)}
{MO_FORMS.map(f => (
moPrint(f.key, deal)}>🖨 Print
moPrint(f.key, deal)}>Preview
{f.key === "poa4789" && window.K2BForms ? window.K2BForms.moOverlay(deal ? { deal } : { noDeal: true })}>Onto DOR form : null}
))}
ESC-Close
go && go("deal")}>F2-Deals
go && go("forms")}>F3-All Forms
Templates — validate against current DOR revisions before filing.
);
};
Object.assign(window, { MOForms, MO_FORMS, moBuild, moPrint, moDealData });