Improved bill totals reconciliation IO-583
This commit is contained in:
@@ -1971,6 +1971,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>billcmtotal</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>bills</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -1992,6 +2013,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>dedfromlbr</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>discrepancy</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -2013,6 +2055,48 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>discrepwithcms</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>discrepwithlbradj</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>entered_total</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -18328,6 +18412,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>rosaletotal</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>sale_labor</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -21964,6 +22069,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>return</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>status</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -74,6 +74,7 @@ function BillEnterModalContainer({
|
||||
}
|
||||
return {
|
||||
...restI,
|
||||
deductedfromlbr: deductfromlabor,
|
||||
joblineid: i.joblineid === "noline" ? null : i.joblineid,
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -17,16 +17,33 @@ export default function JobBillsTotalComponent({ loading, bills, jobTotals }) {
|
||||
|
||||
const totals = jobTotals;
|
||||
|
||||
let billTotals = Dinero({ amount: 0 });
|
||||
let billTotals = Dinero();
|
||||
let billCms = Dinero();
|
||||
let lbrAdjustments = Dinero();
|
||||
|
||||
bills.forEach((i) =>
|
||||
i.billlines.forEach((il) => {
|
||||
billTotals = billTotals.add(
|
||||
Dinero({
|
||||
amount: Math.round(
|
||||
(il.actual_cost || 0) * (i.is_credit_memo ? -1 : 1) * 100
|
||||
),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
if (!i.is_credit_memo) {
|
||||
billTotals = billTotals.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
} else {
|
||||
billCms = billCms.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * -100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
}
|
||||
if (il.deductedfromlbr) {
|
||||
console.log(i, "Deducting from labor.");
|
||||
lbrAdjustments = lbrAdjustments.add(
|
||||
Dinero({
|
||||
amount: Math.round((il.actual_price || 0) * 100),
|
||||
}).multiply(il.quantity)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -35,10 +52,13 @@ export default function JobBillsTotalComponent({ loading, bills, jobTotals }) {
|
||||
);
|
||||
const discrepancy = totalPartsSublet.subtract(billTotals);
|
||||
|
||||
const discrepWithLbrAdj = discrepancy.add(lbrAdjustments);
|
||||
|
||||
const discrepWithCms = discrepWithLbrAdj.subtract(billCms);
|
||||
return (
|
||||
<div className="job-bills-totals-container">
|
||||
<Statistic
|
||||
title={t("jobs.labels.partstotal")}
|
||||
title={t("jobs.labels.rosaletotal")}
|
||||
value={totalPartsSublet.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
@@ -52,6 +72,28 @@ export default function JobBillsTotalComponent({ loading, bills, jobTotals }) {
|
||||
}}
|
||||
value={discrepancy.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("bills.labels.dedfromlbr")}
|
||||
value={lbrAdjustments.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepwithlbradj")}
|
||||
valueStyle={{
|
||||
color: discrepWithLbrAdj.getAmount === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrepWithLbrAdj.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("bills.labels.billcmtotal")}
|
||||
value={billCms.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("bills.labels.discrepwithcms")}
|
||||
valueStyle={{
|
||||
color: discrepWithCms.getAmount === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrepWithCms.toFormat()}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MailFilled, PrinterFilled, SyncOutlined } from "@ant-design/icons";
|
||||
import { Button, Input, Space, Table, Typography } from "antd";
|
||||
import { Button, Checkbox, Input, Space, Table, Typography } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -76,6 +76,15 @@ export function PartsOrderListTableComponent({
|
||||
<DateFormatter>{record.order_date}</DateFormatter>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("parts_orders.fields.return"),
|
||||
dataIndex: "return",
|
||||
key: "return",
|
||||
sorter: (a, b) => a.return - b.return,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "return" && state.sortedInfo.order,
|
||||
render: (text, record) => <Checkbox checked={record.return} />,
|
||||
},
|
||||
{
|
||||
title: t("parts_orders.fields.deliver_by"),
|
||||
dataIndex: "deliver_by",
|
||||
@@ -104,11 +113,13 @@ export function PartsOrderListTableComponent({
|
||||
job: job,
|
||||
bill: {
|
||||
vendorid: record.vendor.id,
|
||||
is_credit_memo: record.return,
|
||||
billlines: record.parts_order_lines.map((pol) => {
|
||||
return {
|
||||
joblineid: pol.job_line_id,
|
||||
line_desc: pol.line_desc,
|
||||
quantity: pol.quantity,
|
||||
|
||||
actual_price: pol.act_price,
|
||||
cost_center: pol.jobline.part_type
|
||||
? responsibilityCenters.defaults.costs[
|
||||
|
||||
@@ -82,6 +82,7 @@ export function PartsOrderModalContainer({
|
||||
...values,
|
||||
jobid: jobId,
|
||||
user_email: currentUser.email,
|
||||
return: isReturn,
|
||||
status: bodyshop.md_order_statuses.default_ordered || "Ordered*",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -70,6 +70,7 @@ export const QUERY_BILLS_BY_JOBID = gql`
|
||||
}
|
||||
order_date
|
||||
deliver_by
|
||||
return
|
||||
parts_order_lines {
|
||||
id
|
||||
act_price
|
||||
@@ -114,6 +115,7 @@ export const QUERY_BILLS_BY_JOBID = gql`
|
||||
joblineid
|
||||
line_desc
|
||||
applicable_taxes
|
||||
deductedfromlbr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,8 +137,12 @@
|
||||
"actions": "Actions",
|
||||
"bill_lines": "Bill Lines",
|
||||
"bill_total": "Bill Total Amount",
|
||||
"billcmtotal": "Retail Total of Credit Memos",
|
||||
"bills": "Bills",
|
||||
"dedfromlbr": "Deducted from Labor",
|
||||
"discrepancy": "Discrepancy",
|
||||
"discrepwithcms": "Discrepancy including Credit Memos",
|
||||
"discrepwithlbradj": "Discrepancy including Lbr. Adj.",
|
||||
"entered_total": "Total of Entered Lines",
|
||||
"enteringcreditmemo": "You are entering a credit memo. Please ensure you are also entering positive values.",
|
||||
"federal_tax": "Federal Tax",
|
||||
@@ -1115,6 +1119,7 @@
|
||||
"multiplebillsforactprice": "Found more than 1 bill matching ${{act_price}} retail price."
|
||||
},
|
||||
"reconciliationheader": "Parts & Sublet Reconciliation",
|
||||
"rosaletotal": "Total RO Sale",
|
||||
"sale_labor": "Sales - Labor",
|
||||
"sale_parts": "Sales - Parts",
|
||||
"sales": "Sales",
|
||||
@@ -1341,6 +1346,7 @@
|
||||
"order_date": "Order Date",
|
||||
"order_number": "Order Number",
|
||||
"quantity": "Qty.",
|
||||
"return": "Return",
|
||||
"status": "Status"
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -137,8 +137,12 @@
|
||||
"actions": "",
|
||||
"bill_lines": "",
|
||||
"bill_total": "",
|
||||
"billcmtotal": "",
|
||||
"bills": "",
|
||||
"dedfromlbr": "",
|
||||
"discrepancy": "",
|
||||
"discrepwithcms": "",
|
||||
"discrepwithlbradj": "",
|
||||
"entered_total": "",
|
||||
"enteringcreditmemo": "",
|
||||
"federal_tax": "",
|
||||
@@ -1115,6 +1119,7 @@
|
||||
"multiplebillsforactprice": ""
|
||||
},
|
||||
"reconciliationheader": "",
|
||||
"rosaletotal": "",
|
||||
"sale_labor": "",
|
||||
"sale_parts": "",
|
||||
"sales": "",
|
||||
@@ -1341,6 +1346,7 @@
|
||||
"order_date": "",
|
||||
"order_number": "",
|
||||
"quantity": "",
|
||||
"return": "",
|
||||
"status": ""
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -137,8 +137,12 @@
|
||||
"actions": "",
|
||||
"bill_lines": "",
|
||||
"bill_total": "",
|
||||
"billcmtotal": "",
|
||||
"bills": "",
|
||||
"dedfromlbr": "",
|
||||
"discrepancy": "",
|
||||
"discrepwithcms": "",
|
||||
"discrepwithlbradj": "",
|
||||
"entered_total": "",
|
||||
"enteringcreditmemo": "",
|
||||
"federal_tax": "",
|
||||
@@ -1115,6 +1119,7 @@
|
||||
"multiplebillsforactprice": ""
|
||||
},
|
||||
"reconciliationheader": "",
|
||||
"rosaletotal": "",
|
||||
"sale_labor": "",
|
||||
"sale_parts": "",
|
||||
"sales": "",
|
||||
@@ -1341,6 +1346,7 @@
|
||||
"order_date": "",
|
||||
"order_number": "",
|
||||
"quantity": "",
|
||||
"return": "",
|
||||
"status": ""
|
||||
},
|
||||
"labels": {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."billlines" DROP COLUMN "deductedfromlbr";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."billlines" ADD COLUMN "deductedfromlbr" boolean NOT
|
||||
NULL DEFAULT false;
|
||||
type: run_sql
|
||||
@@ -0,0 +1,37 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
- args:
|
||||
permission:
|
||||
check:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- cost_center
|
||||
- created_at
|
||||
- id
|
||||
- billid
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,38 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
- args:
|
||||
permission:
|
||||
check:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,38 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- cost_center
|
||||
- created_at
|
||||
- id
|
||||
- billid
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
computed_fields: []
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,39 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
computed_fields: []
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,37 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- cost_center
|
||||
- created_at
|
||||
- id
|
||||
- billid
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,38 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
- updated_at
|
||||
filter:
|
||||
bill:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: billlines
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -385,10 +385,11 @@ tables:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- billid
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
@@ -400,10 +401,11 @@ tables:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- billid
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
@@ -426,10 +428,11 @@ tables:
|
||||
- actual_cost
|
||||
- actual_price
|
||||
- applicable_taxes
|
||||
- billid
|
||||
- cost_center
|
||||
- created_at
|
||||
- deductedfromlbr
|
||||
- id
|
||||
- billid
|
||||
- joblineid
|
||||
- line_desc
|
||||
- quantity
|
||||
|
||||
Reference in New Issue
Block a user