Merged in release/2021-10-08 (pull request #243)

release/2021-10-08

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2021-10-06 20:37:34 +00:00
3 changed files with 126 additions and 34 deletions

View File

@@ -42,7 +42,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_lab")}
@@ -55,7 +55,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_lad")}
@@ -68,7 +68,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_lae")}
@@ -81,7 +81,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_laf")}
@@ -94,7 +94,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_lag")}
@@ -107,7 +107,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_lam")}
@@ -120,7 +120,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_lar")}
@@ -133,7 +133,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_las")}
@@ -146,7 +146,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_la1")}
@@ -159,7 +159,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_la2")}
@@ -172,7 +172,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_la3")}
@@ -185,7 +185,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_la4")}
@@ -198,7 +198,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_mash")}
@@ -211,7 +211,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_mapa")}
@@ -224,7 +224,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_ma2s")}
@@ -237,7 +237,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_ma3s")}
@@ -250,7 +250,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
{
// <Form.Item
@@ -264,7 +264,7 @@ export default function ShopInfoLaborRates({ form }) {
// },
// ]}
// >
// <CurrencyInput />
// <CurrencyInput min={0} />
// </Form.Item>
// <Form.Item
// label={t("jobs.fields.rate_macs")}
@@ -277,7 +277,7 @@ export default function ShopInfoLaborRates({ form }) {
// },
// ]}
// >
// <CurrencyInput />
// <CurrencyInput min={0} />
// </Form.Item>
}
<Form.Item
@@ -291,7 +291,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<Form.Item
label={t("jobs.fields.rate_mahw")}
@@ -304,7 +304,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
<CurrencyInput />
<CurrencyInput min={0} />
</Form.Item>
<DeleteFilled
onClick={() => {

View File

@@ -180,6 +180,85 @@ exports.default = async function (socket, jobid) {
// console.log("NO MASH ACCOUNT FOUND!!");
}
}
const { ca_bc_pvrt } = job;
if (ca_bc_pvrt) {
// const pvrtAccount = bodyshop.md_responsibility_centers.profits.find(
// (c) => c.name === mashAccountName
// );
taxAllocations.state.sale = taxAllocations.state.sale.add(
Dinero({ amount: (ca_bc_pvrt || 0) * 100 })
);
}
if (job.towing_payable && job.towing_payable !== 0) {
const towAccountName =
bodyshop.md_responsibility_centers.defaults.profits.TOW;
const towAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === towAccountName
);
if (towAccount) {
if (!profitCenterHash[towAccountName])
profitCenterHash[towAccountName] = Dinero();
profitCenterHash[towAccountName] = profitCenterHash[towAccountName].add(
Dinero({
amount: Math.round((job.towing_payable || 0) * 100),
})
);
} else {
// console.log("NO MASH ACCOUNT FOUND!!");
}
}
if (job.storage_payable && job.storage_payable !== 0) {
const storageAccountName =
bodyshop.md_responsibility_centers.defaults.profits.TOW;
const towAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === storageAccountName
);
if (towAccount) {
if (!profitCenterHash[storageAccountName])
profitCenterHash[storageAccountName] = Dinero();
profitCenterHash[storageAccountName] = profitCenterHash[
storageAccountName
].add(
Dinero({
amount: Math.round((job.storage_payable || 0) * 100),
})
);
} else {
// console.log("NO MASH ACCOUNT FOUND!!");
}
}
if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) {
const otherAccountName =
bodyshop.md_responsibility_centers.defaults.profits.PAO;
const otherAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === otherAccountName
);
if (otherAccount) {
if (!profitCenterHash[otherAccountName])
profitCenterHash[otherAccountName] = Dinero();
profitCenterHash[otherAccountName] = profitCenterHash[
otherAccountName
].add(
Dinero({
amount: Math.round((job.adjustment_bottom_line || 0) * 100),
})
);
} else {
// console.log("NO MASH ACCOUNT FOUND!!");
}
}
const jobAllocations = _.union(
Object.keys(profitCenterHash),

View File

@@ -15,6 +15,8 @@ const CalcualteAllocations = require("./cdk-calculate-allocations").default;
const moment = require("moment");
const replaceSpecialRegex = `[^a-zA-Z0-9 .,\n #]+`;
exports.default = async function (socket, { txEnvelope, jobid }) {
socket.logEvents = [];
socket.recordid = jobid;
@@ -175,9 +177,9 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
CdkBase.createLogEvent(
socket,
"DEBUG",
`{5} Updating Service Vehicle History. ***SKIPPING FOR NOW TO PRESERVE RO NUMBERS ***`
`{5} Updating Service Vehicle History.`
);
//socket.DMSVehHistory = await InsertServiceVehicleHistory(socket);
socket.DMSVehHistory = await InsertServiceVehicleHistory(socket);
socket.emit("export-success", socket.JobData.id);
} else {
//Get the error code
@@ -437,7 +439,7 @@ async function QueryDmsCustomerByName(socket, JobData) {
arg1: { dealerId: JobData.bodyshop.cdk_dealerid }, //TODO: Verify why this does not follow the other standards.
arg2: {
verb: "EXACT",
key: ownerName,
key: ownerName.replaceAll(replaceSpecialRegex, ""),
},
});
@@ -574,8 +576,14 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
//TODO: Verify whether we need to bring more information in.
id: { value: newCustomerNumber },
address: {
addressLine: socket.JobData.ownr_addr1,
city: socket.JobData.ownr_city,
addressLine: socket.JobData.ownr_addr1.replaceAll(
replaceSpecialRegex,
""
),
city: socket.JobData.ownr_city.replaceAll(
replaceSpecialRegex,
""
),
country: null,
postalCode:
socket.JobData.ownr_zip &&
@@ -597,19 +605,24 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
},
demographics: null,
name1: {
companyname: socket.JobData.ownr_co_nm,
firstName: socket.JobData.ownr_fn,
companyname: socket.JobData.ownr_co_nm.replaceAll(
replaceSpecialRegex,
""
),
firstName: socket.JobData.ownr_fn.replaceAll(
replaceSpecialRegex,
""
),
fullname: null,
lastName: socket.JobData.ownr_ln,
lastName: socket.JobData.ownr_ln.replaceAll(
replaceSpecialRegex,
""
),
middleName: null,
nameType: "Person",
suffix: null,
title: null,
},
//TODO - REMOVE THIS AFTER TESTING.
...(process.env.NODE_ENV !== "production"
? { arStatus: { dealerField1: "Testing" } }
: {}),
},
},
@@ -873,7 +886,7 @@ async function InsertDmsStartWip(socket) {
arg2: {
acctgDate: moment().format("YYYY-MM-DD"),
//socket.JobData.invoice_date
desc: socket.txEnvelope.story,
desc: socket.txEnvelope.story.replaceAll(replaceSpecialRegex, ""),
docType: 10 || 7, //Need to check what this usually would be? Apparently it is almost always 10 or 7.
//1 Cash Receipt , 2 Check, 3 Journal Voucher, 4 Parts invoice, 5 Payable Invoice, 6 Recurring Entry, 7 Repair Order Invoice, 8 Vehicle Purchase Invoice, 9 Vehicle Sale Invoice, 10 Other, 11 Payroll, 12 Finance Charge, 13 FMLR Invoice, 14 Parts Credit Memo, 15 Manufacturer Document, 16 FMLR Credit Memo
m13Flag: 0,