Merge branch 'release/2021-10-29' into test
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -112,3 +112,4 @@ firebase/.env
|
|||||||
.elasticbeanstalk/*
|
.elasticbeanstalk/*
|
||||||
!.elasticbeanstalk/*.cfg.yml
|
!.elasticbeanstalk/*.cfg.yml
|
||||||
!.elasticbeanstalk/*.global.yml
|
!.elasticbeanstalk/*.global.yml
|
||||||
|
logs/oAuthClient-log.log
|
||||||
|
|||||||
@@ -535,6 +535,7 @@ export const GET_JOB_BY_PK = gql`
|
|||||||
unq_seq
|
unq_seq
|
||||||
line_ind
|
line_ind
|
||||||
line_desc
|
line_desc
|
||||||
|
line_ref
|
||||||
part_type
|
part_type
|
||||||
oem_partno
|
oem_partno
|
||||||
db_price
|
db_price
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ async function InsertVendorRecord(oauthClient, qbo_realmId, req, bill) {
|
|||||||
body: JSON.stringify(Vendor),
|
body: JSON.stringify(Vendor),
|
||||||
});
|
});
|
||||||
setNewRefreshToken(req.user.email, result);
|
setNewRefreshToken(req.user.email, result);
|
||||||
return result && result.Vendor;
|
return result && result.json && result.json.Vendor;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
|
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
|
||||||
error:
|
error:
|
||||||
@@ -180,9 +180,9 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
|
|||||||
DocNumber: bill.invoice_number,
|
DocNumber: bill.invoice_number,
|
||||||
...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}),
|
...(bill.job.class ? { ClassRef: { Id: classes[bill.job.class] } } : {}),
|
||||||
|
|
||||||
Memo: `RO ${bill.job.ro_number || ""} OWNER ${bill.job.ownr_fn || ""} ${
|
PrivateNote: `RO ${bill.job.ro_number || ""} OWNER ${
|
||||||
bill.job.ownr_ln || ""
|
bill.job.ownr_fn || ""
|
||||||
} ${bill.job.ownr_co_nm || ""}`,
|
} ${bill.job.ownr_ln || ""} ${bill.job.ownr_co_nm || ""}`,
|
||||||
Line: bill.billlines.map((il) =>
|
Line: bill.billlines.map((il) =>
|
||||||
generateBillLine(
|
generateBillLine(
|
||||||
il,
|
il,
|
||||||
@@ -211,7 +211,7 @@ async function InsertBill(oauthClient, qbo_realmId, req, bill, vendor) {
|
|||||||
body: JSON.stringify(billQbo),
|
body: JSON.stringify(billQbo),
|
||||||
});
|
});
|
||||||
setNewRefreshToken(req.user.email, result);
|
setNewRefreshToken(req.user.email, result);
|
||||||
return result && result.Bill;
|
return result && result.json && result.json.Bill;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
|
logger.log("qbo-payables-error", "DEBUG", req.user.email, bill.id, {
|
||||||
error:
|
error:
|
||||||
@@ -245,6 +245,8 @@ const generateBillLine = (
|
|||||||
costCenters
|
costCenters
|
||||||
) => {
|
) => {
|
||||||
const account = costCenters.find((c) => c.name === billLine.cost_center);
|
const account = costCenters.find((c) => c.name === billLine.cost_center);
|
||||||
|
|
||||||
|
console.log(account.accountname, accounts[account.accountname]);
|
||||||
return {
|
return {
|
||||||
DetailType: "AccountBasedExpenseLineDetail",
|
DetailType: "AccountBasedExpenseLineDetail",
|
||||||
|
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ async function InsertInvoice(
|
|||||||
body: JSON.stringify(invoiceObj),
|
body: JSON.stringify(invoiceObj),
|
||||||
});
|
});
|
||||||
setNewRefreshToken(req.user.email, result);
|
setNewRefreshToken(req.user.email, result);
|
||||||
return result && result.Invoice;
|
return result && result.json && result.json.Invoice;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("qbo-receivables-error", "DEBUG", req.user.email, job.id, {
|
logger.log("qbo-receivables-error", "DEBUG", req.user.email, job.id, {
|
||||||
error,
|
error,
|
||||||
|
|||||||
@@ -797,6 +797,7 @@ exports.GET_JOB_BY_PK = ` query GET_JOB_BY_PK($id: uuid!) {
|
|||||||
line_ind
|
line_ind
|
||||||
line_desc
|
line_desc
|
||||||
part_type
|
part_type
|
||||||
|
line_ref
|
||||||
oem_partno
|
oem_partno
|
||||||
db_price
|
db_price
|
||||||
act_price
|
act_price
|
||||||
|
|||||||
@@ -486,7 +486,9 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
||||||
.multiply(val.part_qty || 0)
|
.multiply(val.part_qty || 0)
|
||||||
.add(
|
.add(
|
||||||
val.prt_dsmk_m && val.prt_dsmk_m !== 0
|
val.prt_dsmk_m &&
|
||||||
|
val.prt_dsmk_m !== 0 &&
|
||||||
|
DiscountNotAlreadyCounted(val, job.joblines)
|
||||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||||
: Dinero({
|
: Dinero({
|
||||||
amount: Math.round(val.act_price * 100),
|
amount: Math.round(val.act_price * 100),
|
||||||
@@ -566,3 +568,9 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.default = Totals;
|
exports.default = Totals;
|
||||||
|
|
||||||
|
function DiscountNotAlreadyCounted(jobline, joblines) {
|
||||||
|
if (jobline.db_ref !== "900510") return true;
|
||||||
|
const ParentLine = joblines.find((j) => j.unq_seq === jobline.line_ref);
|
||||||
|
return ParentLine && !(ParentLine.prt_dsmk_m && ParentLine.prt_dsmk_m !== 0);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user