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")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||
<Button disabled={job.date_exported || !jobRO}>
|
||||
{t("jobs.actions.sendtodms")}
|
||||
</Button>
|
||||
</Link>
|
||||
{(bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid) && (
|
||||
<Link to={`/manage/dms?jobId=${job.id}`}>
|
||||
<Button disabled={job.date_exported || !jobRO}>
|
||||
{t("jobs.actions.sendtodms")}
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
<JobsScoreboardAdd job={job} disabled={false} />
|
||||
</Space>
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user