-
- {t("jobs.labels.laborallocations")}
-
-
-
-
- {t("timetickets.fields.cost_center")}
-
-
- {t("jobs.labels.hrs_total")}
-
-
- {t("jobs.labels.hrs_claimed")}
-
-
- {t("jobs.labels.difference")}
-
-
- {totals.map((t, idx) => (
-
- {t.cost_center}
- {t.total.toFixed(2)}
- {t.claimed.toFixed(2)}
-
- 0 ? "green" : "red",
- }}
- >
- {(t.total - t.claimed).toFixed(2)}
-
-
-
- ))}
+
+
+ {t("jobs.labels.laborallocations")}
+
+
+
+
+
+ |
+ {t("timetickets.fields.cost_center")}
+ |
+
+ {t("jobs.labels.hrs_total")}
+ |
+
+ {t("jobs.labels.hrs_claimed")}
+ |
+
+ {t("jobs.labels.adjustments")}
+ |
+
+ {t("jobs.labels.difference")}
+ |
+
+
+
+ {totals.map((t, idx) => (
+
+ | {t.cost_center} |
+ {t.total.toFixed(1)} |
+ {t.claimed.toFixed(1)} |
+
+ {t.adjustments.toFixed(1)}
+
+
+
+ |
+
+ 0 ? "green" : "red",
+ }}
+ >
+ {t.difference}
+
+ |
+
+ ))}
+
+
+
+
);
}
diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.styles.scss b/client/src/components/labor-allocations-table/labor-allocations-table.styles.scss
new file mode 100644
index 000000000..afd84fec5
--- /dev/null
+++ b/client/src/components/labor-allocations-table/labor-allocations-table.styles.scss
@@ -0,0 +1,30 @@
+.labor-allocations-table {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ table {
+ border: 1px solid #ccc;
+ border-collapse: collapse;
+ margin: 0;
+ padding: 0;
+ width: 80%;
+ table-layout: fixed;
+ }
+
+ table tr {
+ //background-color: #f8f8f8;
+ border: 1px solid #ddd;
+ padding: 0.35em;
+ }
+
+ table th,
+ table td {
+ padding: 0.625em;
+ text-align: center;
+ }
+ table td.currency {
+ text-align: right;
+ }
+}
diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.utility.js b/client/src/components/labor-allocations-table/labor-allocations-table.utility.js
index 8d36bcfdd..d4f669ed2 100644
--- a/client/src/components/labor-allocations-table/labor-allocations-table.utility.js
+++ b/client/src/components/labor-allocations-table/labor-allocations-table.utility.js
@@ -1,29 +1,41 @@
export const CalculateAllocationsTotals = (
responsibilitycenters,
joblines,
- timetickets
+ timetickets,
+ adjustments = []
) => {
- const jobCodes = joblines
- .map((item) => item.mod_lbr_ty)
- .filter((value, index, self) => self.indexOf(value) === index && !!value);
- const ticketCodes = timetickets
- .map((item) => item.cieca_code)
- .filter((value, index, self) => self.indexOf(value) === index && !!value);
- const allCodes = [...jobCodes, ...ticketCodes];
+ const jobCodes = joblines.map((item) => item.mod_lbr_ty);
+ //.filter((value, index, self) => self.indexOf(value) === index && !!value);
+ const ticketCodes = timetickets.map((item) => item.cieca_code);
+ //.filter((value, index, self) => self.indexOf(value) === index && !!value);
+ const adjustmentCodes = adjustments.map((item) => item.mod_lbr_ty);
+ //.filter((value, index, self) => self.indexOf(value) === index && !!value);
+ const allCodes = [...jobCodes, ...ticketCodes, ...adjustmentCodes].filter(
+ (value, index, self) => self.indexOf(value) === index && !!value
+ );
const r = allCodes.reduce((acc, value) => {
- acc.push({
+ const r = {
opcode: value,
cost_center: responsibilitycenters.defaults.costs[value],
total: joblines.reduce((acc2, val2) => {
return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2;
}, 0),
+ adjustments: adjustments.reduce((acc3, val3) => {
+ console.log("acc3", acc3);
+ console.log("val3", val3);
+ return val3.mod_lbr_ty === value ? acc3 + val3.hours : acc3;
+ }, 0),
claimed: timetickets.reduce((acc3, val3) => {
return val3.ciecacode === value ? acc3 + val3.productivehrs : acc3;
}, 0),
- });
+ };
+
+ r.difference = (r.total + r.adjustments - r.claimed).toFixed(2);
+ acc.push(r);
return acc;
}, []);
+ console.log("r", r);
return r;
};
diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx
index 3329bf193..1cb2905ae 100644
--- a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx
+++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx
@@ -121,10 +121,13 @@ export default function TimeTicketModalComponent({