PBS Update & Send to DMS Button
This commit is contained in:
@@ -146,11 +146,13 @@ 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}`}>
|
{(bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid) && (
|
||||||
<Button disabled={job.date_exported || !jobRO}>
|
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||||
{t("jobs.actions.sendtodms")}
|
<Button disabled={job.date_exported || !jobRO}>
|
||||||
</Button>
|
{t("jobs.actions.sendtodms")}
|
||||||
</Link>
|
</Button>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
<JobsScoreboardAdd job={job} disabled={false} />
|
<JobsScoreboardAdd job={job} disabled={false} />
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const CalculateAllocations =
|
|||||||
require("../../cdk/cdk-calculate-allocations").default;
|
require("../../cdk/cdk-calculate-allocations").default;
|
||||||
const CdkBase = require("../../web-sockets/web-socket");
|
const CdkBase = require("../../web-sockets/web-socket");
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
|
const Dinero = require("dinero.js");
|
||||||
const axios = AxiosLib.create();
|
const axios = AxiosLib.create();
|
||||||
axios.interceptors.request.use((x) => {
|
axios.interceptors.request.use((x) => {
|
||||||
const socket = x.socket;
|
const socket = x.socket;
|
||||||
@@ -116,8 +116,9 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
|
|||||||
);
|
);
|
||||||
await UpsertVehicleData(socket, ownerRef.ReferenceId);
|
await UpsertVehicleData(socket, ownerRef.ReferenceId);
|
||||||
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
|
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
|
||||||
return;
|
|
||||||
await InsertAccountPostingData(socket);
|
await InsertAccountPostingData(socket);
|
||||||
|
|
||||||
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
|
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);
|
||||||
await MarkJobExported(socket, socket.JobData.id);
|
await MarkJobExported(socket, socket.JobData.id);
|
||||||
|
|
||||||
@@ -535,7 +536,7 @@ async function InsertAccountPostingData(socket) {
|
|||||||
const item = {
|
const item = {
|
||||||
Account: alloc.profitCenter.dms_acctnumber,
|
Account: alloc.profitCenter.dms_acctnumber,
|
||||||
ControlNumber: socket.JobData.ro_number,
|
ControlNumber: socket.JobData.ro_number,
|
||||||
Amount: alloc.sale.multiply(-1).toFormat("0.0"),
|
Amount: alloc.sale.multiply(-1).toFormat("0.00"),
|
||||||
//Comment: "String",
|
//Comment: "String",
|
||||||
//AdditionalInfo: "String",
|
//AdditionalInfo: "String",
|
||||||
InvoiceNumber: socket.JobData.ro_number,
|
InvoiceNumber: socket.JobData.ro_number,
|
||||||
@@ -549,7 +550,7 @@ async function InsertAccountPostingData(socket) {
|
|||||||
const item = {
|
const item = {
|
||||||
Account: alloc.costCenter.dms_acctnumber,
|
Account: alloc.costCenter.dms_acctnumber,
|
||||||
ControlNumber: socket.JobData.ro_number,
|
ControlNumber: socket.JobData.ro_number,
|
||||||
Amount: alloc.cost.toFormat("0.0"),
|
Amount: alloc.cost.toFormat("0.00"),
|
||||||
//Comment: "String",
|
//Comment: "String",
|
||||||
//AdditionalInfo: "String",
|
//AdditionalInfo: "String",
|
||||||
InvoiceNumber: socket.JobData.ro_number,
|
InvoiceNumber: socket.JobData.ro_number,
|
||||||
@@ -560,7 +561,7 @@ async function InsertAccountPostingData(socket) {
|
|||||||
const itemWip = {
|
const itemWip = {
|
||||||
Account: alloc.costCenter.dms_wip_acctnumber,
|
Account: alloc.costCenter.dms_wip_acctnumber,
|
||||||
ControlNumber: socket.JobData.ro_number,
|
ControlNumber: socket.JobData.ro_number,
|
||||||
Amount: alloc.cost.multiply(-1).toFormat("0.0"),
|
Amount: alloc.cost.multiply(-1).toFormat("0.00"),
|
||||||
//Comment: "String",
|
//Comment: "String",
|
||||||
//AdditionalInfo: "String",
|
//AdditionalInfo: "String",
|
||||||
InvoiceNumber: socket.JobData.ro_number,
|
InvoiceNumber: socket.JobData.ro_number,
|
||||||
@@ -575,7 +576,7 @@ async function InsertAccountPostingData(socket) {
|
|||||||
const item2 = {
|
const item2 = {
|
||||||
Account: alloc.profitCenter.dms_acctnumber,
|
Account: alloc.profitCenter.dms_acctnumber,
|
||||||
ControlNumber: socket.JobData.ro_number,
|
ControlNumber: socket.JobData.ro_number,
|
||||||
Amount: alloc.sale.multiply(-1).toFormat("0.0"),
|
Amount: alloc.sale.multiply(-1).toFormat("0.00"),
|
||||||
//Comment: "String",
|
//Comment: "String",
|
||||||
//AdditionalInfo: "String",
|
//AdditionalInfo: "String",
|
||||||
InvoiceNumber: socket.JobData.ro_number,
|
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(
|
const { data: AccountPostingChange } = await axios.post(
|
||||||
PBS_ENDPOINTS.AccountingPostingChange,
|
PBS_ENDPOINTS.AccountingPostingChange,
|
||||||
|
|||||||
Reference in New Issue
Block a user