Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: estimates vs actual shows the operation's real completed quantity (#1729)
Anshul sharmac1dcaa51144d
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobEstimatesVsActuals.tsx b/apps/erp/app/modules/production/ui/Jobs/JobEstimatesVsActuals.tsxindex cf9749a7d3..296979d29d 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobEstimatesVsActuals.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobEstimatesVsActuals.tsx@@ -62,6 +62,8 @@ type Operation = z.infer<typeof jobOperationValidator> & {operationQuantity: number | null;targetQuantity: number | null;reworkId: string | null;+ quantityComplete: number | null;+ quantityScrapped: number | null;};type JobMaterial = NonNullable<@@ -184,21 +186,13 @@ const JobEstimatesVsActuals = ({};};- const getCompleteQuantity = (operation: Operation) => {- const quantity = productionQuantities- .filter(- (pq) => pq.jobOperationId === operation.id && pq.type === "Production"- )- .reduce((acc, pq) => acc + pq.quantity, 0);- return quantity ?? 0;- };+ // Read the operation's own totals, not a sum of productionQuantity rows: a+ // desk "Mark as Complete" sets quantityComplete without writing any rows.+ const getCompleteQuantity = (operation: Operation) =>+ operation.quantityComplete ?? 0;- const getScrapQuantity = (operation: Operation) => {- const quantity = productionQuantities- .filter((pq) => pq.jobOperationId === operation.id && pq.type === "Scrap")- .reduce((acc, pq) => acc + pq.quantity, 0);- return quantity ?? 0;- };+ const getScrapQuantity = (operation: Operation) =>+ operation.quantityScrapped ?? 0;const getEmployeeIds = (operation: Operation,