diff --git a/client/src/components/shop-info/shop-info.laborrates.component.jsx b/client/src/components/shop-info/shop-info.laborrates.component.jsx
index 0f682e6af..f91273fd6 100644
--- a/client/src/components/shop-info/shop-info.laborrates.component.jsx
+++ b/client/src/components/shop-info/shop-info.laborrates.component.jsx
@@ -42,7 +42,7 @@ export default function ShopInfoLaborRates({ form }) {
},
]}
>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{
//
- //
+ //
//
//
- //
+ //
//
}
-
+
-
+
{
diff --git a/server/cdk/cdk-calculate-allocations.js b/server/cdk/cdk-calculate-allocations.js
index 5676a0eda..65f22ce27 100644
--- a/server/cdk/cdk-calculate-allocations.js
+++ b/server/cdk/cdk-calculate-allocations.js
@@ -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),
diff --git a/server/cdk/cdk-job-export.js b/server/cdk/cdk-job-export.js
index 0066a16e8..d204ad2fd 100644
--- a/server/cdk/cdk-job-export.js
+++ b/server/cdk/cdk-job-export.js
@@ -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,