IO-233 CDK updates.

This commit is contained in:
Patrick Fic
2021-12-02 10:50:11 -08:00
parent a77e664ab1
commit 39ec9d92ec
23 changed files with 688 additions and 201 deletions

View File

@@ -6491,6 +6491,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>pag</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>pal</name> <name>pal</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -12146,6 +12167,37 @@
</folder_node> </folder_node>
</children> </children>
</folder_node> </folder_node>
<folder_node>
<name>dms</name>
<children>
<folder_node>
<name>labels</name>
<children>
<concept_node>
<name>refreshallocations</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children>
</folder_node>
</children>
</folder_node>
<folder_node> <folder_node>
<name>documents</name> <name>documents</name>
<children> <children>
@@ -17809,6 +17861,32 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<folder_node>
<name>labels</name>
<children>
<concept_node>
<name>refreshallocations</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children>
</folder_node>
<concept_node> <concept_node>
<name>post</name> <name>post</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -18315,6 +18393,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>sendtodms</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>sync</name> <name>sync</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -20419,6 +20518,27 @@
</concept_node> </concept_node>
</children> </children>
</folder_node> </folder_node>
<concept_node>
<name>dms_allocation</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>driveable</name> <name>driveable</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -22151,6 +22271,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>po_number</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>policy_no</name> <name>policy_no</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

