IO-233 CDK Shop Config

This commit is contained in:
Patrick Fic
2021-08-10 08:40:38 -07:00
parent ac18e78897
commit 124d68ef68
24 changed files with 2540 additions and 816 deletions

View File

@@ -6,6 +6,8 @@ const Dinero = require("dinero.js");
const moment = require("moment");
var builder = require("xmlbuilder2");
const QbXmlUtils = require("./qbxml-utils");
const logger = require("../../utils/logger");
require("dotenv").config({
path: path.resolve(
process.cwd(),
@@ -93,7 +95,13 @@ exports.default = async (req, res) => {
res.status(200).json(QbXmlToExecute);
} catch (error) {
console.log("error", error);
logger.log(
"qbxml-payments-error",
"error",
req.body.user,
req.body.jobIds,
error
);
res.status(400).send(JSON.stringify(error));
}
};
@@ -220,7 +228,7 @@ const generateInvoiceQbxml = (
}).multiply(jobline.part_qty || 1);
if (jobline.prt_dsmk_p && jobline.prt_dsmk_p !== 0) {
console.log("Have a part discount", jobline);
// console.log("Have a part discount", jobline);
DineroAmount = DineroAmount.add(
DineroAmount.percentage(jobline.prt_dsmk_p || 0)
);
@@ -230,6 +238,13 @@ const generateInvoiceQbxml = (
);
if (!account) {
logger.log(
"qbxml-receivables-no-account",
"warn",
null,
jobline.id,
null
);
throw new Error(
`A matching account does not exist for the part allocation. Center: ${jobline.profitcenter_part}`
);
@@ -309,7 +324,7 @@ const generateInvoiceQbxml = (
},
});
} else {
console.log("NO MAPA ACCOUNT FOUND!!");
//console.log("NO MAPA ACCOUNT FOUND!!");
}
}