Add department to QBO Payables.

This commit is contained in:
Patrick Fic
2022-05-03 09:51:54 -07:00
parent 4f6d1d27d5
commit 9b4e83705b
2 changed files with 1171 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -206,7 +206,14 @@ async function InsertVendorRecord(oauthClient, qbo_realmId, req, bill) {
} }
} }
async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop) { async function InsertBill(
oauthClient,
qbo_realmId,
req,
bill,
vendor,
bodyshop
) {
const { accounts, taxCodes, classes } = await QueryMetaData( const { accounts, taxCodes, classes } = await QueryMetaData(
oauthClient, oauthClient,
qbo_realmId, qbo_realmId,
@@ -243,8 +250,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop)
AccountRef: { AccountRef: {
value: value:
accounts[ accounts[
bodyshop.md_responsibility_centers.taxes.federal bodyshop.md_responsibility_centers.taxes.federal.accountdesc
.accountdesc
], ],
}, },
}, },
@@ -286,7 +292,10 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor, bodyshop)
) )
? { GlobalTaxCalculation: "TaxExcluded" } ? { GlobalTaxCalculation: "TaxExcluded" }
: {}), : {}),
...(bodyshop.accountingconfig.qbo_departmentid &&
bodyshop.accountingconfig.qbo_departmentid.trim() !== "" && {
DepartmentRef: { value: bodyshop.accountingconfig.qbo_departmentid },
}),
PrivateNote: `RO ${bill.job.ro_number || ""}`, PrivateNote: `RO ${bill.job.ro_number || ""}`,
Line: lines, Line: lines,
}; };