IO-1921 Add shipping to reconciliation.
This commit is contained in:
@@ -86,6 +86,7 @@ export default function JobBillsTotalComponent({
|
|||||||
|
|
||||||
const totalPartsSublet = Dinero(totals.parts.parts.total)
|
const totalPartsSublet = Dinero(totals.parts.parts.total)
|
||||||
.add(Dinero(totals.parts.sublets.total))
|
.add(Dinero(totals.parts.sublets.total))
|
||||||
|
.add(Dinero(totals.additional.shipping))
|
||||||
.add(Dinero(totals.additional.towing));
|
.add(Dinero(totals.additional.towing));
|
||||||
|
|
||||||
const discrepancy = totalPartsSublet.subtract(billTotals);
|
const discrepancy = totalPartsSublet.subtract(billTotals);
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export default function JobReconciliationModalComponent({ job, bills }) {
|
|||||||
(j.part_type !== null && j.part_type !== "PAE") ||
|
(j.part_type !== null && j.part_type !== "PAE") ||
|
||||||
(j.line_desc &&
|
(j.line_desc &&
|
||||||
j.line_desc.toLowerCase().includes("towing") &&
|
j.line_desc.toLowerCase().includes("towing") &&
|
||||||
j.lbr_op === "OP13")
|
j.lbr_op === "OP13") ||
|
||||||
|
j.db_ref === "936004" //ADD SHIPPING LINE.
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
|
||||||
export const reconcileByAssocLine = (
|
export const reconcileByAssocLine = (
|
||||||
jobLines,
|
jobLines,
|
||||||
jobLineState,
|
jobLineState,
|
||||||
@@ -73,7 +74,12 @@ export const reconcileByPrice = (
|
|||||||
|
|
||||||
jobLines.forEach((jl) => {
|
jobLines.forEach((jl) => {
|
||||||
const matchingBillLineIds = billLines
|
const matchingBillLineIds = billLines
|
||||||
.filter((bl) => bl.actual_price === jl.act_price && bl.quantity === jl.part_qty && !jl.removed)
|
.filter(
|
||||||
|
(bl) =>
|
||||||
|
bl.actual_price === jl.act_price &&
|
||||||
|
bl.quantity === jl.part_qty &&
|
||||||
|
!jl.removed
|
||||||
|
)
|
||||||
.map((bl) => bl.id);
|
.map((bl) => bl.id);
|
||||||
|
|
||||||
if (matchingBillLineIds.length > 1) {
|
if (matchingBillLineIds.length > 1) {
|
||||||
|
|||||||
@@ -523,6 +523,7 @@ function CalculateAdditional(job) {
|
|||||||
additionalCostItems: [],
|
additionalCostItems: [],
|
||||||
adjustments: null,
|
adjustments: null,
|
||||||
towing: null,
|
towing: null,
|
||||||
|
shipping: Dinero(),
|
||||||
storage: null,
|
storage: null,
|
||||||
pvrt: null,
|
pvrt: null,
|
||||||
total: null,
|
total: null,
|
||||||
@@ -530,6 +531,7 @@ function CalculateAdditional(job) {
|
|||||||
ret.towing = Dinero({
|
ret.towing = Dinero({
|
||||||
amount: Math.round((job.towing_payable || 0) * 100),
|
amount: Math.round((job.towing_payable || 0) * 100),
|
||||||
});
|
});
|
||||||
|
|
||||||
ret.additionalCosts = job.joblines
|
ret.additionalCosts = job.joblines
|
||||||
.filter((jl) => !jl.removed && IsAdditionalCost(jl))
|
.filter((jl) => !jl.removed && IsAdditionalCost(jl))
|
||||||
.reduce((acc, val) => {
|
.reduce((acc, val) => {
|
||||||
@@ -537,6 +539,11 @@ function CalculateAdditional(job) {
|
|||||||
amount: Math.round((val.act_price || 0) * 100),
|
amount: Math.round((val.act_price || 0) * 100),
|
||||||
}).multiply(val.part_qty || 1);
|
}).multiply(val.part_qty || 1);
|
||||||
|
|
||||||
|
if (val.db_ref === "936004") {
|
||||||
|
//Shipping line IO-1921.
|
||||||
|
ret.shipping = ret.shipping.add(lineValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (val.line_desc.toLowerCase().includes("towing")) {
|
if (val.line_desc.toLowerCase().includes("towing")) {
|
||||||
ret.towing = lineValue;
|
ret.towing = lineValue;
|
||||||
return acc;
|
return acc;
|
||||||
|
|||||||
Reference in New Issue
Block a user