IO-991 QBXML Receivable Export changes [ci skip]
This commit is contained in:
@@ -13,7 +13,7 @@ require("dotenv").config({
|
||||
),
|
||||
});
|
||||
|
||||
Dinero.globalRoundingMode = 'HALF_EVEN'
|
||||
Dinero.globalRoundingMode = "HALF_EVEN";
|
||||
const { generateJobTier, generateOwnerTier, generateSourceTier } = QbXmlUtils;
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
@@ -196,7 +196,7 @@ const generateInvoiceQbxml = (
|
||||
//Create the invoice lines mapping.
|
||||
jobs_by_pk.joblines.map((jobline) => {
|
||||
//Parts Lines
|
||||
console.log("Jobline desc", jobline.line_desc);
|
||||
|
||||
if (jobline.profitcenter_part && jobline.act_price) {
|
||||
const DineroAmount = Dinero({
|
||||
amount: Math.round(jobline.act_price * 100),
|
||||
@@ -227,7 +227,7 @@ const generateInvoiceQbxml = (
|
||||
].Amount.add(DineroAmount);
|
||||
}
|
||||
}
|
||||
console.log("Parts Done");
|
||||
|
||||
// Labor Lines
|
||||
if (
|
||||
jobline.profitcenter_labor &&
|
||||
@@ -270,7 +270,6 @@ const generateInvoiceQbxml = (
|
||||
|
||||
//Convert the hash to an array.
|
||||
Object.keys(invoiceLineHash).forEach((key) => {
|
||||
console.log(key, invoiceLineHash[key]);
|
||||
InvoiceLineAdd.push({
|
||||
...invoiceLineHash[key],
|
||||
Amount: invoiceLineHash[key].Amount.toFormat(DineroQbFormat),
|
||||
@@ -353,9 +352,12 @@ const generateInvoiceQbxml = (
|
||||
|
||||
TxnDate: moment(jobs_by_pk.date_invoiced).format("YYYY-MM-DD"),
|
||||
RefNumber: jobs_by_pk.ro_number,
|
||||
BillAddress: {
|
||||
Addr1: jobs_by_pk.ownr_addr1,
|
||||
Addr2: jobs_by_pk.ownr_addr2,
|
||||
ShipAddress: {
|
||||
Addr1: `${jobs_by_pk.ownr_fn || ""} ${jobs_by_pk.ownr_ln || ""} ${
|
||||
jobs_by_pk.ownr_co_nm || ""
|
||||
}`,
|
||||
Addr2: jobs_by_pk.ownr_addr1,
|
||||
Addr3: jobs_by_pk.ownr_addr2,
|
||||
City: jobs_by_pk.ownr_city,
|
||||
State: jobs_by_pk.ownr_st,
|
||||
PostalCode: jobs_by_pk.ownrzip,
|
||||
@@ -367,6 +369,8 @@ const generateInvoiceQbxml = (
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
console.log(JSON.stringify(invoiceQbxmlObj, null, 2));
|
||||
var invoiceQbxml_partial = builder
|
||||
.create(invoiceQbxmlObj, {
|
||||
version: "1.30",
|
||||
|
||||
Reference in New Issue
Block a user