IO-256 First succesful basic post of receivables.
This commit is contained in:
@@ -68,13 +68,12 @@ module.exports = function ({
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: "true",
|
||||
federal: true,
|
||||
state: jobline.tax_part,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
|
||||
//GST/PST BC is what comes in, need to find the tax rate reference.
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
if (!invoiceLineHash[account.name]) invoiceLineHash[account.name] = {};
|
||||
if (!invoiceLineHash[account.name][QboTaxId]) {
|
||||
@@ -131,7 +130,36 @@ module.exports = function ({
|
||||
);
|
||||
}
|
||||
if (qbo) {
|
||||
//Do some QBO Stuff.
|
||||
//Going to always assume that we need to apply GST and PST for labor.
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: true,
|
||||
state: true,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
if (!invoiceLineHash[account.name]) invoiceLineHash[account.name] = {};
|
||||
if (!invoiceLineHash[account.name][QboTaxId]) {
|
||||
invoiceLineHash[account.name][QboTaxId] = {
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: DineroAmount,
|
||||
SalesItemLineDetail: {
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
Qty: 1,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
invoiceLineHash[account.name][QboTaxId].Amount =
|
||||
invoiceLineHash[account.name][QboTaxId].Amount.add(DineroAmount);
|
||||
}
|
||||
} else {
|
||||
if (!invoiceLineHash[account.name]) {
|
||||
invoiceLineHash[account.name] = {
|
||||
@@ -163,6 +191,41 @@ module.exports = function ({
|
||||
if (mapaAccount) {
|
||||
if (qbo) {
|
||||
//Add QBO MAPA
|
||||
|
||||
//Going to always assume that we need to apply GST and PST for labor.
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: true,
|
||||
state: true,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
if (!invoiceLineHash[mapaAccount.name])
|
||||
invoiceLineHash[mapaAccount.name] = {};
|
||||
if (!invoiceLineHash[mapaAccount.name][QboTaxId]) {
|
||||
invoiceLineHash[mapaAccount.name][QboTaxId] = {
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: Dinero(jobs_by_pk.job_totals.rates.mapa.total),
|
||||
SalesItemLineDetail: {
|
||||
ItemRef: {
|
||||
value: items[mapaAccount.accountitem],
|
||||
},
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
Qty: 1,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
invoiceLineHash[mapaAccount.name][QboTaxId].Amount = invoiceLineHash[
|
||||
mapaAccount.name
|
||||
][QboTaxId].Amount.add(
|
||||
Dinero(jobs_by_pk.job_totals.rates.mapa.total)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
InvoiceLineAdd.push({
|
||||
ItemRef: { FullName: mapaAccount.accountitem },
|
||||
@@ -192,7 +255,40 @@ module.exports = function ({
|
||||
|
||||
if (mashAccount) {
|
||||
if (qbo) {
|
||||
//do some QBO
|
||||
//Going to always assume that we need to apply GST and PST for labor.
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: true,
|
||||
state: true,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
if (!invoiceLineHash[mashAccount.name])
|
||||
invoiceLineHash[mashAccount.name] = {};
|
||||
if (!invoiceLineHash[mashAccount.name][QboTaxId]) {
|
||||
invoiceLineHash[mashAccount.name][QboTaxId] = {
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: Dinero(jobs_by_pk.job_totals.rates.mash.total),
|
||||
SalesItemLineDetail: {
|
||||
ItemRef: {
|
||||
value: items[mashAccount.accountitem],
|
||||
},
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
Qty: 1,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
invoiceLineHash[mashAccount.name][QboTaxId].Amount = invoiceLineHash[
|
||||
mashAccount.name
|
||||
][QboTaxId].Amount.add(
|
||||
Dinero(jobs_by_pk.job_totals.rates.mash.total)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
InvoiceLineAdd.push({
|
||||
ItemRef: { FullName: mashAccount.accountitem },
|
||||
@@ -225,7 +321,34 @@ module.exports = function ({
|
||||
|
||||
if (jobs_by_pk.towing_payable && jobs_by_pk.towing_payable !== 0) {
|
||||
if (qbo) {
|
||||
// do qbo
|
||||
//Going to always assume that we need to apply GST and PST for labor.
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: true,
|
||||
state: true,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
const account = responsibilityCenters.profits.find(
|
||||
(c) => c.name === responsibilityCenters.defaults.profits["TOW"]
|
||||
);
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
InvoiceLineAdd.push({
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: Dinero({
|
||||
amount: Math.round((jobs_by_pk.towing_payable || 0) * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesItemLineDetail: {
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
Qty: 1,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
InvoiceLineAdd.push({
|
||||
ItemRef: {
|
||||
@@ -246,7 +369,34 @@ module.exports = function ({
|
||||
}
|
||||
if (jobs_by_pk.storage_payable && jobs_by_pk.storage_payable !== 0) {
|
||||
if (qbo) {
|
||||
// do qbo
|
||||
//Going to always assume that we need to apply GST and PST for labor.
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: true,
|
||||
state: true,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
const account = responsibilityCenters.profits.find(
|
||||
(c) => c.name === responsibilityCenters.defaults.profits["TOW"]
|
||||
);
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
InvoiceLineAdd.push({
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: Dinero({
|
||||
amount: Math.round((jobs_by_pk.storage_payable || 0) * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesItemLineDetail: {
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
Qty: 1,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
InvoiceLineAdd.push({
|
||||
ItemRef: {
|
||||
@@ -270,7 +420,34 @@ module.exports = function ({
|
||||
jobs_by_pk.adjustment_bottom_line !== 0
|
||||
) {
|
||||
if (qbo) {
|
||||
// do qbo
|
||||
//Going to always assume that we need to apply GST and PST for labor.
|
||||
const taxAccountCode = findTaxCode(
|
||||
{
|
||||
local: false,
|
||||
federal: true,
|
||||
state: true,
|
||||
},
|
||||
bodyshop.md_responsibility_centers.sales_tax_codes
|
||||
);
|
||||
const account = responsibilityCenters.profits.find(
|
||||
(c) => c.name === responsibilityCenters.defaults.profits["PAO"]
|
||||
);
|
||||
const QboTaxId = taxCodes[taxAccountCode];
|
||||
InvoiceLineAdd.push({
|
||||
DetailType: "SalesItemLineDetail",
|
||||
Amount: Dinero({
|
||||
amount: Math.round((jobs_by_pk.adjustment_bottom_line || 0) * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesItemLineDetail: {
|
||||
ItemRef: {
|
||||
value: items[account.accountitem],
|
||||
},
|
||||
TaxCodeRef: {
|
||||
value: QboTaxId,
|
||||
},
|
||||
Qty: 1,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
InvoiceLineAdd.push({
|
||||
ItemRef: {
|
||||
|
||||
Reference in New Issue
Block a user