From a77e664ab165207395565fd8c924b853b916b202 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 1 Dec 2021 14:33:27 -0800 Subject: [PATCH 1/2] Add OEC Reference Files. --- _reference/OEC/Audatex.xsl | 586 ++++++++++++++++++++++++++++ _reference/OEC/AudatexMapping.xml | 131 +++++++ _reference/OEC/CCC.xsl | 607 +++++++++++++++++++++++++++++ _reference/OEC/CCCMapping.xml | 129 ++++++ _reference/OEC/Mitchell.xsl | 580 +++++++++++++++++++++++++++ _reference/OEC/MitchellMapping.xml | 132 +++++++ 6 files changed, 2165 insertions(+) create mode 100644 _reference/OEC/Audatex.xsl create mode 100644 _reference/OEC/AudatexMapping.xml create mode 100644 _reference/OEC/CCC.xsl create mode 100644 _reference/OEC/CCCMapping.xml create mode 100644 _reference/OEC/Mitchell.xsl create mode 100644 _reference/OEC/MitchellMapping.xml diff --git a/_reference/OEC/Audatex.xsl b/_reference/OEC/Audatex.xsl new file mode 100644 index 000000000..5a5d61e78 --- /dev/null +++ b/_reference/OEC/Audatex.xsl @@ -0,0 +1,586 @@ + + + + + + + + + + + + + + + OECTrans.ImportTrans + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CHEV + CHEV + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + Audatex.xml + Audatex.xsl + + + + + + + + + + + + + + + + + -- + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + : + + + + + + + + : + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Salvage or Assembly + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 0 + + + + + 1 + 2 + 3 + 4 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + False + + + + False + False + False + False + False + False + False + False + False + False + False + False + False + False + True + + + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/_reference/OEC/AudatexMapping.xml b/_reference/OEC/AudatexMapping.xml new file mode 100644 index 000000000..0068c7229 --- /dev/null +++ b/_reference/OEC/AudatexMapping.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Audatex.xsl + + diff --git a/_reference/OEC/CCC.xsl b/_reference/OEC/CCC.xsl new file mode 100644 index 000000000..96e58c428 --- /dev/null +++ b/_reference/OEC/CCC.xsl @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + OECTrans.ImportTrans + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + CCC.xml + CCC.xsl + + + + + + + + + + + + + + + + + -- + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + : + + + + + + + + : + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + + + + + + Salvage or Assembly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 4 + 0 + + + + + 1 + 2 + 3 + 4 + 4 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + + + + + False + + + + + + False + + + False + + False + False + False + False + False + False + False + False + False + False + + + False + False + False + False + True + + + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/_reference/OEC/CCCMapping.xml b/_reference/OEC/CCCMapping.xml new file mode 100644 index 000000000..ab4d3b4a1 --- /dev/null +++ b/_reference/OEC/CCCMapping.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ccc.xsl + + diff --git a/_reference/OEC/Mitchell.xsl b/_reference/OEC/Mitchell.xsl new file mode 100644 index 000000000..48fbd5d65 --- /dev/null +++ b/_reference/OEC/Mitchell.xsl @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + OECTrans.ImportTrans + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + Mitchell.xml + Mitchell.xsl + + + + + + + + + + + + + + + + + -- + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + x + + + + + + + + + + + + + + + + : + + + + + + + + : + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Salvage or Assembly + + + + + + + + + + + + + + PAN + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 4 + 4 + 0 + + + + + 1 + 2 + 3 + 4 + 4 + 4 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + False + + + False + False + False + False + False + False + False + False + False + False + False + False + False + False + False + True + + + + + False + + + False + + + + + + + \ No newline at end of file diff --git a/_reference/OEC/MitchellMapping.xml b/_reference/OEC/MitchellMapping.xml new file mode 100644 index 000000000..91ba33d17 --- /dev/null +++ b/_reference/OEC/MitchellMapping.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mitchell.xsl + + From 39ec9d92ec19f392681db1805519e3f0c55affd7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 2 Dec 2021 10:50:11 -0800 Subject: [PATCH 2/2] IO-233 CDK updates. --- bodyshop_translations.babel | 141 +++++++ .../bill-form/bill-form.lines.component.jsx | 24 +- .../dms-allocations-summary.component.jsx | 1 + .../dms-post-form/dms-post-form.component.jsx | 78 ++-- .../jobs-close-auto-allocate.component.jsx | 5 +- .../labor-allocations-table.component.jsx | 7 +- .../labor-allocations-table.utility.js | 12 +- .../parts-order-list-table.component.jsx | 12 +- .../shop-employees-form.component.jsx | 17 +- ...p-info.responsibilitycenters.component.jsx | 346 ++++++++++++------ .../time-ticket-modal.component.jsx | 7 +- .../time-ticket-modal.container.jsx | 17 +- client/src/graphql/jobs.queries.js | 1 + .../pages/jobs-close/jobs-close.component.jsx | 24 +- client/src/translations/en_us/common.json | 12 + client/src/translations/es/common.json | 12 + client/src/translations/fr/common.json | 12 + client/src/utils/Ciecaselect.jsx | 103 ++++++ hasura/metadata/tables.yaml | 3 + .../down.sql | 4 + .../up.sql | 2 + server/cdk/cdk-calculate-allocations.js | 46 ++- server/graphql-client/queries.js | 3 + 23 files changed, 688 insertions(+), 201 deletions(-) create mode 100644 client/src/utils/Ciecaselect.jsx create mode 100644 hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql create mode 100644 hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 3dd56671f..6556d2dc7 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -6491,6 +6491,27 @@ + + pag + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + pal false @@ -12146,6 +12167,37 @@ + + dms + + + labels + + + refreshallocations + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + documents @@ -17809,6 +17861,32 @@ + + labels + + + refreshallocations + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + post false @@ -18315,6 +18393,27 @@ + + sendtodms + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + sync false @@ -20419,6 +20518,27 @@ + + dms_allocation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + driveable false @@ -22151,6 +22271,27 @@ + + po_number + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + policy_no false 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 22aa62f23..29bd6cbc7 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import CiecaSelect, { GetPartTypeName } from "../../utils/Ciecaselect"; import BillLineSearchSelect from "../bill-line-search-select/bill-line-search-select.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component"; @@ -72,11 +73,13 @@ export function BillEnterModalLinesComponent({ quantity: opt.part_qty || 1, actual_price: opt.cost, cost_center: opt.part_type - ? responsibilityCenters.defaults && - (responsibilityCenters.defaults.costs[ - opt.part_type - ] || - null) + ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid + ? GetPartTypeName(opt.part_type) + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[ + opt.part_type + ] || + null) : null, }; } @@ -224,6 +227,7 @@ export function BillEnterModalLinesComponent({ key: `${field.index}cost_center`, name: [field.name, "cost_center"], label: t("billlines.fields.cost_center"), + valuePropName: "value", rules: [ { required: true, @@ -233,10 +237,12 @@ export function BillEnterModalLinesComponent({ }; }, formInput: (record, index) => ( - + {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? CiecaSelect(true, false) + : responsibilityCenters.costs.map((item) => ( + {item.name} + ))} ), }, diff --git a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx index acfd796df..65357295b 100644 --- a/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx +++ b/client/src/components/dms-allocations-summary/dms-allocations-summary.component.jsx @@ -95,6 +95,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) { columns={columns} rowKey="center" dataSource={allocationsSummary} + locale={{ emptyText: t("dms.labels.refreshallocations") }} summary={() => { const totals = allocationsSummary.reduce( (acc, val) => { diff --git a/client/src/components/dms-post-form/dms-post-form.component.jsx b/client/src/components/dms-post-form/dms-post-form.component.jsx index 6bea7a433..ff7057606 100644 --- a/client/src/components/dms-post-form/dms-post-form.component.jsx +++ b/client/src/components/dms-post-form/dms-post-form.component.jsx @@ -221,7 +221,47 @@ export function DmsPostForm({ bodyshop, socket, job }) { + {t("jobs.fields.dms.payer.controlnumber")}{" "} + + {bodyshop.cdk_configuration.controllist && + bodyshop.cdk_configuration.controllist.map( + (key, idx) => ( + { + form.setFieldsValue({ + payers: form + .getFieldValue("payers") + .map((row, mapIndex) => { + if (index !== mapIndex) + return row; + + return { + ...row, + controlnumber: + key.controlnumber, + }; + }), + }); + }} + > + {key.name} + + ) + )} + + } + > + e.preventDefault()}> + + + + + } key={`${index}controlnumber`} name={[field.name, "controlnumber"]} rules={[ @@ -254,42 +294,6 @@ export function DmsPostForm({ bodyshop, socket, job }) { }} - - {bodyshop.cdk_configuration.controllist && - bodyshop.cdk_configuration.controllist.map( - (key, idx) => ( - { - form.setFieldsValue({ - payers: form - .getFieldValue("payers") - .map((row, mapIndex) => { - if (index !== mapIndex) return row; - - return { - ...row, - controlnumber: key.controlnumber, - }; - }), - }); - }} - > - {key.name} - - ) - )} - - } - > - e.preventDefault()}> - {t("bodyshop.labels.dms.cdk.controllist")}{" "} - - - - { remove(field.name); diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx index 6d766f9e6..b9d787433 100644 --- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx +++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx @@ -54,6 +54,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) { const handleMenuClick = ({ item, key, keyPath, domEvent }) => { logImEXEvent("jobs_close_allocate_auto_dms"); + form.setFieldsValue({ dms_allocation: key }); handleAllocate( bodyshop.md_responsibility_centers.dms_defaults.find( (x) => x.name === key @@ -64,7 +65,9 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) { const overlay = (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( {bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => ( - {mapping.name} + + {mapping.name} + ))} ); diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx index 5bb74b8c8..cecc22795 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx +++ b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx @@ -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]); 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 29f8001f7..78d5aa2c6 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,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; diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index 4264f4272..cb9625452 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -23,6 +23,7 @@ import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import { GetPartTypeName } from "../../utils/Ciecaselect"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { DateFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; @@ -165,10 +166,15 @@ export function PartsOrderListTableComponent({ quantity: pol.quantity, actual_price: pol.act_price, + cost_center: pol.jobline?.part_type - ? responsibilityCenters.defaults.costs[ - pol.jobline.part_type - ] || null + ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid + ? GetPartTypeName(pol.jobline.part_type) + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[ + pol.jobline.part_type + ] || + null) : null, }; }), diff --git a/client/src/components/shop-employees/shop-employees-form.component.jsx b/client/src/components/shop-employees/shop-employees-form.component.jsx index 02289e356..acfadbcde 100644 --- a/client/src/components/shop-employees/shop-employees-form.component.jsx +++ b/client/src/components/shop-employees/shop-employees-form.component.jsx @@ -14,6 +14,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import FormDatePicker from "../form-date-picker/form-date-picker.component"; import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +import CiecaSelect from "../../utils/Ciecaselect"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -218,6 +219,7 @@ export function ShopEmployeesFormComponent({ label={t("employees.fields.cost_center")} key={`${index}`} name={[field.name, "cost_center"]} + valuePropName="value" rules={[ { required: true, @@ -232,11 +234,16 @@ export function ShopEmployeesFormComponent({ > {t("timetickets.labels.shift")} - {bodyshop.md_responsibility_centers.costs.map((c) => ( - - {c.name} - - ))} + + {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? CiecaSelect(false, true) + : bodyshop.md_responsibility_centers.costs.map( + (c) => ( + + {c.name} + + ) + )} - {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber)&& ( + {(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( <> {form.getFieldValue("cdk_dealerid")} @@ -164,7 +164,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { }, ]} > - {t("jobs.fields.ro_number")} @@ -582,7 +582,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-ats`} name={[field.name, "costs", "ATS"]} > - {costOptions.map((item, idx) => ( {item} @@ -613,7 +613,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAA`} name={[field.name, "costs", "LAA"]} > - {costOptions.map((item, idx) => ( {item} @@ -644,7 +644,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAB`} name={[field.name, "costs", "LAB"]} > - {costOptions.map((item, idx) => ( {item} @@ -675,7 +675,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAD`} name={[field.name, "costs", "LAD"]} > - {costOptions.map((item, idx) => ( {item} @@ -706,7 +706,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAE`} name={[field.name, "costs", "LAE"]} > - {costOptions.map((item, idx) => ( {item} @@ -737,7 +737,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAF`} name={[field.name, "costs", "LAF"]} > - {costOptions.map((item, idx) => ( {item} @@ -768,7 +768,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAG`} name={[field.name, "costs", "LAG"]} > - {costOptions.map((item, idx) => ( {item} @@ -799,7 +799,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAM`} name={[field.name, "costs", "LAM"]} > - {costOptions.map((item, idx) => ( {item} @@ -830,7 +830,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAR`} name={[field.name, "costs", "LAR"]} > - {costOptions.map((item, idx) => ( {item} @@ -861,7 +861,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAS`} name={[field.name, "costs", "LAS"]} > - {costOptions.map((item, idx) => ( {item} @@ -892,7 +892,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LAU`} name={[field.name, "costs", "LAU"]} > - {costOptions.map((item, idx) => ( {item} @@ -923,7 +923,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA1`} name={[field.name, "costs", "LA1"]} > - {costOptions.map((item, idx) => ( {item} @@ -954,7 +954,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA2`} name={[field.name, "costs", "LA2"]} > - {costOptions.map((item, idx) => ( {item} @@ -985,7 +985,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA3`} name={[field.name, "costs", "LA3"]} > - {costOptions.map((item, idx) => ( {item} @@ -1016,7 +1016,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-LA4`} name={[field.name, "costs", "LA4"]} > - {costOptions.map((item, idx) => ( {item} @@ -1047,7 +1047,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-PAA`} name={[field.name, "costs", "PAA"]} > - {costOptions.map((item, idx) => ( {item} @@ -1078,7 +1078,38 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { key={`${index}costs-PAC`} name={[field.name, "costs", "PAC"]} > - + {costOptions.map((item, idx) => ( + + {item} + + ))} + + + ({ + validator(rule, value) { + if (costOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + key={`${index}costs-PAG`} + name={[field.name, "costs", "PAG"]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (profitOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + key={`${index}profits-PAG`} + name={[field.name, "profits", "PAG"]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (costOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + name={["md_responsibility_centers", "defaults", "costs", "PAG"]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(rule, value) { + if (profitOptions.includes(value)) { + return Promise.resolve(); + } + return Promise.reject( + t("bodyshop.validation.centermustexist") + ); + }, + }), + ]} + name={["md_responsibility_centers", "defaults", "profits", "PAG"]} + > + + + + + + + + + + + + + + )} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 30b9fc6ac..51497bf15 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -413,6 +413,7 @@ "mash": "Shop Materials", "paa": "Aftermarket", "pac": "Chrome", + "pag": "Glass", "pal": "LKQ", "pam": "Remanufactured", "pan": "OEM", @@ -759,6 +760,11 @@ "projectedmonthlysales": "Projected Monthly Sales" } }, + "dms": { + "labels": { + "refreshallocations": "Refresh to see DMS Allocataions." + } + }, "documents": { "actions": { "delete": "Delete Selected Documents", @@ -1107,6 +1113,9 @@ "createnewcustomer": "Create New Customer", "findmakemodelcode": "Find Make/Model Code", "getmakes": "", + "labels": { + "refreshallocations": "Refresh this component to see the DMS allocations." + }, "post": "Post", "refetchmakesmodels": "Refetch Make and Model Codes", "usegeneric": "Use Generic Customer", @@ -1132,6 +1141,7 @@ "removefromproduction": "Remove from Production", "schedule": "Schedule", "sendcsi": "Send CSI", + "sendtodms": "Send to DMS", "sync": "Sync", "uninvoice": "Uninvoice", "unvoid": "Unvoid Job", @@ -1241,6 +1251,7 @@ "story": "Story", "vinowner": "VIN Owner" }, + "dms_allocation": "DMS Allocation", "driveable": "Driveable", "employee_body": "Body", "employee_csr": "Customer Service Rep.", @@ -1327,6 +1338,7 @@ "pas": "Sublet", "pay_date": "Pay Date", "phoneshort": "PH", + "po_number": "PO Number", "policy_no": "Policy #", "ponumber": "PO Number", "production_vars": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index e79d937b3..bd1524e12 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -413,6 +413,7 @@ "mash": "", "paa": "", "pac": "", + "pag": "", "pal": "", "pam": "", "pan": "", @@ -759,6 +760,11 @@ "projectedmonthlysales": "" } }, + "dms": { + "labels": { + "refreshallocations": "" + } + }, "documents": { "actions": { "delete": "", @@ -1107,6 +1113,9 @@ "createnewcustomer": "", "findmakemodelcode": "", "getmakes": "", + "labels": { + "refreshallocations": "" + }, "post": "", "refetchmakesmodels": "", "usegeneric": "", @@ -1132,6 +1141,7 @@ "removefromproduction": "", "schedule": "Programar", "sendcsi": "", + "sendtodms": "", "sync": "", "uninvoice": "", "unvoid": "", @@ -1241,6 +1251,7 @@ "story": "", "vinowner": "" }, + "dms_allocation": "", "driveable": "", "employee_body": "", "employee_csr": "Representante de servicio al cliente.", @@ -1327,6 +1338,7 @@ "pas": "", "pay_date": "Fecha de Pay", "phoneshort": "PH", + "po_number": "", "policy_no": "Política #", "ponumber": "numero postal", "production_vars": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 9caebf657..86d79c2d0 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -413,6 +413,7 @@ "mash": "", "paa": "", "pac": "", + "pag": "", "pal": "", "pam": "", "pan": "", @@ -759,6 +760,11 @@ "projectedmonthlysales": "" } }, + "dms": { + "labels": { + "refreshallocations": "" + } + }, "documents": { "actions": { "delete": "", @@ -1107,6 +1113,9 @@ "createnewcustomer": "", "findmakemodelcode": "", "getmakes": "", + "labels": { + "refreshallocations": "" + }, "post": "", "refetchmakesmodels": "", "usegeneric": "", @@ -1132,6 +1141,7 @@ "removefromproduction": "", "schedule": "Programme", "sendcsi": "", + "sendtodms": "", "sync": "", "uninvoice": "", "unvoid": "", @@ -1241,6 +1251,7 @@ "story": "", "vinowner": "" }, + "dms_allocation": "", "driveable": "", "employee_body": "", "employee_csr": "représentant du service à la clientèle", @@ -1327,6 +1338,7 @@ "pas": "", "pay_date": "Date d'Pay", "phoneshort": "PH", + "po_number": "", "policy_no": "Politique #", "ponumber": "Numéro de bon de commande", "production_vars": { diff --git a/client/src/utils/Ciecaselect.jsx b/client/src/utils/Ciecaselect.jsx new file mode 100644 index 000000000..3b22deb5a --- /dev/null +++ b/client/src/utils/Ciecaselect.jsx @@ -0,0 +1,103 @@ +import React from "react"; +import { Select } from "antd"; +import i18n from "../translations/i18n"; + +export default function CiecaSelect(parts = true, labor = true) { + return ( + <> + {labor && ( + <> + + {i18n.t("joblines.fields.lbr_types.LAA")} + + + {i18n.t("joblines.fields.lbr_types.LAB")} + + + {i18n.t("joblines.fields.lbr_types.LAD")} + + + {i18n.t("joblines.fields.lbr_types.LAE")} + + + {i18n.t("joblines.fields.lbr_types.LAF")} + + + {i18n.t("joblines.fields.lbr_types.LAG")} + + + {i18n.t("joblines.fields.lbr_types.LAM")} + + + {i18n.t("joblines.fields.lbr_types.LAR")} + + + {i18n.t("joblines.fields.lbr_types.LAS")} + + + {i18n.t("joblines.fields.lbr_types.LAU")} + + + {i18n.t("joblines.fields.lbr_types.LA1")} + + + {i18n.t("joblines.fields.lbr_types.LA2")} + + + {i18n.t("joblines.fields.lbr_types.LA3")} + + + {i18n.t("joblines.fields.lbr_types.LA4")} + + + )} + {parts && ( + <> + + {i18n.t("joblines.fields.part_types.PAA")} + + + {i18n.t("joblines.fields.part_types.PAC")} + + + + {i18n.t("joblines.fields.part_types.PAL")} + + + {i18n.t("joblines.fields.part_types.PAG")} + + + {i18n.t("joblines.fields.part_types.PAM")} + + + {i18n.t("joblines.fields.part_types.PAP")} + + + {i18n.t("joblines.fields.part_types.PAN")} + + + {i18n.t("joblines.fields.part_types.PAO")} + + + {i18n.t("joblines.fields.part_types.PAR")} + + + {i18n.t("joblines.fields.part_types.PAS")} + + + )} + + ); +} + +export function GetPartTypeName(part_type) { + console.log(part_type); + if (!part_type) return null; + return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`); +} + +export function Get(part_type) { + console.log(part_type); + if (!part_type) return null; + return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`); +} diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 237c695b7..9bdea1b51 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2616,6 +2616,7 @@ - ded_status - deliverchecklist - depreciation_taxes + - dms_allocation - driveable - employee_body - employee_csr @@ -2868,6 +2869,7 @@ - ded_status - deliverchecklist - depreciation_taxes + - dms_allocation - driveable - employee_body - employee_csr @@ -3130,6 +3132,7 @@ - ded_status - deliverchecklist - depreciation_taxes + - dms_allocation - driveable - employee_body - employee_csr diff --git a/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql new file mode 100644 index 000000000..c434a9935 --- /dev/null +++ b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."jobs" add column "dms_allocation" text +-- null; diff --git a/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql new file mode 100644 index 000000000..34284d636 --- /dev/null +++ b/hasura/migrations/1638467360308_alter_table_public_jobs_add_column_dms_allocation/up.sql @@ -0,0 +1,2 @@ +alter table "public"."jobs" add column "dms_allocation" text + null; diff --git a/server/cdk/cdk-calculate-allocations.js b/server/cdk/cdk-calculate-allocations.js index dc386e618..f7db405b8 100644 --- a/server/cdk/cdk-calculate-allocations.js +++ b/server/cdk/cdk-calculate-allocations.js @@ -106,10 +106,23 @@ exports.default = async function (socket, jobid) { return acc; }, {}); + const selectedDmsAllocationConfig = + bodyshop.md_responsibility_centers.dms_defaults.find( + (d) => d.name === job.dms_allocation + ); + CdkBase.createLogEvent( + socket, + "DEBUG", + `Using DMS Allocation ${ + selectedDmsAllocationConfig && selectedDmsAllocationConfig.name + } for cost export.` + ); + const costCenterHash = job.bills.reduce((bill_acc, bill_val) => { bill_val.billlines.map((line_val) => { - if (!bill_acc[line_val.cost_center]) - bill_acc[line_val.cost_center] = Dinero(); + if (!bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]]) + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = + Dinero(); let lineDinero = Dinero({ amount: Math.round((line_val.actual_cost || 0) * 100), @@ -117,8 +130,10 @@ exports.default = async function (socket, jobid) { .multiply(line_val.quantity) .multiply(bill_val.is_credit_memo ? -1 : 1); - bill_acc[line_val.cost_center] = - bill_acc[line_val.cost_center].add(lineDinero); + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] = + bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]].add( + lineDinero + ); return null; }); return bill_acc; @@ -136,17 +151,19 @@ exports.default = async function (socket, jobid) { ), }); //Add it to the right cost center. - if (!costCenterHash[ticket.cost_center]) - costCenterHash[ticket.cost_center] = Dinero(); + if (!costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]]) + costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]] = + Dinero(); - costCenterHash[ticket.cost_center] = - costCenterHash[ticket.cost_center].add(TicketTotal); + costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]] = + costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]].add( + TicketTotal + ); }); if (!hasMapaLine && job.job_totals.rates.mapa.total.amount > 0) { // console.log("Adding MAPA Line Manually."); - const mapaAccountName = - bodyshop.md_responsibility_centers.defaults.profits.MAPA; + const mapaAccountName = selectedDmsAllocationConfig.profits.MAPA; const mapaAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === mapaAccountName @@ -167,8 +184,7 @@ exports.default = async function (socket, jobid) { if (!hasMashLine && job.job_totals.rates.mash.total.amount > 0) { // console.log("Adding MASH Line Manually."); - const mashAccountName = - bodyshop.md_responsibility_centers.defaults.profits.MASH; + const mashAccountName = selectedDmsAllocationConfig.profits.MASH; const mashAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === mashAccountName @@ -198,7 +214,7 @@ exports.default = async function (socket, jobid) { if (job.towing_payable && job.towing_payable !== 0) { const towAccountName = - bodyshop.md_responsibility_centers.defaults.profits.TOW; + selectedDmsAllocationConfig.profits.TOW; const towAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === towAccountName @@ -219,7 +235,7 @@ exports.default = async function (socket, jobid) { } if (job.storage_payable && job.storage_payable !== 0) { const storageAccountName = - bodyshop.md_responsibility_centers.defaults.profits.TOW; + selectedDmsAllocationConfig.profits.TOW; const towAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === storageAccountName @@ -243,7 +259,7 @@ exports.default = async function (socket, jobid) { if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) { const otherAccountName = - bodyshop.md_responsibility_centers.defaults.profits.PAO; + selectedDmsAllocationConfig.profits.PAO; const otherAccount = bodyshop.md_responsibility_centers.profits.find( (c) => c.name === otherAccountName diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index 580ca169c..fd30f7242 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -253,6 +253,7 @@ query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) { ro_number clm_total clm_no + dms_allocation invoice_allocation ownerid ownr_ln @@ -1200,6 +1201,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) { cdk_configuration } ro_number + dms_allocation invoice_allocation ins_co_id id @@ -1261,6 +1263,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) { cost_center productivehrs rate + ciecacode employee { flat_rate }