diff --git a/client/src/pages/jobs-close/jobs-close.component.jsx b/client/src/pages/jobs-close/jobs-close.component.jsx
index 058e9be74..71d961c99 100644
--- a/client/src/pages/jobs-close/jobs-close.component.jsx
+++ b/client/src/pages/jobs-close/jobs-close.component.jsx
@@ -146,11 +146,13 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
{t("general.actions.close")}
-
-
-
+ {(bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid) && (
+
+
+
+ )}
}
diff --git a/server/accounting/pbs/pbs-job-export.js b/server/accounting/pbs/pbs-job-export.js
index 58c577038..89114751a 100644
--- a/server/accounting/pbs/pbs-job-export.js
+++ b/server/accounting/pbs/pbs-job-export.js
@@ -15,7 +15,7 @@ const CalculateAllocations =
require("../../cdk/cdk-calculate-allocations").default;
const CdkBase = require("../../web-sockets/web-socket");
const moment = require("moment");
-
+const Dinero = require("dinero.js");
const axios = AxiosLib.create();
axios.interceptors.request.use((x) => {
const socket = x.socket;
@@ -116,8 +116,9 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
);
await UpsertVehicleData(socket, ownerRef.ReferenceId);
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
- return;
+
await InsertAccountPostingData(socket);
+
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
await MarkJobExported(socket, socket.JobData.id);
@@ -535,7 +536,7 @@ async function InsertAccountPostingData(socket) {
const item = {
Account: alloc.profitCenter.dms_acctnumber,
ControlNumber: socket.JobData.ro_number,
- Amount: alloc.sale.multiply(-1).toFormat("0.0"),
+ Amount: alloc.sale.multiply(-1).toFormat("0.00"),
//Comment: "String",
//AdditionalInfo: "String",
InvoiceNumber: socket.JobData.ro_number,
@@ -549,7 +550,7 @@ async function InsertAccountPostingData(socket) {
const item = {
Account: alloc.costCenter.dms_acctnumber,
ControlNumber: socket.JobData.ro_number,
- Amount: alloc.cost.toFormat("0.0"),
+ Amount: alloc.cost.toFormat("0.00"),
//Comment: "String",
//AdditionalInfo: "String",
InvoiceNumber: socket.JobData.ro_number,
@@ -560,7 +561,7 @@ async function InsertAccountPostingData(socket) {
const itemWip = {
Account: alloc.costCenter.dms_wip_acctnumber,
ControlNumber: socket.JobData.ro_number,
- Amount: alloc.cost.multiply(-1).toFormat("0.0"),
+ Amount: alloc.cost.multiply(-1).toFormat("0.00"),
//Comment: "String",
//AdditionalInfo: "String",
InvoiceNumber: socket.JobData.ro_number,
@@ -575,7 +576,7 @@ async function InsertAccountPostingData(socket) {
const item2 = {
Account: alloc.profitCenter.dms_acctnumber,
ControlNumber: socket.JobData.ro_number,
- Amount: alloc.sale.multiply(-1).toFormat("0.0"),
+ Amount: alloc.sale.multiply(-1).toFormat("0.00"),
//Comment: "String",
//AdditionalInfo: "String",
InvoiceNumber: socket.JobData.ro_number,
@@ -585,6 +586,21 @@ async function InsertAccountPostingData(socket) {
}
}
});
+ socket.txEnvelope.payers.forEach((payer) => {
+ const item = {
+ Account: payer.dms_acctnumber,
+ ControlNumber: payer.controlnumber,
+ Amount: Dinero({ amount: Math.round(payer.amount * 100) }).toFormat(
+ "0.0"
+ ),
+ //Comment: "String",
+ //AdditionalInfo: "String",
+ InvoiceNumber: socket.JobData.ro_number,
+ InvoiceDate: moment(socket.JobData.date_invoiced).toISOString(),
+ };
+
+ wips.push(item);
+ });
const { data: AccountPostingChange } = await axios.post(
PBS_ENDPOINTS.AccountingPostingChange,