From 8386443cb0189af0bc32356243a4cf6be8dc6e60 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 17 Jun 2024 10:13:36 -0700 Subject: [PATCH 1/6] IO-2820 State Tax & Adjustment to Bottom Line Signed-off-by: Allan Carr --- server/job/job-totals-USA.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/server/job/job-totals-USA.js b/server/job/job-totals-USA.js index c8bcdf2a8..9a11574c5 100644 --- a/server/job/job-totals-USA.js +++ b/server/job/job-totals-USA.js @@ -747,7 +747,9 @@ function CalculateTaxesTotals(job, otherTotals) { MAPA: Dinero(), MASH: Dinero(), TOW: Dinero(), - STOR: Dinero() + STOR: Dinero(), + + ADJ: Dinero() }; //For each line, determine if it's taxable, and if it is, add the line amount to the taxable amounts total. @@ -816,6 +818,8 @@ function CalculateTaxesTotals(job, otherTotals) { amount: Math.round(stlStorage.t_amt * 100) }); + if (job.adjustment_bottom_line) taxableAmounts.ADJ = Dinero({ amount: Math.round(job.adjustment_bottom_line * 100) }); + const pfp = job.parts_tax_rates; //For any profile level markups/discounts, add them in now as well. @@ -903,12 +907,26 @@ function CalculateTaxesTotals(job, otherTotals) { ); } } + } else if (key === "ADJ") { + for (let tyCounter = 1; tyCounter <= 5; tyCounter++) { + if (IsTrueOrYes(pfp.PAT ? pfp.PAT[`prt_tx_in${tyCounter}`] : pfp.PAN[`prt_tx_in${tyCounter}`])) { + //This amount is taxable for this type. + taxableAmountsByTier[`ty${tyCounter}Tax`] = taxableAmountsByTier[`ty${tyCounter}Tax`].add( + taxableAmounts[key] + ); + } + } } } catch (error) { console.error("Key with issue", key); } }); + Object.keys(taxableAmountsByTier).forEach((taxTierKey) => { + if (taxableAmountsByTier[taxTierKey].lessThan(Dinero({ amount: 0 }))) { + taxableAmountsByTier[taxTierKey] = Dinero({ amount: 0 }); + } + }); const remainingTaxableAmounts = taxableAmountsByTier; console.log("*** Taxable Amounts by Tier***"); console.table(JSON.parse(JSON.stringify(taxableAmountsByTier))); From d7bfc789e2194a2aaec13eab0adf7f48123e1b3a Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 18 Jun 2024 08:44:35 -0700 Subject: [PATCH 2/6] IO-2814 Job Costing Correction for OP14 Duplication Signed-off-by: Allan Carr --- server/job/job-costing.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 8b966140e..f8cbd2515 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -318,7 +318,9 @@ function GenerateCostingData(job) { if (!partsProfitCenter) console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type); const partsAmount = Dinero({ - amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100) + amount: val.act_price_before_ppc + ? Math.round(val.act_price_before_ppc * 100) + : Math.round(val.act_price * 100) }) .multiply(val.part_qty || 1) .add( @@ -327,7 +329,9 @@ function GenerateCostingData(job) { ? val.prt_dsmk_m ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) }) : Dinero({ - amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100) + amount: val.act_price_before_ppc + ? Math.round(val.act_price_before_ppc * 100) + : Math.round(val.act_price * 100) }) .multiply(val.part_qty || 0) .percentage(Math.abs(val.prt_dsmk_p || 0)) @@ -368,7 +372,10 @@ function GenerateCostingData(job) { } //Additional Profit Center - if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) { + if ( + (!val.part_type && !val.mod_lbr_ty) || + (!val.part_type && val.mod_lbr_ty && val.act_price > 0 && val.lbr_op !== "OP14") + ) { //Does it already have a defined profit center? //If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate. const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown"; From ca4b78d44cbff5eca44c9dddfc6f3032e0d4467b Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 18 Jun 2024 13:16:58 -0700 Subject: [PATCH 3/6] IO-2816 Unsaved Changes on Manual Job Creation Correct Hardcoded button labels Signed-off-by: Allan Carr --- .../jobs-create/jobs-create.component.jsx | 56 +++++++++---------- client/src/translations/en_us/common.json | 2 + client/src/translations/es/common.json | 2 + client/src/translations/fr/common.json | 2 + 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/client/src/pages/jobs-create/jobs-create.component.jsx b/client/src/pages/jobs-create/jobs-create.component.jsx index 744f3c9ab..d8f7c8dcc 100644 --- a/client/src/pages/jobs-create/jobs-create.component.jsx +++ b/client/src/pages/jobs-create/jobs-create.component.jsx @@ -1,5 +1,5 @@ -import { Button, Result, Space, Steps } from "antd"; import { PageHeader } from "@ant-design/pro-layout"; +import { Button, Result, Space, Steps } from "antd"; import React, { useContext, useState } from "react"; import { useTranslation } from "react-i18next"; @@ -9,7 +9,6 @@ import JobsCreateJobsInfo from "../../components/jobs-create-jobs-info/jobs-crea import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container"; import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container"; import JobCreateContext from "../../pages/jobs-create/jobs-create.context"; -import FormsFieldChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component"; export default function JobsCreateComponent({ form }) { const [pageIndex, setPageIndex] = useState(0); @@ -41,10 +40,11 @@ export default function JobsCreateComponent({ form }) { const next = () => { setPageIndex(pageIndex + 1); - console.log("NExt"); + console.log("Next"); }; const prev = () => { setPageIndex(pageIndex - 1); + console.log("Previous"); }; const { Step } = Steps; @@ -53,26 +53,26 @@ export default function JobsCreateComponent({ form }) { - {pageIndex > 0 && } + {pageIndex > 0 && } {pageIndex < steps.length - 1 && ( )} {pageIndex === steps.length - 1 && ( @@ -104,17 +104,17 @@ export default function JobsCreateComponent({ form }) { }} onClick={() => { setPageIndex(idx); - // form - // .validateFields() - // .then((r) => { - // if (steps[pageIndex].validation) { - // setErrorMessage(null); - // setPageIndex(idx); - // } else { - // setErrorMessage(steps[pageIndex].error); - // } - // }) - // .catch((error) => console.log("error", error)); + form + .validateFields() + .then((r) => { + if (steps[pageIndex].validation) { + setErrorMessage(null); + setPageIndex(idx); + } else { + setErrorMessage(steps[pageIndex].error); + } + }) + .catch((error) => console.log("error", error)); }} /> ))} @@ -144,7 +144,7 @@ export default function JobsCreateComponent({ form }) { ) : (
- + {errorMessage ? (
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 0011cede6..8fe9e30ba 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1139,6 +1139,8 @@ "download": "Download", "edit": "Edit", "login": "Login", + "next": "Next", + "previous": "Previous", "print": "Print", "refresh": "Refresh", "remove": "Remove", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 463e310e6..8a14ae894 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1139,6 +1139,8 @@ "download": "", "edit": "Editar", "login": "", + "next": "", + "previous": "", "print": "", "refresh": "", "remove": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 8ddbeef43..3615e31b2 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1139,6 +1139,8 @@ "download": "", "edit": "modifier", "login": "", + "next": "", + "previous": "", "print": "", "refresh": "", "remove": "", From 47adb6d40abe83aaf368f6f99df77a7c30bb8935 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 20 Jun 2024 11:26:05 -0700 Subject: [PATCH 4/6] IO-2795 Delivery Date required on Delivery Checklist Signed-off-by: Allan Carr --- .../job-checklist-form.component.jsx | 16 ++++++++++++++-- .../shop-info/shop-info.intake.component.jsx | 12 ++++++++++++ client/src/translations/en_us/common.json | 3 ++- client/src/translations/es/common.json | 3 ++- client/src/translations/fr/common.json | 3 ++- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx index 2f901d818..a276fcb07 100644 --- a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx +++ b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx @@ -1,6 +1,5 @@ import { useMutation } from "@apollo/client"; import { Button, Card, Form, Input, notification, Switch } from "antd"; -import dayjs from "../../../../utils/day"; import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -14,6 +13,7 @@ import { UPDATE_OWNER } from "../../../../graphql/owners.queries"; import { insertAuditTrail } from "../../../../redux/application/application.actions"; import { selectBodyshop, selectCurrentUser } from "../../../../redux/user/user.selectors"; import AuditTrailMapping from "../../../../utils/AuditTrailMappings"; +import dayjs from "../../../../utils/day"; import ConfigFormComponents from "../../../config-form-components/config-form-components.component"; import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component"; @@ -275,7 +275,19 @@ export function JobChecklistForm({ insertAuditTrail, formItems, bodyshop, curren > - + + + +
); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 0011cede6..415edc03b 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -295,7 +295,8 @@ "dailypainttarget": "Scoreboard - Daily Paint Target", "default_adjustment_rate": "Default Labor Deduction Adjustment Rate", "deliver": { - "templates": "Delivery Templates" + "templates": "Delivery Templates", + "require_actual_delivery_date": "Require Actual Delivery" }, "dms": { "apcontrol": "AP Control Number", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 463e310e6..656d1f09b 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -295,7 +295,8 @@ "dailypainttarget": "", "default_adjustment_rate": "", "deliver": { - "templates": "" + "templates": "", + "require_actual_delivery_date": "" }, "dms": { "apcontrol": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 8ddbeef43..94d26c332 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -295,7 +295,8 @@ "dailypainttarget": "", "default_adjustment_rate": "", "deliver": { - "templates": "" + "templates": "", + "require_actual_delivery_date": "" }, "dms": { "apcontrol": "", From bfd29f25dd55a53a0731d6a55a4611c5000c6bba Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 21 Jun 2024 11:12:10 -0700 Subject: [PATCH 5/6] IO-2828 Add InstanceManager and correct delete button for delivery checklist Signed-off-by: Allan Carr --- .../jobs-admin-delete-intake.component.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx b/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx index 319a85bb5..70e1b9ad3 100644 --- a/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx +++ b/client/src/components/jobs-admin-delete-intake/jobs-admin-delete-intake.component.jsx @@ -3,6 +3,7 @@ import { Button, Space, notification } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries"; +import InstanceRenderManager from "../../utils/instanceRenderMgr"; export default function JobAdminDeleteIntake({ job }) { const { t } = useTranslation(); @@ -47,16 +48,22 @@ export default function JobAdminDeleteIntake({ job }) { setLoading(false); }; - return ( + const InstanceRender = InstanceRenderManager({ + imex: true, + rome: "USE_IMEX", + promanager: false + }); + + return InstanceRender ? ( <> - - ); + ) : null; } From 5752f123ac6ed0bbf1f97af3834516f72ae56eb1 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 21 Jun 2024 15:32:55 -0700 Subject: [PATCH 6/6] IO-2820 Adjustment to Bottom Line Signed-off-by: Allan Carr --- server/job/job-totals-USA.js | 39 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/server/job/job-totals-USA.js b/server/job/job-totals-USA.js index 9a11574c5..ed9441d9d 100644 --- a/server/job/job-totals-USA.js +++ b/server/job/job-totals-USA.js @@ -747,9 +747,7 @@ function CalculateTaxesTotals(job, otherTotals) { MAPA: Dinero(), MASH: Dinero(), TOW: Dinero(), - STOR: Dinero(), - - ADJ: Dinero() + STOR: Dinero() }; //For each line, determine if it's taxable, and if it is, add the line amount to the taxable amounts total. @@ -818,8 +816,6 @@ function CalculateTaxesTotals(job, otherTotals) { amount: Math.round(stlStorage.t_amt * 100) }); - if (job.adjustment_bottom_line) taxableAmounts.ADJ = Dinero({ amount: Math.round(job.adjustment_bottom_line * 100) }); - const pfp = job.parts_tax_rates; //For any profile level markups/discounts, add them in now as well. @@ -907,26 +903,31 @@ function CalculateTaxesTotals(job, otherTotals) { ); } } - } else if (key === "ADJ") { - for (let tyCounter = 1; tyCounter <= 5; tyCounter++) { - if (IsTrueOrYes(pfp.PAT ? pfp.PAT[`prt_tx_in${tyCounter}`] : pfp.PAN[`prt_tx_in${tyCounter}`])) { - //This amount is taxable for this type. - taxableAmountsByTier[`ty${tyCounter}Tax`] = taxableAmountsByTier[`ty${tyCounter}Tax`].add( - taxableAmounts[key] - ); - } - } } } catch (error) { console.error("Key with issue", key); } }); - Object.keys(taxableAmountsByTier).forEach((taxTierKey) => { - if (taxableAmountsByTier[taxTierKey].lessThan(Dinero({ amount: 0 }))) { - taxableAmountsByTier[taxTierKey] = Dinero({ amount: 0 }); - } - }); + if (job.adjustment_bottom_line) { + const subtotal_before_adjustment = subtotal.add(Dinero({ amount: Math.round(job.adjustment_bottom_line * -100) })); + const percent_of_adjustment = + Math.round( + subtotal_before_adjustment.toUnit() / + (job.adjustment_bottom_line > 0 ? job.adjustment_bottom_line : job.adjustment_bottom_line * -1) + ) / 100; + + Object.keys(taxableAmountsByTier).forEach((taxTierKey) => { + taxable_adjustment = taxableAmountsByTier[taxTierKey].multiply(percent_of_adjustment); + console.log("🚀 ~ taxableAmountsByTier ~ taxable_adjustment:", taxable_adjustment) + if (job.adjustment_bottom_line > 0) { + taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].add(taxable_adjustment); + } else { + taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].subtract(taxable_adjustment); + } + }); + } + const remainingTaxableAmounts = taxableAmountsByTier; console.log("*** Taxable Amounts by Tier***"); console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));