IO-233 CDK updates.
This commit is contained in:
@@ -38,12 +38,7 @@ export function LaborAllocationsTable({
|
||||
useEffect(() => {
|
||||
if (!!joblines && !!timetickets && !!bodyshop);
|
||||
setTotals(
|
||||
CalculateAllocationsTotals(
|
||||
bodyshop.md_responsibility_centers,
|
||||
joblines,
|
||||
timetickets,
|
||||
adjustments
|
||||
)
|
||||
CalculateAllocationsTotals(bodyshop, joblines, timetickets, adjustments)
|
||||
);
|
||||
if (!jobId) setTotals([]);
|
||||
}, [joblines, timetickets, bodyshop, adjustments, jobId]);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import i18next from "i18next";
|
||||
|
||||
export const CalculateAllocationsTotals = (
|
||||
responsibilitycenters,
|
||||
bodyshop,
|
||||
joblines,
|
||||
timetickets,
|
||||
adjustments = []
|
||||
) => {
|
||||
const responsibilitycenters = bodyshop.md_responsibility_centers;
|
||||
const jobCodes = joblines.map((item) => item.mod_lbr_ty);
|
||||
//.filter((value, index, self) => self.indexOf(value) === index && !!value);
|
||||
const ticketCodes = timetickets.map((item) => item.ciecacode);
|
||||
@@ -15,7 +18,12 @@ export const CalculateAllocationsTotals = (
|
||||
const r = allCodes.reduce((acc, value) => {
|
||||
const r = {
|
||||
opcode: value,
|
||||
cost_center: responsibilitycenters.defaults.costs[value],
|
||||
cost_center:
|
||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
? i18next.t(
|
||||
`joblines.fields.lbr_types.${value && value.toUpperCase()}`
|
||||
)
|
||||
: responsibilitycenters.defaults.costs[value],
|
||||
mod_lbr_ty: value,
|
||||
total: joblines.reduce((acc2, val2) => {
|
||||
return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2;
|
||||
|
||||
Reference in New Issue
Block a user