diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 8450d9350..999c45344 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -4213,6 +4213,27 @@ + + disablebillwip + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + disablecontactvehiclecreation false @@ -27556,6 +27577,27 @@ + + disablebillwip + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + invoicedatefuture false diff --git a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx index 7dda524c4..d244a341c 100644 --- a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx +++ b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx @@ -1,4 +1,4 @@ -import { Button, Card, Table, Typography } from "antd"; +import { Alert, Button, Card, Table, Typography } from "antd"; import React, { useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -90,6 +90,9 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) { } > + {bodyshop.pbs_configuration?.disablebillwip && ( + + )} )} + {bodyshop.pbs_serialnumber && ( + + + + )} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 642c78de6..6cc02bf35 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -264,6 +264,7 @@ "dms": { "cashierid": "Cashier ID", "default_journal": "Default Journal", + "disablebillwip": "Disable bill WIP for A/P Posting", "disablecontactvehiclecreation": "Disable Contact & Vehicle Updates/Creation", "dms_acctnumber": "DMS Account #", "dms_wip_acctnumber": "DMS W.I.P. Account #", @@ -1624,6 +1625,7 @@ "apexported": "AP export completed. See logs for details.", "damageto": "Damage to $t(jobs.fields.area_of_damage_impact.{{area_of_damage}}).", "defaultstory": "B/S RO: {{ro_number}}. Owner: {{ownr_nm}}. Insurance Co: {{ins_co_nm}}. Claim/PO #: {{clm_po}}", + "disablebillwip": "Cost and WIP for bills has been ignored per shop configuration.", "invoicedatefuture": "Invoice date must be today or in the future for CDK posting.", "kmoutnotgreaterthankmin": "Mileage out must be greater than mileage in.", "logs": "Logs", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 7bfd318d1..992fd6c3b 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -264,6 +264,7 @@ "dms": { "cashierid": "", "default_journal": "", + "disablebillwip": "", "disablecontactvehiclecreation": "", "dms_acctnumber": "", "dms_wip_acctnumber": "", @@ -1624,6 +1625,7 @@ "apexported": "", "damageto": "", "defaultstory": "", + "disablebillwip": "", "invoicedatefuture": "", "kmoutnotgreaterthankmin": "", "logs": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 4d5dba656..9aea7d71f 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -264,6 +264,7 @@ "dms": { "cashierid": "", "default_journal": "", + "disablebillwip": "", "disablecontactvehiclecreation": "", "dms_acctnumber": "", "dms_wip_acctnumber": "", @@ -1624,6 +1625,7 @@ "apexported": "", "damageto": "", "defaultstory": "", + "disablebillwip": "", "invoicedatefuture": "", "kmoutnotgreaterthankmin": "", "logs": "", diff --git a/server/cdk/cdk-calculate-allocations.js b/server/cdk/cdk-calculate-allocations.js index 88cd5bc55..5d42d0cdb 100644 --- a/server/cdk/cdk-calculate-allocations.js +++ b/server/cdk/cdk-calculate-allocations.js @@ -118,26 +118,34 @@ exports.default = async function (socket, jobid) { } for cost export.` ); - const costCenterHash = job.bills.reduce((bill_acc, bill_val) => { - bill_val.billlines.map((line_val) => { - if (!bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]]) + let costCenterHash = {}; + //Check whether to skip this if PBS and using AP module. + const disablebillwip = !!bodyshop?.pbs_configuration?.disablebillwip; + + if (!disablebillwip) { + costCenterHash = job.bills.reduce((bill_acc, bill_val) => { + bill_val.billlines.map((line_val) => { + if ( + !bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] + ) + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = + Dinero(); + + let lineDinero = Dinero({ + amount: Math.round((line_val.actual_cost || 0) * 100), + }) + .multiply(line_val.quantity) + .multiply(bill_val.is_credit_memo ? -1 : 1); + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = - Dinero(); - - let lineDinero = Dinero({ - amount: Math.round((line_val.actual_cost || 0) * 100), - }) - .multiply(line_val.quantity) - .multiply(bill_val.is_credit_memo ? -1 : 1); - - bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = - bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]].add( - lineDinero - ); - return null; - }); - return bill_acc; - }, {}); + bill_acc[ + selectedDmsAllocationConfig.costs[line_val.cost_center] + ].add(lineDinero); + return null; + }); + return bill_acc; + }, {}); + } job.timetickets.forEach((ticket) => { //Get the total amount of the ticket. diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 40a338eda..cc03153dd 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -1351,6 +1351,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) { id md_responsibility_centers cdk_configuration + pbs_configuration } ro_number dms_allocation