RrScratch3 - Tax / Extras Improvements

This commit is contained in:
Dave
2025-12-05 13:17:25 -05:00
parent 56738f800c
commit 288c8e6347
3 changed files with 377 additions and 80 deletions

View File

@@ -18,7 +18,21 @@ export default connect(mapStateToProps, mapDispatchToProps)(RrAllocationsSummary
/**
* Normalize job allocations into a flat list for display / preview building.
* @param ack
* @returns {{center: *, sale, partsSale, laborTaxableSale, laborNonTaxableSale, extrasSale, cost, profitCenter, costCenter}[]|*[]}
* @returns {{
* center: *,
* sale: *,
* partsSale: *,
* partsTaxableSale: *,
* partsNonTaxableSale: *,
* laborTaxableSale: *,
* laborNonTaxableSale: *,
* extrasSale: *,
* extrasTaxableSale: *,
* extrasNonTaxableSale: *,
* cost: *,
* profitCenter: *,
* costCenter: *
* }[]|*[]}
*/
function normalizeJobAllocations(ack) {
if (!ack || !Array.isArray(ack.jobAllocations)) return [];
@@ -31,9 +45,13 @@ function normalizeJobAllocations(ack) {
// bucketed sales used to build split ROGOG/ROLABOR
partsSale: row.partsSale || null,
partsTaxableSale: row.partsTaxableSale || null,
partsNonTaxableSale: row.partsNonTaxableSale || null,
laborTaxableSale: row.laborTaxableSale || null,
laborNonTaxableSale: row.laborNonTaxableSale || null,
extrasSale: row.extrasSale || null,
extrasTaxableSale: row.extrasTaxableSale || null,
extrasNonTaxableSale: row.extrasNonTaxableSale || null,
cost: row.cost || null,
profitCenter: row.profitCenter || null,
@@ -111,9 +129,12 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title, onAllocat
}, [fetchAllocations]);
const segmentLabelMap = {
partsExtras: "Parts/Extras",
laborTaxable: "Taxable Labor",
laborNonTaxable: "Non-Taxable Labor"
partsTaxable: "Parts Taxable",
partsNonTaxable: "Parts Non-Taxable",
extrasTaxable: "Extras Taxable",
extrasNonTaxable: "Extras Non-Taxable",
laborTaxable: "Labor Taxable",
laborNonTaxable: "Labor Non-Taxable"
};
const roggRows = useMemo(() => {
@@ -149,7 +170,7 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title, onAllocat
});
});
return rows;
}, [roggPreview, opCode]);
}, [roggPreview, opCode, segmentLabelMap]);
const rolaborRows = useMemo(() => {
if (!rolaborPreview || !Array.isArray(rolaborPreview.ops)) return [];
@@ -231,7 +252,8 @@ export function RrAllocationsSummary({ socket, bodyshop, jobId, title, onAllocat
<>
<Typography.Paragraph type="secondary" style={{ marginBottom: 8 }}>
OpCode: <strong>{effectiveOpCode}</strong>. Only centers with RR GOG mapping (rr_gogcode &amp; rr_item_type)
are included. Totals below reflect exactly what will be sent in ROGOG.
are included. Totals below reflect exactly what will be sent in ROGOG, with parts, extras, and labor split
into taxable / non-taxable segments.
</Typography.Paragraph>
<Table