edit
false
diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx
index 9cad08f90..3fc134ce5 100644
--- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx
+++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx
@@ -29,6 +29,7 @@ import BillFormContainer from "../bill-form/bill-form.container";
import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility";
import { handleUpload } from "../documents-upload/documents-upload.utility";
+import { useTreatments } from "@splitsoftware/splitio-react";
const mapStateToProps = createStructuredSelector({
billEnterModal: selectBillEnterModal,
@@ -63,6 +64,11 @@ function BillEnterModalContainer({
"enter_bill_generate_label",
false
);
+ const { Enhanced_Payroll } = useTreatments(
+ ["Enhanced_Payroll"],
+ {},
+ bodyshop.imexshopid
+ );
const formValues = useMemo(() => {
return {
...billEnterModal.context.bill,
@@ -98,6 +104,7 @@ function BillEnterModalContainer({
} = values;
let adjustmentsToInsert = {};
+ let payrollAdjustmentsToInsert = [];
const r1 = await insertBill({
variables: {
@@ -116,11 +123,28 @@ function BillEnterModalContainer({
...restI
} = i;
- if (deductedfromlbr) {
- adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] =
- (adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] || 0) -
- restI.actual_price / lbr_adjustment.rate;
+ if (Enhanced_Payroll.treatment === "on") {
+ if (
+ deductedfromlbr &&
+ true //payroll is on
+ ) {
+ payrollAdjustmentsToInsert.push({
+ id: i.joblineid,
+ convertedtolbr: true,
+ convertedtolbr_data: {
+ mod_lb_hrs: lbr_adjustment.mod_lb_hrs * -1,
+ mod_lbr_ty: lbr_adjustment.mod_lbr_ty,
+ },
+ });
+ }
+ } else {
+ if (deductedfromlbr) {
+ adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] =
+ (adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] || 0) -
+ restI.actual_price / lbr_adjustment.rate;
+ }
}
+
return {
...restI,
deductedfromlbr: deductedfromlbr,
@@ -146,6 +170,20 @@ function BillEnterModalContainer({
refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"],
});
+ await Promise.all(
+ payrollAdjustmentsToInsert.map((li) => {
+ return updateJobLines({
+ variables: {
+ lineId: li.id,
+ line: {
+ convertedtolbr: li.convertedtolbr,
+ convertedtolbr_data: li.convertedtolbr_data,
+ },
+ },
+ });
+ })
+ );
+
const adjKeys = Object.keys(adjustmentsToInsert);
if (adjKeys.length > 0) {
//Query the adjustments, merge, and update them.
diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx
index d3fc1f8e1..17a69ffad 100644
--- a/client/src/components/bill-form/bill-form.lines.component.jsx
+++ b/client/src/components/bill-form/bill-form.lines.component.jsx
@@ -40,12 +40,19 @@ export function BillEnterModalLinesComponent({
billid,
}) {
const { t } = useTranslation();
- const { setFieldsValue, getFieldsValue, getFieldValue } = form;
+ const { setFieldsValue, getFieldsValue, getFieldValue, setFieldValue } = form;
const { Simple_Inventory } = useTreatments(
["Simple_Inventory"],
{},
bodyshop && bodyshop.imexshopid
);
+
+ const { Enhanced_Payroll } = useTreatments(
+ ["Enhanced_Payroll"],
+ {},
+ bodyshop.imexshopid
+ );
+
const columns = (remove) => {
return [
{
@@ -376,12 +383,31 @@ export function BillEnterModalLinesComponent({
"rate",
]);
+ const billline = getFieldValue(["billlines", record.name]);
+
+ const jobline = lineData.find(
+ (line) => line.id === billline?.joblineid
+ );
+
+ const employeeTeamName = bodyshop.employee_teams.find(
+ (team) => team.id === jobline?.assigned_team
+ );
+
if (getFieldValue(["billlines", record.name, "deductedfromlbr"]))
return (
+
+ {t("joblines.fields.assigned_team", {
+ name: employeeTeamName?.name,
+ })}
+ {`${jobline.mod_lb_hrs} units/${t(
+ `joblines.fields.lbr_types.${jobline.mod_lbr_ty}`
+ )}`}
+
-
-
-
- {price &&
- adjustmentRate &&
- `${(price / adjustmentRate).toFixed(1)} hrs`}
+ {Enhanced_Payroll.treatment === "on" ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
+
+ {price &&
+ adjustmentRate &&
+ `${(price / adjustmentRate).toFixed(1)} hrs`}
+
);
return <>>;
diff --git a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx
index 552c2ad47..aace2a52a 100644
--- a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx
+++ b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx
@@ -63,6 +63,12 @@ const BillLineSearchSelect = (
item.oem_partno ? ` - ${item.oem_partno}` : ""
}${item.alt_partno ? ` (${item.alt_partno})` : ""}`.trim()}
+ {item.act_price === 0 && item.mod_lb_hrs > 0 && (
+
+ {`${item.mod_lb_hrs} units`}
+
+ )}
+
{item.act_price
? `$${item.act_price && item.act_price.toFixed(2)}`
diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx
index 504d0dce6..6bb247992 100644
--- a/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx
+++ b/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx
@@ -239,7 +239,7 @@ export function PayrollLaborAllocationsTable({
});
if (response.status === 200) {
- if (response.data.success) {
+ if (response.data.success !== false) {
notification.open({
type: "success",
message: t("timetickets.successes.payall"),
diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js
index 47c382054..4ee5e5515 100644
--- a/client/src/graphql/jobs-lines.queries.js
+++ b/client/src/graphql/jobs-lines.queries.js
@@ -274,6 +274,7 @@ export const GET_JOB_LINES_TO_ENTER_BILL = gql`
lbr_amt
op_code_desc
alt_partno
+ assigned_team
}
jobs_by_pk(id: $id) {
id
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index ecd1e183e..612a81bb6 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -145,6 +145,7 @@
"deductedfromlbr": "Deduct from Labor?",
"entered": "Entered",
"from": "From",
+ "mod_lbr_adjustment": "Adjustment Units",
"other": "-- Not On Estimate --",
"reconciled": "Reconciled!",
"unreconciled": "Unreconciled"
@@ -155,6 +156,7 @@
},
"bills": {
"actions": {
+ "deductallhours": "Deduct all",
"edit": "Edit",
"receive": "Receive Part",
"return": "Return Items"
@@ -1242,7 +1244,7 @@
"fields": {
"act_price": "Retail Price",
"ah_detail_line": "Mark as Detail Labor Line (Autohouse Only)",
- "assigned_team": "Team",
+ "assigned_team": "Team {{name}}",
"db_price": "List Price",
"lbr_types": {
"LA1": "LA1",
@@ -1753,7 +1755,7 @@
"closejob": "Close Job {{ro_number}}",
"closingperiod": "This Invoice Date is outside of the Closing Period.",
"contracts": "CC Contracts",
- "convertedtolabor": "Lines Converted to Labor",
+ "convertedtolabor": "Labor Line Adjustments",
"cost": "Cost",
"cost_Additional": "Cost - Additional",
"cost_labor": "Cost - Labor",
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 6ca073170..d80a7d141 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -145,6 +145,7 @@
"deductedfromlbr": "",
"entered": "",
"from": "",
+ "mod_lbr_adjustment": "",
"other": "",
"reconciled": "",
"unreconciled": ""
@@ -155,6 +156,7 @@
},
"bills": {
"actions": {
+ "deductallhours": "",
"edit": "",
"receive": "",
"return": ""
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index a65bef325..4eaf2cb8b 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -145,6 +145,7 @@
"deductedfromlbr": "",
"entered": "",
"from": "",
+ "mod_lbr_adjustment": "",
"other": "",
"reconciled": "",
"unreconciled": ""
@@ -155,6 +156,7 @@
},
"bills": {
"actions": {
+ "deductallhours": "",
"edit": "",
"receive": "",
"return": ""