Remove adjustments from totals calculations BOD-390.

This commit is contained in:
Patrick Fic
2020-09-24 11:19:17 -07:00
parent 3f446b7525
commit 765df769b4
5 changed files with 29 additions and 17 deletions

View File

@@ -202,8 +202,6 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
</td> </td>
<td>{`(${Dinero( <td>{`(${Dinero(
job.job_totals.parts.parts.subtotal job.job_totals.parts.parts.subtotal
).toFormat()} ± ${Dinero(
job.job_totals.parts.parts.adjustments
).toFormat()})`}</td> ).toFormat()})`}</td>
</tr> </tr>
<tr> <tr>
@@ -213,8 +211,6 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
</td> </td>
<td>{`(${Dinero( <td>{`(${Dinero(
job.job_totals.parts.sublets.subtotal job.job_totals.parts.sublets.subtotal
).toFormat()} ± ${Dinero(
job.job_totals.parts.sublets.adjustments
).toFormat()})`}</td> ).toFormat()})`}</td>
</tr> </tr>
<tr> <tr>
@@ -296,7 +292,10 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
</div> </div>
<JobCalculateTotals job={job} /> <JobCalculateTotals job={job} />
<Editor <Editor
value={{ CIECA: job.cieca_ttl.data, ImEXCalc: job.job_totals }} value={{
CIECA: job.cieca_ttl && job.cieca_ttl.data,
ImEXCalc: job.job_totals,
}}
/> />
</div> </div>
</Col> </Col>

View File

@@ -19,8 +19,6 @@ export default function JobsCloseTotals({ jobTotals }) {
value={Dinero(jobTotals.parts.parts.total).toFormat()} value={Dinero(jobTotals.parts.parts.total).toFormat()}
suffix={`(${Dinero( suffix={`(${Dinero(
jobTotals.parts.parts.subtotal jobTotals.parts.parts.subtotal
).toFormat()} ± ${Dinero(
jobTotals.parts.parts.adjustments
).toFormat()})`} ).toFormat()})`}
/> />
</Descriptions.Item> </Descriptions.Item>
@@ -29,8 +27,6 @@ export default function JobsCloseTotals({ jobTotals }) {
value={Dinero(jobTotals.parts.sublets.total).toFormat()} value={Dinero(jobTotals.parts.sublets.total).toFormat()}
suffix={`(${Dinero( suffix={`(${Dinero(
jobTotals.parts.sublets.subtotal jobTotals.parts.sublets.subtotal
).toFormat()} ± ${Dinero(
jobTotals.parts.sublets.adjustments
).toFormat()})`} ).toFormat()})`}
/> />
</Descriptions.Item> </Descriptions.Item>

View File

@@ -1,4 +1,4 @@
import { Form, Select } from "antd"; import { Form, InputNumber, Select } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import CurrencyInput from "../form-items-formatted/currency-form-item.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component";
@@ -119,6 +119,24 @@ export default function JobsDetailRates({ job, form }) {
<Form.Item label={t("jobs.fields.rate_matd")} name="rate_matd"> <Form.Item label={t("jobs.fields.rate_matd")} name="rate_matd">
<CurrencyInput /> <CurrencyInput />
</Form.Item> </Form.Item>
<Form.Item
label={t("jobs.fields.federal_tax_rate")}
name="federal_tax_rate"
>
<InputNumber min={0} max={1} precision={2} />
</Form.Item>
<Form.Item
label={t("jobs.fields.state_tax_rate")}
name="state_tax_rate"
>
<InputNumber min={0} max={1} precision={2} />
</Form.Item>
<Form.Item
label={t("jobs.fields.local_tax_rate")}
name="local_tax_rate"
>
<InputNumber min={0} max={1} precision={2} />
</Form.Item>
</FormRow> </FormRow>
</div> </div>
); );

View File

@@ -437,6 +437,9 @@ export const GET_JOB_BY_PK = gql`
rate_mash rate_mash
rate_matd rate_matd
actual_in actual_in
federal_tax_rate
local_tax_rate
state_tax_rate
scheduled_completion scheduled_completion
scheduled_in scheduled_in
actual_completion actual_completion

View File

@@ -62,7 +62,7 @@ function CalculateTaxesTotals(job, otherTotals) {
const statePartsTax = job.joblines const statePartsTax = job.joblines
.filter((jl) => !jl.removed) .filter((jl) => !jl.removed)
.reduce((acc, val) => { .reduce((acc, val) => {
if (!!!val.tax_part) return acc; if (!!!val.tax_part || !!!val.part_type) return acc;
// if (!!job.parts_tax_rates[val.part_type]) { // if (!!job.parts_tax_rates[val.part_type]) {
// console.log("val.line_desc", val.line_desc); // console.log("val.line_desc", val.line_desc);
@@ -259,7 +259,6 @@ function CalculatePartsTotals(jobLines) {
subtotal: acc.sublets.subtotal.add( subtotal: acc.sublets.subtotal.add(
Dinero({ amount: Math.round(value.act_price * 100) }) Dinero({ amount: Math.round(value.act_price * 100) })
), ),
//TODO Add Adjustments in
}, },
}; };
@@ -292,7 +291,6 @@ function CalculatePartsTotals(jobLines) {
amount: Math.round(value.act_price * 100), amount: Math.round(value.act_price * 100),
}).multiply(value.part_qty) }).multiply(value.part_qty)
), ),
//TODO Add Adjustments in
}, },
}; };
// default: // default:
@@ -303,12 +301,10 @@ function CalculatePartsTotals(jobLines) {
parts: { parts: {
list: {}, list: {},
subtotal: Dinero({ amount: 0 }), subtotal: Dinero({ amount: 0 }),
adjustments: Dinero({ amount: 0 }),
total: Dinero({ amount: 0 }), total: Dinero({ amount: 0 }),
}, },
sublets: { sublets: {
subtotal: Dinero({ amount: 0 }), subtotal: Dinero({ amount: 0 }),
adjustments: Dinero({ amount: 0 }),
total: Dinero({ amount: 0 }), total: Dinero({ amount: 0 }),
}, },
} }
@@ -317,11 +313,11 @@ function CalculatePartsTotals(jobLines) {
return { return {
parts: { parts: {
...ret.parts, ...ret.parts,
total: ret.parts.subtotal, //+ ret.parts.adjustments total: ret.parts.subtotal,
}, },
sublets: { sublets: {
...ret.sublets, ...ret.sublets,
total: ret.sublets.subtotal, // + ret.sublets.adjustments, total: ret.sublets.subtotal,
}, },
}; };
} }