QB/O Exporting Adjustments

This commit is contained in:
Patrick Fic
2023-09-28 09:31:32 -07:00
parent 805149daea
commit 68b4bc66ff
4 changed files with 39 additions and 31 deletions

View File

@@ -393,7 +393,7 @@ exports.default = function ({
//Add Towing, storage and adjustment lines.
if (jobs_by_pk.towing_payable && jobs_by_pk.towing_payable !== 0) {
if (jobs_by_pk.job_totals.additional.towing.amount > 0) {
if (qbo) {
//Going to always assume that we need to apply GST and PST for labor.
const taxAccountCode = findTaxCode(
@@ -417,9 +417,9 @@ exports.default = function ({
: taxCodes[taxAccountCode];
InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail",
Amount: Dinero({
amount: Math.round((jobs_by_pk.towing_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(jobs_by_pk.job_totals.additional.towing).toFormat(
DineroQbFormat
),
SalesItemLineDetail: {
...(jobs_by_pk.class
? { ClassRef: { value: classes[jobs_by_pk.class] } }
@@ -442,9 +442,9 @@ exports.default = function ({
},
Desc: "Towing",
Quantity: 1,
Amount: Dinero({
amount: Math.round((jobs_by_pk.towing_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(jobs_by_pk.job_totals.additional.towing).toFormat(
DineroQbFormat
),
SalesTaxCodeRef: {
FullName:
bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON",
@@ -452,7 +452,7 @@ exports.default = function ({
});
}
}
if (jobs_by_pk.storage_payable && jobs_by_pk.storage_payable !== 0) {
if (jobs_by_pk.job_totals.additional.storage.amount > 0) {
if (qbo) {
//Going to always assume that we need to apply GST and PST for labor.
const taxAccountCode = findTaxCode(
@@ -476,9 +476,9 @@ exports.default = function ({
: taxCodes[taxAccountCode];
InvoiceLineAdd.push({
DetailType: "SalesItemLineDetail",
Amount: Dinero({
amount: Math.round((jobs_by_pk.storage_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(
jobs_by_pk.job_totals.additional.storage.amount
).toFormat(DineroQbFormat),
SalesItemLineDetail: {
...(jobs_by_pk.class
? { ClassRef: { value: classes[jobs_by_pk.class] } }
@@ -501,9 +501,9 @@ exports.default = function ({
},
Desc: "Storage",
Quantity: 1,
Amount: Dinero({
amount: Math.round((jobs_by_pk.storage_payable || 0) * 100),
}).toFormat(DineroQbFormat),
Amount: Dinero(
jobs_by_pk.job_totals.additional.storage.amount
).toFormat(DineroQbFormat),
SalesTaxCodeRef: {
FullName:
bodyshop.md_responsibility_centers.taxes.itemexemptcode || "NON",
@@ -586,6 +586,7 @@ exports.default = function ({
const taxAmount = Dinero(
job_totals.totals.us_sales_tax_breakdown[`ty${tyCounter}Tax`]
);
console.log(`Tax ${tyCounter}`, taxAmount.toFormat());
if (taxAmount.getAmount() > 0) {
if (qbo) {
InvoiceLineAdd.push({

View File

@@ -972,6 +972,8 @@ const getAdditionalCostCenter = (jl, profitCenters) => {
return profitCenters["ATS"];
} else if (lineDesc.includes("towing")) {
return profitCenters["TOW"];
} else if (jl.act_price > 0) {
ret.profitcenter_part = defaults.profits["PAO"];
} else {
return null;
}