@@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors"; 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 BillLineSearchSelect from "../bill-line-search-select/bill-line-search-select.component";
import CurrencyInput from "../form-items-formatted/currency-form-item.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component";
@@ -72,11 +73,13 @@ export function BillEnterModalLinesComponent({
quantity: opt.part_qty || 1, quantity: opt.part_qty || 1,
actual_price: opt.cost, actual_price: opt.cost,
cost_center: opt.part_type cost_center: opt.part_type
? responsibilityCenters.defaults && ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid
(responsibilityCenters.defaults.costs[ ? GetPartTypeName(opt.part_type)
opt.part_type : responsibilityCenters.defaults &&
] || (responsibilityCenters.defaults.costs[
null) opt.part_type
] ||
null)
: null, : null,
}; };
} }
@@ -224,6 +227,7 @@ export function BillEnterModalLinesComponent({
key: `${field.index}cost_center`, key: `${field.index}cost_center`,
name: [field.name, "cost_center"], name: [field.name, "cost_center"],
label: t("billlines.fields.cost_center"), label: t("billlines.fields.cost_center"),
valuePropName: "value",
rules: [ rules: [
{ {
required: true, required: true,
@@ -233,10 +237,12 @@ export function BillEnterModalLinesComponent({
}; };
}, },
formInput: (record, index) => ( formInput: (record, index) => (
<Select style={{ minWidth: "3rem" }} disabled={disabled}> <Select showSearch style={{ minWidth: "3rem" }} disabled={disabled}>
{responsibilityCenters.costs.map((item) => ( {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
<Select.Option key={item.name}>{item.name}</Select.Option> ? CiecaSelect(true, false)
))} : responsibilityCenters.costs.map((item) => (
<Select.Option key={item.name}>{item.name}</Select.Option>
))}
</Select> </Select>
), ),
}, },

View File

@@ -95,6 +95,7 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId, title }) {
columns={columns} columns={columns}
rowKey="center" rowKey="center"
dataSource={allocationsSummary} dataSource={allocationsSummary}
locale={{ emptyText: t("dms.labels.refreshallocations") }}
summary={() => { summary={() => {
const totals = allocationsSummary.reduce( const totals = allocationsSummary.reduce(
(acc, val) => { (acc, val) => {

View File

@@ -221,7 +221,47 @@ export function DmsPostForm({ bodyshop, socket, job }) {
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t("jobs.fields.dms.payer.controlnumber")} label={
<div>
{t("jobs.fields.dms.payer.controlnumber")}{" "}
<Dropdown
overlay={
<Menu>
{bodyshop.cdk_configuration.controllist &&
bodyshop.cdk_configuration.controllist.map(
(key, idx) => (
<Menu.Item
key={idx}
onClick={() => {
form.setFieldsValue({
payers: form
.getFieldValue("payers")
.map((row, mapIndex) => {
if (index !== mapIndex)
return row;
return {
...row,
controlnumber:
key.controlnumber,
};
}),
});
}}
>
{key.name}
</Menu.Item>
)
)}
</Menu>
}
>
<a href=" #" onClick={(e) => e.preventDefault()}>
<DownOutlined />
</a>
</Dropdown>
</div>
}
key={`${index}controlnumber`} key={`${index}controlnumber`}
name={[field.name, "controlnumber"]} name={[field.name, "controlnumber"]}
rules={[ rules={[
@@ -254,42 +294,6 @@ export function DmsPostForm({ bodyshop, socket, job }) {
}} }}
</Form.Item> </Form.Item>
<Dropdown
overlay={
<Menu>
{bodyshop.cdk_configuration.controllist &&
bodyshop.cdk_configuration.controllist.map(
(key, idx) => (
<Menu.Item
key={idx}
onClick={() => {
form.setFieldsValue({
payers: form
.getFieldValue("payers")
.map((row, mapIndex) => {
if (index !== mapIndex) return row;
return {
...row,
controlnumber: key.controlnumber,
};
}),
});
}}
>
{key.name}
</Menu.Item>
)
)}
</Menu>
}
>
<a href=" #" onClick={(e) => e.preventDefault()}>
{t("bodyshop.labels.dms.cdk.controllist")}{" "}
<DownOutlined />
</a>
</Dropdown>
<DeleteFilled <DeleteFilled
onClick={() => { onClick={() => {
remove(field.name); remove(field.name);

View File

@@ -54,6 +54,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
const handleMenuClick = ({ item, key, keyPath, domEvent }) => { const handleMenuClick = ({ item, key, keyPath, domEvent }) => {
logImEXEvent("jobs_close_allocate_auto_dms"); logImEXEvent("jobs_close_allocate_auto_dms");
form.setFieldsValue({ dms_allocation: key });
handleAllocate( handleAllocate(
bodyshop.md_responsibility_centers.dms_defaults.find( bodyshop.md_responsibility_centers.dms_defaults.find(
(x) => x.name === key (x) => x.name === key
@@ -64,7 +65,9 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
const overlay = (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && ( const overlay = (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Menu onClick={handleMenuClick}> <Menu onClick={handleMenuClick}>
{bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => ( {bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => (
<Menu.Item key={mapping.name}>{mapping.name}</Menu.Item> <Menu.Item disabled={disabled} key={mapping.name}>
{mapping.name}
</Menu.Item>
))} ))}
</Menu> </Menu>
); );

View File

@@ -38,12 +38,7 @@ export function LaborAllocationsTable({
useEffect(() => { useEffect(() => {
if (!!joblines && !!timetickets && !!bodyshop); if (!!joblines && !!timetickets && !!bodyshop);
setTotals( setTotals(
CalculateAllocationsTotals( CalculateAllocationsTotals(bodyshop, joblines, timetickets, adjustments)
bodyshop.md_responsibility_centers,
joblines,
timetickets,
adjustments
)
); );
if (!jobId) setTotals([]); if (!jobId) setTotals([]);
}, [joblines, timetickets, bodyshop, adjustments, jobId]); }, [joblines, timetickets, bodyshop, adjustments, jobId]);

View File

@@ -1,9 +1,12 @@
import i18next from "i18next";
export const CalculateAllocationsTotals = ( export const CalculateAllocationsTotals = (
responsibilitycenters, bodyshop,
joblines, joblines,
timetickets, timetickets,
adjustments = [] adjustments = []
) => { ) => {
const responsibilitycenters = bodyshop.md_responsibility_centers;
const jobCodes = joblines.map((item) => item.mod_lbr_ty); const jobCodes = joblines.map((item) => item.mod_lbr_ty);
//.filter((value, index, self) => self.indexOf(value) === index && !!value); //.filter((value, index, self) => self.indexOf(value) === index && !!value);
const ticketCodes = timetickets.map((item) => item.ciecacode); const ticketCodes = timetickets.map((item) => item.ciecacode);
@@ -15,7 +18,12 @@ export const CalculateAllocationsTotals = (
const r = allCodes.reduce((acc, value) => { const r = allCodes.reduce((acc, value) => {
const r = { const r = {
opcode: value, 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, mod_lbr_ty: value,
total: joblines.reduce((acc2, val2) => { total: joblines.reduce((acc2, val2) => {
return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2; return val2.mod_lbr_ty === value ? acc2 + val2.mod_lb_hrs : acc2;

View File

@@ -23,6 +23,7 @@ import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { selectJobReadOnly } from "../../redux/application/application.selectors";
import { setModalContext } from "../../redux/modals/modals.actions"; import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors";
import { GetPartTypeName } from "../../utils/Ciecaselect";
import CurrencyFormatter from "../../utils/CurrencyFormatter"; import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter"; import { DateFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters"; import { alphaSort } from "../../utils/sorters";
@@ -165,10 +166,15 @@ export function PartsOrderListTableComponent({
quantity: pol.quantity, quantity: pol.quantity,
actual_price: pol.act_price, actual_price: pol.act_price,
cost_center: pol.jobline?.part_type cost_center: pol.jobline?.part_type
? responsibilityCenters.defaults.costs[ ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid
pol.jobline.part_type ? GetPartTypeName(pol.jobline.part_type)
] || null : responsibilityCenters.defaults &&
(responsibilityCenters.defaults.costs[
pol.jobline.part_type
] ||
null)
: null, : null,
}; };
}), }),

View File

@@ -14,6 +14,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
import FormDatePicker from "../form-date-picker/form-date-picker.component"; import FormDatePicker from "../form-date-picker/form-date-picker.component";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import CiecaSelect from "../../utils/Ciecaselect";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
@@ -218,6 +219,7 @@ export function ShopEmployeesFormComponent({
label={t("employees.fields.cost_center")} label={t("employees.fields.cost_center")}
key={`${index}`} key={`${index}`}
name={[field.name, "cost_center"]} name={[field.name, "cost_center"]}
valuePropName="value"
rules={[ rules={[
{ {
required: true, required: true,
@@ -232,11 +234,16 @@ export function ShopEmployeesFormComponent({
> >
{t("timetickets.labels.shift")} {t("timetickets.labels.shift")}
</Select.Option> </Select.Option>
{bodyshop.md_responsibility_centers.costs.map((c) => (
<Select.Option key={c.name} value={c.name}> {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
{c.name} ? CiecaSelect(false, true)
</Select.Option> : bodyshop.md_responsibility_centers.costs.map(
))} (c) => (
<Select.Option key={c.name} value={c.name}>
{c.name}
</Select.Option>
)
)}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item

View File

@@ -47,9 +47,13 @@ export function TimeTicketModalComponent({
> >
{emps && {emps &&
emps.rates.map((item) => ( emps.rates.map((item) => (
<Select.Option key={item.cost_center}> <Select.Option key={item.cost_center} value={item.cost_center}>
{item.cost_center === "timetickets.labels.shift" {item.cost_center === "timetickets.labels.shift"
? t(item.cost_center) ? t(item.cost_center)
: bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
? t(
`joblines.fields.lbr_types.${item.cost_center.toUpperCase()}`
)
: item.cost_center} : item.cost_center}
</Select.Option> </Select.Option>
))} ))}
@@ -137,6 +141,7 @@ export function TimeTicketModalComponent({
<Form.Item <Form.Item
name="cost_center" name="cost_center"
label={t("timetickets.fields.cost_center")} label={t("timetickets.fields.cost_center")}
valuePropName="value"
rules={[ rules={[
{ {
required: true, required: true,

View File

@@ -143,13 +143,16 @@ export function TimeTicketModalContainer({
} }
if (!!changedFields.cost_center && !!EmployeeAutoCompleteData) { if (!!changedFields.cost_center && !!EmployeeAutoCompleteData) {
form.setFieldsValue({ form.setFieldsValue({
ciecacode: Object.keys( ciecacode:
bodyshop.md_responsibility_centers.defaults.costs bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
).find( ? changedFields.cost_center
(key) => : Object.keys(
bodyshop.md_responsibility_centers.defaults.costs[key] === bodyshop.md_responsibility_centers.defaults.costs
changedFields.cost_center ).find(
), (key) =>
bodyshop.md_responsibility_centers.defaults.costs[key] ===
changedFields.cost_center
),
}); });
} }
}; };

View File

@@ -1695,6 +1695,7 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
ro_number ro_number
invoice_allocation invoice_allocation
ins_co_id ins_co_id
dms_allocation
id id
ded_amt ded_amt
ded_status ded_status

View File

@@ -9,6 +9,7 @@ import {
Divider, Divider,
PageHeader, PageHeader,
InputNumber, InputNumber,
Input,
} from "antd"; } from "antd";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -26,6 +27,8 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component"; import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component";
import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component"; import DateTimePicker from "../../components/form-date-time-picker/form-date-time-picker.component";
import moment from "moment"; import moment from "moment";
import { Link } from "react-router-dom";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
jobRO: selectJobReadOnly, jobRO: selectJobReadOnly,
@@ -59,6 +62,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
actual_delivery: values.actual_delivery, actual_delivery: values.actual_delivery,
kmin: values.kmin, kmin: values.kmin,
kmout: values.kmout, kmout: values.kmout,
dms_allocation: values.dms_allocation,
}, },
}, },
refetchQueries: ["QUERY_JOB_CLOSE_DETAILS"], refetchQueries: ["QUERY_JOB_CLOSE_DETAILS"],
@@ -117,6 +121,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
: job.scheduled_delivery && moment(job.scheduled_delivery), : job.scheduled_delivery && moment(job.scheduled_delivery),
kmin: job.kmin, kmin: job.kmin,
kmout: job.kmout, kmout: job.kmout,
dms_allocation: job.dms_allocation,
}} }}
scrollToFirstError scrollToFirstError
> >
@@ -141,7 +146,11 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
{t("general.actions.close")} {t("general.actions.close")}
</Button> </Button>
</Popconfirm> </Popconfirm>
<Link to={`/manage/dms?jobId=${job.id}`}>
<Button disabled={job.date_exported || !jobRO}>
{t("jobs.actions.sendtodms")}
</Button>
</Link>
<JobsScoreboardAdd job={job} disabled={false} /> <JobsScoreboardAdd job={job} disabled={false} />
</Space> </Space>
} }
@@ -247,6 +256,19 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
<InputNumber precision={0} disabled={jobRO} /> <InputNumber precision={0} disabled={jobRO} />
</Form.Item> </Form.Item>
)} )}
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
<Form.Item
label={t("jobs.fields.dms_allocation")}
name="dms_allocation"
rules={[
{
required: true,
},
]}
>
<Input disabled />
</Form.Item>
)}
</LayoutFormRow> </LayoutFormRow>
<Divider /> <Divider />
<JobsCloseLines job={job} /> <JobsCloseLines job={job} />

View File

@@ -413,6 +413,7 @@
"mash": "Shop Materials", "mash": "Shop Materials",
"paa": "Aftermarket", "paa": "Aftermarket",
"pac": "Chrome", "pac": "Chrome",
"pag": "Glass",
"pal": "LKQ", "pal": "LKQ",
"pam": "Remanufactured", "pam": "Remanufactured",
"pan": "OEM", "pan": "OEM",
@@ -759,6 +760,11 @@
"projectedmonthlysales": "Projected Monthly Sales" "projectedmonthlysales": "Projected Monthly Sales"
} }
}, },
"dms": {
"labels": {
"refreshallocations": "Refresh to see DMS Allocataions."
}
},
"documents": { "documents": {
"actions": { "actions": {
"delete": "Delete Selected Documents", "delete": "Delete Selected Documents",
@@ -1107,6 +1113,9 @@
"createnewcustomer": "Create New Customer", "createnewcustomer": "Create New Customer",
"findmakemodelcode": "Find Make/Model Code", "findmakemodelcode": "Find Make/Model Code",
"getmakes": "", "getmakes": "",
"labels": {
"refreshallocations": "Refresh this component to see the DMS allocations."
},
"post": "Post", "post": "Post",
"refetchmakesmodels": "Refetch Make and Model Codes", "refetchmakesmodels": "Refetch Make and Model Codes",
"usegeneric": "Use Generic Customer", "usegeneric": "Use Generic Customer",
@@ -1132,6 +1141,7 @@
"removefromproduction": "Remove from Production", "removefromproduction": "Remove from Production",
"schedule": "Schedule", "schedule": "Schedule",
"sendcsi": "Send CSI", "sendcsi": "Send CSI",
"sendtodms": "Send to DMS",
"sync": "Sync", "sync": "Sync",
"uninvoice": "Uninvoice", "uninvoice": "Uninvoice",
"unvoid": "Unvoid Job", "unvoid": "Unvoid Job",
@@ -1241,6 +1251,7 @@
"story": "Story", "story": "Story",
"vinowner": "VIN Owner" "vinowner": "VIN Owner"
}, },
"dms_allocation": "DMS Allocation",
"driveable": "Driveable", "driveable": "Driveable",
"employee_body": "Body", "employee_body": "Body",
"employee_csr": "Customer Service Rep.", "employee_csr": "Customer Service Rep.",
@@ -1327,6 +1338,7 @@
"pas": "Sublet", "pas": "Sublet",
"pay_date": "Pay Date", "pay_date": "Pay Date",
"phoneshort": "PH", "phoneshort": "PH",
"po_number": "PO Number",
"policy_no": "Policy #", "policy_no": "Policy #",
"ponumber": "PO Number", "ponumber": "PO Number",
"production_vars": { "production_vars": {

View File

@@ -413,6 +413,7 @@
"mash": "", "mash": "",
"paa": "", "paa": "",
"pac": "", "pac": "",
"pag": "",
"pal": "", "pal": "",
"pam": "", "pam": "",
"pan": "", "pan": "",
@@ -759,6 +760,11 @@
"projectedmonthlysales": "" "projectedmonthlysales": ""
} }
}, },
"dms": {
"labels": {
"refreshallocations": ""
}
},
"documents": { "documents": {
"actions": { "actions": {
"delete": "", "delete": "",
@@ -1107,6 +1113,9 @@
"createnewcustomer": "", "createnewcustomer": "",
"findmakemodelcode": "", "findmakemodelcode": "",
"getmakes": "", "getmakes": "",
"labels": {
"refreshallocations": ""
},
"post": "", "post": "",
"refetchmakesmodels": "", "refetchmakesmodels": "",
"usegeneric": "", "usegeneric": "",
@@ -1132,6 +1141,7 @@
"removefromproduction": "", "removefromproduction": "",
"schedule": "Programar", "schedule": "Programar",
"sendcsi": "", "sendcsi": "",
"sendtodms": "",
"sync": "", "sync": "",
"uninvoice": "", "uninvoice": "",
"unvoid": "", "unvoid": "",
@@ -1241,6 +1251,7 @@
"story": "", "story": "",
"vinowner": "" "vinowner": ""
}, },
"dms_allocation": "",
"driveable": "", "driveable": "",
"employee_body": "", "employee_body": "",
"employee_csr": "Representante de servicio al cliente.", "employee_csr": "Representante de servicio al cliente.",
@@ -1327,6 +1338,7 @@
"pas": "", "pas": "",
"pay_date": "Fecha de Pay", "pay_date": "Fecha de Pay",
"phoneshort": "PH", "phoneshort": "PH",
"po_number": "",
"policy_no": "Política #", "policy_no": "Política #",
"ponumber": "numero postal", "ponumber": "numero postal",
"production_vars": { "production_vars": {

View File

@@ -413,6 +413,7 @@
"mash": "", "mash": "",
"paa": "", "paa": "",
"pac": "", "pac": "",
"pag": "",
"pal": "", "pal": "",
"pam": "", "pam": "",
"pan": "", "pan": "",
@@ -759,6 +760,11 @@
"projectedmonthlysales": "" "projectedmonthlysales": ""
} }
}, },
"dms": {
"labels": {
"refreshallocations": ""
}
},
"documents": { "documents": {
"actions": { "actions": {
"delete": "", "delete": "",
@@ -1107,6 +1113,9 @@
"createnewcustomer": "", "createnewcustomer": "",
"findmakemodelcode": "", "findmakemodelcode": "",
"getmakes": "", "getmakes": "",
"labels": {
"refreshallocations": ""
},
"post": "", "post": "",
"refetchmakesmodels": "", "refetchmakesmodels": "",
"usegeneric": "", "usegeneric": "",
@@ -1132,6 +1141,7 @@
"removefromproduction": "", "removefromproduction": "",
"schedule": "Programme", "schedule": "Programme",
"sendcsi": "", "sendcsi": "",
"sendtodms": "",
"sync": "", "sync": "",
"uninvoice": "", "uninvoice": "",
"unvoid": "", "unvoid": "",
@@ -1241,6 +1251,7 @@
"story": "", "story": "",
"vinowner": "" "vinowner": ""
}, },
"dms_allocation": "",
"driveable": "", "driveable": "",
"employee_body": "", "employee_body": "",
"employee_csr": "représentant du service à la clientèle", "employee_csr": "représentant du service à la clientèle",
@@ -1327,6 +1338,7 @@
"pas": "", "pas": "",
"pay_date": "Date d'Pay", "pay_date": "Date d'Pay",
"phoneshort": "PH", "phoneshort": "PH",
"po_number": "",
"policy_no": "Politique #", "policy_no": "Politique #",
"ponumber": "Numéro de bon de commande", "ponumber": "Numéro de bon de commande",
"production_vars": { "production_vars": {

View File

@@ -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 && (
<>
<Select.Option value="LAA">
{i18n.t("joblines.fields.lbr_types.LAA")}
</Select.Option>
<Select.Option value="LAB">
{i18n.t("joblines.fields.lbr_types.LAB")}
</Select.Option>
<Select.Option value="LAD">
{i18n.t("joblines.fields.lbr_types.LAD")}
</Select.Option>
<Select.Option value="LAE">
{i18n.t("joblines.fields.lbr_types.LAE")}
</Select.Option>
<Select.Option value="LAF">
{i18n.t("joblines.fields.lbr_types.LAF")}
</Select.Option>
<Select.Option value="LAG">
{i18n.t("joblines.fields.lbr_types.LAG")}
</Select.Option>
<Select.Option value="LAM">
{i18n.t("joblines.fields.lbr_types.LAM")}
</Select.Option>
<Select.Option value="LAR">
{i18n.t("joblines.fields.lbr_types.LAR")}
</Select.Option>
<Select.Option value="LAS">
{i18n.t("joblines.fields.lbr_types.LAS")}
</Select.Option>
<Select.Option value="LAU">
{i18n.t("joblines.fields.lbr_types.LAU")}
</Select.Option>
<Select.Option value="LA1">
{i18n.t("joblines.fields.lbr_types.LA1")}
</Select.Option>
<Select.Option value="LA2">
{i18n.t("joblines.fields.lbr_types.LA2")}
</Select.Option>
<Select.Option value="LA3">
{i18n.t("joblines.fields.lbr_types.LA3")}
</Select.Option>
<Select.Option value="LA4">
{i18n.t("joblines.fields.lbr_types.LA4")}
</Select.Option>
</>
)}
{parts && (
<>
<Select.Option value="PAA">
{i18n.t("joblines.fields.part_types.PAA")}
</Select.Option>
<Select.Option value="PAC">
{i18n.t("joblines.fields.part_types.PAC")}
</Select.Option>
<Select.Option value="PAL">
{i18n.t("joblines.fields.part_types.PAL")}
</Select.Option>
<Select.Option value="PAG">
{i18n.t("joblines.fields.part_types.PAG")}
</Select.Option>
<Select.Option value="PAM">
{i18n.t("joblines.fields.part_types.PAM")}
</Select.Option>
<Select.Option value="PAP">
{i18n.t("joblines.fields.part_types.PAP")}
</Select.Option>
<Select.Option value="PAN">
{i18n.t("joblines.fields.part_types.PAN")}
</Select.Option>
<Select.Option value="PAO">
{i18n.t("joblines.fields.part_types.PAO")}
</Select.Option>
<Select.Option value="PAR">
{i18n.t("joblines.fields.part_types.PAR")}
</Select.Option>
<Select.Option value="PAS">
{i18n.t("joblines.fields.part_types.PAS")}
</Select.Option>
</>
)}
</>
);
}
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()}`);
}

View File

@@ -2616,6 +2616,7 @@
- ded_status - ded_status
- deliverchecklist - deliverchecklist
- depreciation_taxes - depreciation_taxes
- dms_allocation
- driveable - driveable
- employee_body - employee_body
- employee_csr - employee_csr
@@ -2868,6 +2869,7 @@
- ded_status - ded_status
- deliverchecklist - deliverchecklist
- depreciation_taxes - depreciation_taxes
- dms_allocation
- driveable - driveable
- employee_body - employee_body
- employee_csr - employee_csr
@@ -3130,6 +3132,7 @@
- ded_status - ded_status
- deliverchecklist - deliverchecklist
- depreciation_taxes - depreciation_taxes
- dms_allocation
- driveable - driveable
- employee_body - employee_body
- employee_csr - employee_csr

View File

@@ -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;

View File

@@ -0,0 +1,2 @@
alter table "public"."jobs" add column "dms_allocation" text
null;

View File

@@ -106,10 +106,23 @@ exports.default = async function (socket, jobid) {
return acc; 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) => { const costCenterHash = job.bills.reduce((bill_acc, bill_val) => {
bill_val.billlines.map((line_val) => { bill_val.billlines.map((line_val) => {
if (!bill_acc[line_val.cost_center]) if (!bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]])
bill_acc[line_val.cost_center] = Dinero(); bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] =
Dinero();
let lineDinero = Dinero({ let lineDinero = Dinero({
amount: Math.round((line_val.actual_cost || 0) * 100), amount: Math.round((line_val.actual_cost || 0) * 100),
@@ -117,8 +130,10 @@ exports.default = async function (socket, jobid) {
.multiply(line_val.quantity) .multiply(line_val.quantity)
.multiply(bill_val.is_credit_memo ? -1 : 1); .multiply(bill_val.is_credit_memo ? -1 : 1);
bill_acc[line_val.cost_center] = bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]] =
bill_acc[line_val.cost_center].add(lineDinero); bill_acc[selectedDmsAllocationConfig.costs[line_val.cost_center]].add(
lineDinero
);
return null; return null;
}); });
return bill_acc; return bill_acc;
@@ -136,17 +151,19 @@ exports.default = async function (socket, jobid) {
), ),
}); });
//Add it to the right cost center. //Add it to the right cost center.
if (!costCenterHash[ticket.cost_center]) if (!costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]])
costCenterHash[ticket.cost_center] = Dinero(); costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]] =
Dinero();
costCenterHash[ticket.cost_center] = costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]] =
costCenterHash[ticket.cost_center].add(TicketTotal); costCenterHash[selectedDmsAllocationConfig.costs[ticket.ciecacode]].add(
TicketTotal
);
}); });
if (!hasMapaLine && job.job_totals.rates.mapa.total.amount > 0) { if (!hasMapaLine && job.job_totals.rates.mapa.total.amount > 0) {
// console.log("Adding MAPA Line Manually."); // console.log("Adding MAPA Line Manually.");
const mapaAccountName = const mapaAccountName = selectedDmsAllocationConfig.profits.MAPA;
bodyshop.md_responsibility_centers.defaults.profits.MAPA;
const mapaAccount = bodyshop.md_responsibility_centers.profits.find( const mapaAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === mapaAccountName (c) => c.name === mapaAccountName
@@ -167,8 +184,7 @@ exports.default = async function (socket, jobid) {
if (!hasMashLine && job.job_totals.rates.mash.total.amount > 0) { if (!hasMashLine && job.job_totals.rates.mash.total.amount > 0) {
// console.log("Adding MASH Line Manually."); // console.log("Adding MASH Line Manually.");
const mashAccountName = const mashAccountName = selectedDmsAllocationConfig.profits.MASH;
bodyshop.md_responsibility_centers.defaults.profits.MASH;
const mashAccount = bodyshop.md_responsibility_centers.profits.find( const mashAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === mashAccountName (c) => c.name === mashAccountName
@@ -198,7 +214,7 @@ exports.default = async function (socket, jobid) {
if (job.towing_payable && job.towing_payable !== 0) { if (job.towing_payable && job.towing_payable !== 0) {
const towAccountName = const towAccountName =
bodyshop.md_responsibility_centers.defaults.profits.TOW; selectedDmsAllocationConfig.profits.TOW;
const towAccount = bodyshop.md_responsibility_centers.profits.find( const towAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === towAccountName (c) => c.name === towAccountName
@@ -219,7 +235,7 @@ exports.default = async function (socket, jobid) {
} }
if (job.storage_payable && job.storage_payable !== 0) { if (job.storage_payable && job.storage_payable !== 0) {
const storageAccountName = const storageAccountName =
bodyshop.md_responsibility_centers.defaults.profits.TOW; selectedDmsAllocationConfig.profits.TOW;
const towAccount = bodyshop.md_responsibility_centers.profits.find( const towAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === storageAccountName (c) => c.name === storageAccountName
@@ -243,7 +259,7 @@ exports.default = async function (socket, jobid) {
if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) { if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) {
const otherAccountName = const otherAccountName =
bodyshop.md_responsibility_centers.defaults.profits.PAO; selectedDmsAllocationConfig.profits.PAO;
const otherAccount = bodyshop.md_responsibility_centers.profits.find( const otherAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === otherAccountName (c) => c.name === otherAccountName

View File

@@ -253,6 +253,7 @@ query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) {
ro_number ro_number
clm_total clm_total
clm_no clm_no
dms_allocation
invoice_allocation invoice_allocation
ownerid ownerid
ownr_ln ownr_ln
@@ -1200,6 +1201,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
cdk_configuration cdk_configuration
} }
ro_number ro_number
dms_allocation
invoice_allocation invoice_allocation
ins_co_id ins_co_id
id id
@@ -1261,6 +1263,7 @@ exports.GET_CDK_ALLOCATIONS = `query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
cost_center cost_center
productivehrs productivehrs
rate rate
ciecacode
employee { employee {
flat_rate flat_rate
} }