Merge branches 'development' and 'development' of bitbucket.org:snaptsoft/bodyshop into development
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
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;
|
const { generateJobTier, generateOwnerTier, generateSourceTier } = QbXmlUtils;
|
||||||
|
|
||||||
exports.default = async (req, res) => {
|
exports.default = async (req, res) => {
|
||||||
@@ -196,7 +196,7 @@ const generateInvoiceQbxml = (
|
|||||||
//Create the invoice lines mapping.
|
//Create the invoice lines mapping.
|
||||||
jobs_by_pk.joblines.map((jobline) => {
|
jobs_by_pk.joblines.map((jobline) => {
|
||||||
//Parts Lines
|
//Parts Lines
|
||||||
console.log("Jobline desc", jobline.line_desc);
|
|
||||||
if (jobline.profitcenter_part && jobline.act_price) {
|
if (jobline.profitcenter_part && jobline.act_price) {
|
||||||
const DineroAmount = Dinero({
|
const DineroAmount = Dinero({
|
||||||
amount: Math.round(jobline.act_price * 100),
|
amount: Math.round(jobline.act_price * 100),
|
||||||
@@ -227,7 +227,7 @@ const generateInvoiceQbxml = (
|
|||||||
].Amount.add(DineroAmount);
|
].Amount.add(DineroAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Parts Done");
|
|
||||||
// Labor Lines
|
// Labor Lines
|
||||||
if (
|
if (
|
||||||
jobline.profitcenter_labor &&
|
jobline.profitcenter_labor &&
|
||||||
@@ -270,7 +270,6 @@ const generateInvoiceQbxml = (
|
|||||||
|
|
||||||
//Convert the hash to an array.
|
//Convert the hash to an array.
|
||||||
Object.keys(invoiceLineHash).forEach((key) => {
|
Object.keys(invoiceLineHash).forEach((key) => {
|
||||||
console.log(key, invoiceLineHash[key]);
|
|
||||||
InvoiceLineAdd.push({
|
InvoiceLineAdd.push({
|
||||||
...invoiceLineHash[key],
|
...invoiceLineHash[key],
|
||||||
Amount: invoiceLineHash[key].Amount.toFormat(DineroQbFormat),
|
Amount: invoiceLineHash[key].Amount.toFormat(DineroQbFormat),
|
||||||
@@ -353,9 +352,12 @@ const generateInvoiceQbxml = (
|
|||||||
|
|
||||||
TxnDate: moment(jobs_by_pk.date_invoiced).format("YYYY-MM-DD"),
|
TxnDate: moment(jobs_by_pk.date_invoiced).format("YYYY-MM-DD"),
|
||||||
RefNumber: jobs_by_pk.ro_number,
|
RefNumber: jobs_by_pk.ro_number,
|
||||||
BillAddress: {
|
ShipAddress: {
|
||||||
Addr1: jobs_by_pk.ownr_addr1,
|
Addr1: `${jobs_by_pk.ownr_fn || ""} ${jobs_by_pk.ownr_ln || ""} ${
|
||||||
Addr2: jobs_by_pk.ownr_addr2,
|
jobs_by_pk.ownr_co_nm || ""
|
||||||
|
}`,
|
||||||
|
Addr2: jobs_by_pk.ownr_addr1,
|
||||||
|
Addr3: jobs_by_pk.ownr_addr2,
|
||||||
City: jobs_by_pk.ownr_city,
|
City: jobs_by_pk.ownr_city,
|
||||||
State: jobs_by_pk.ownr_st,
|
State: jobs_by_pk.ownr_st,
|
||||||
PostalCode: jobs_by_pk.ownrzip,
|
PostalCode: jobs_by_pk.ownrzip,
|
||||||
@@ -367,6 +369,8 @@ const generateInvoiceQbxml = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(JSON.stringify(invoiceQbxmlObj, null, 2));
|
||||||
var invoiceQbxml_partial = builder
|
var invoiceQbxml_partial = builder
|
||||||
.create(invoiceQbxmlObj, {
|
.create(invoiceQbxmlObj, {
|
||||||
version: "1.30",
|
version: "1.30",
|
||||||
|
|||||||
Reference in New Issue
Block a user