From 6354ccee875267710c06b5399476bafd9e3eb461 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 1 Nov 2022 14:26:13 -0700 Subject: [PATCH] AP changes based on validation testing. --- server/accounting/pbs/pbs-ap-allocations.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/accounting/pbs/pbs-ap-allocations.js b/server/accounting/pbs/pbs-ap-allocations.js index 036b0c538..b4c6bf514 100644 --- a/server/accounting/pbs/pbs-ap-allocations.js +++ b/server/accounting/pbs/pbs-ap-allocations.js @@ -74,7 +74,7 @@ async function PbsCalculateAllocationsAp(socket, billids) { SerialNumber: socket.bodyshop.pbs_serialnumber, billid: bill.id, Posting: { - Reference: bill.job.ro_number, + Reference: bill.invoice_number, JournalCode: socket.txEnvelope ? socket.txEnvelope.journal : null, TransactionDate: moment().tz(socket.bodyshop.timezone).toISOString(), //"0001-01-01T00:00:00.0000000Z", //Description: "Bulk AP posting.", @@ -159,7 +159,10 @@ async function PbsCalculateAllocationsAp(socket, billids) { let APAmount = Dinero(); Object.keys(billHash).map((key) => { if (billHash[key].Amount.getAmount() > 0) { - transactionObject.Posting.Lines.push(billHash[key]); + transactionObject.Posting.Lines.push({ + ...billHash[key], + Amount: billHash[key].Amount.toFormat("0.00"), + }); APAmount = APAmount.add(billHash[key].Amount); //Calculate the total expense for the bill iteratively to create the corresponding credit to AP. } }); @@ -167,7 +170,7 @@ async function PbsCalculateAllocationsAp(socket, billids) { transactionObject.Posting.Lines.push({ Account: bodyshop.md_responsibility_centers.ap.dms_acctnumber, ControlNumber: bill.vendor.dmsid, - Amount: APAmount.multiply(-1), + Amount: APAmount.multiply(-1).toFormat("0.00"), // Comment: "String", AdditionalInfo: bill.vendor.name, InvoiceNumber: bill.invoice_number,