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