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 > - + - - ); + ) : null; } diff --git a/client/src/components/shop-info/shop-info.intake.component.jsx b/client/src/components/shop-info/shop-info.intake.component.jsx index 72597a15e..2c19d1ffd 100644 --- a/client/src/components/shop-info/shop-info.intake.component.jsx +++ b/client/src/components/shop-info/shop-info.intake.component.jsx @@ -319,6 +319,18 @@ export default function ShopInfoIntakeChecklistComponent({ form }) { ))} + + + ); 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..4c534a1f1 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", @@ -1139,6 +1140,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..d9d1accce 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": "", @@ -1139,6 +1140,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..b44021dd2 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": "", @@ -1139,6 +1140,8 @@ "download": "", "edit": "modifier", "login": "", + "next": "", + "previous": "", "print": "", "refresh": "", "remove": "", 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"; diff --git a/server/job/job-totals-USA.js b/server/job/job-totals-USA.js index c8bcdf2a8..ed9441d9d 100644 --- a/server/job/job-totals-USA.js +++ b/server/job/job-totals-USA.js @@ -909,6 +909,25 @@ function CalculateTaxesTotals(job, otherTotals) { } }); + 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)));