IO-1269
This commit is contained in:
@@ -7,7 +7,6 @@ var builder = require("xmlbuilder2");
|
||||
const QbXmlUtils = require("./qbxml-utils");
|
||||
const moment = require("moment");
|
||||
const logger = require("../../utils/logger");
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
process.cwd(),
|
||||
@@ -26,6 +25,13 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
|
||||
try {
|
||||
logger.log(
|
||||
"qbxml-payable-create",
|
||||
"DEBUG",
|
||||
req.user.email,
|
||||
req.body.billsToQuery
|
||||
);
|
||||
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QUERY_BILLS_FOR_PAYABLES_EXPORT, {
|
||||
@@ -43,15 +49,14 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
|
||||
//For each invoice.
|
||||
|
||||
res.status(200).json(QbXmlToExecute);
|
||||
} catch (error) {
|
||||
logger.log(
|
||||
"qbxml-payable-error",
|
||||
"error",
|
||||
req.body.user,
|
||||
"ERROR",
|
||||
req.user.email,
|
||||
req.body.billsToQuery,
|
||||
error
|
||||
{ error }
|
||||
);
|
||||
res.status(400).send(JSON.stringify(error));
|
||||
}
|
||||
@@ -119,13 +124,6 @@ const generateBillLine = (billLine, responsibilityCenters, jobClass) => {
|
||||
};
|
||||
};
|
||||
|
||||
// [
|
||||
// {
|
||||
// AccountRef: { FullName: "BODY SHOP COST:SUBLET" },
|
||||
// Amount: invoice.amount,
|
||||
// },
|
||||
// ],
|
||||
|
||||
const findTaxCode = (billLine, taxcode) => {
|
||||
const {
|
||||
applicable_taxes: { local, state, federal },
|
||||
|
||||
@@ -29,6 +29,14 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
|
||||
try {
|
||||
logger.log(
|
||||
"qbxml-payments-create",
|
||||
"DEBUG",
|
||||
req.user.email,
|
||||
req.body.paymentsToQuery,
|
||||
null
|
||||
);
|
||||
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QUERY_PAYMENTS_FOR_EXPORT, {
|
||||
@@ -85,7 +93,7 @@ exports.default = async (req, res) => {
|
||||
logger.log(
|
||||
"qbxml-payments-error",
|
||||
"error",
|
||||
req.body.user,
|
||||
req.user.email,
|
||||
req.body.paymentsToQuery,
|
||||
error
|
||||
);
|
||||
|
||||
@@ -29,6 +29,14 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
|
||||
try {
|
||||
logger.log(
|
||||
"qbxml-receivables-create",
|
||||
"DEBUG",
|
||||
req.user.email,
|
||||
req.body.jobIds,
|
||||
null
|
||||
);
|
||||
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QUERY_JOBS_FOR_RECEIVABLES_EXPORT, { ids: jobIds });
|
||||
@@ -96,9 +104,9 @@ exports.default = async (req, res) => {
|
||||
res.status(200).json(QbXmlToExecute);
|
||||
} catch (error) {
|
||||
logger.log(
|
||||
"qbxml-payments-error",
|
||||
"qbxml-receivables-error",
|
||||
"error",
|
||||
req.body.user,
|
||||
req.user.email,
|
||||
req.body.jobIds,
|
||||
error
|
||||
);
|
||||
@@ -304,7 +312,7 @@ const generateInvoiceQbxml = (
|
||||
// console.log("Done creating hash", JSON.stringify(invoiceLineHash));
|
||||
|
||||
if (!hasMapaLine && jobs_by_pk.job_totals.rates.mapa.total.amount > 0) {
|
||||
console.log("Adding MAPA Line Manually.");
|
||||
// console.log("Adding MAPA Line Manually.");
|
||||
const mapaAccountName = responsibilityCenters.defaults.profits.MAPA;
|
||||
|
||||
const mapaAccount = responsibilityCenters.profits.find(
|
||||
@@ -329,7 +337,7 @@ const generateInvoiceQbxml = (
|
||||
}
|
||||
|
||||
if (!hasMashLine && jobs_by_pk.job_totals.rates.mash.total.amount > 0) {
|
||||
console.log("Adding MASH Line Manually.");
|
||||
// console.log("Adding MASH Line Manually.");
|
||||
|
||||
const mashAccountName = responsibilityCenters.defaults.profits.MASH;
|
||||
|
||||
@@ -350,7 +358,7 @@ const generateInvoiceQbxml = (
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log("NO MASH ACCOUNT FOUND!!");
|
||||
// console.log("NO MASH ACCOUNT FOUND!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user