Refactored some Job Calculation Logic. IO-439

This commit is contained in:
Patrick Fic
2020-12-04 15:16:36 -08:00
parent db1e046130
commit 65a22922eb
9 changed files with 267 additions and 227 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "bodyshop",
"version": "0.1.1",
"version": "0.1.0001",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -4737,6 +4737,23 @@
"integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
"optional": true
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
},
"dependencies": {
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"optional": true
}
}
},
"block-stream": {
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
@@ -20508,6 +20525,7 @@
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
@@ -21049,6 +21067,7 @@
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},

View File

@@ -170,55 +170,12 @@ export function JobsTotalsTableComponent({ bodyshop, jobRO, job }) {
job.job_totals.rates.la4.rate
})`}</td>
</tr>
<tr>
<td>{t("jobs.labels.rates_subtotal")}</td>
<td>{Dinero(job.job_totals.rates.subtotal).toFormat()}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</Col>
<Col {...colSpan}>
<div className="job-totals-half">
<table>
<tbody>
{Object.keys(job.job_totals.parts.parts.list).map(
(key, idx) => (
<tr key={idx}>
<td>{t(`jobs.fields.${key.toLowerCase()}`)}</td>
<td className="currency">
{Dinero(
job.job_totals.parts.parts.list[key].total
).toFormat()}
</td>
<td></td>
</tr>
)
)}
<tr>
<td>{t("jobs.labels.partstotal")}</td>
<td>{t("jobs.labels.labor_rates_subtotal")}</td>
<td className="currency">
{Dinero(job.job_totals.parts.parts.total).toFormat()}
</td>
<td>{`(${Dinero(
job.job_totals.parts.parts.subtotal
).toFormat()})`}</td>
</tr>
<tr>
<td>{t("jobs.labels.subletstotal")}</td>
<td className="currency">
{Dinero(job.job_totals.parts.sublets.total).toFormat()}
</td>
<td>{`(${Dinero(
job.job_totals.parts.sublets.subtotal
).toFormat()})`}</td>
</tr>
<tr>
<td>{t("jobs.labels.additionaltotal")}</td>
<td className="currency">
{Dinero(job.job_totals.additional).toFormat()}
<strong>
{Dinero(job.job_totals.rates.rates_subtotal).toFormat()}
</strong>
</td>
<td></td>
</tr>
@@ -240,6 +197,60 @@ export function JobsTotalsTableComponent({ bodyshop, jobRO, job }) {
job.job_totals.rates.mash.rate
})`}</td>
</tr>
<tr>
<td>{t("jobs.labels.rates_subtotal")}</td>
<td className="currency">
<strong>
{Dinero(job.job_totals.rates.subtotal).toFormat()}
</strong>
</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</Col>
<Col {...colSpan}>
<div className="job-totals-half">
<Typography.Title level={4}>
{t("jobs.labels.partstotal")}
</Typography.Title>
<table>
<tbody>
{Object.keys(job.job_totals.parts.parts.list).map(
(key, idx) => (
<tr key={idx}>
<td>{t(`jobs.fields.${key.toLowerCase()}`)}</td>
<td className="currency">
{Dinero(
job.job_totals.parts.parts.list[key].total
).toFormat()}
</td>
</tr>
)
)}
<tr>
<td>{t("jobs.labels.partstotal")}</td>
<td className="currency">
<strong>
{Dinero(job.job_totals.parts.parts.total).toFormat()}
</strong>
</td>
</tr>
<tr>
<td>{t("jobs.labels.subletstotal")}</td>
<td className="currency">
{Dinero(job.job_totals.parts.sublets.total).toFormat()}
</td>
</tr>
<tr>
<td>{t("jobs.labels.additionaltotal")}</td>
<td className="currency">
{Dinero(job.job_totals.additional).toFormat()}
</td>
</tr>
</tbody>
</table>
<div
@@ -254,6 +265,10 @@ export function JobsTotalsTableComponent({ bodyshop, jobRO, job }) {
}
}}
>
<Statistic
title={t("jobs.labels.federal_tax_amt")}
value={Dinero(job.job_totals.totals.federal_tax).toFormat()}
/>
<Statistic
title={t("jobs.labels.state_tax_amt")}
value={Dinero(job.job_totals.totals.state_tax).toFormat()}
@@ -262,10 +277,6 @@ export function JobsTotalsTableComponent({ bodyshop, jobRO, job }) {
title={t("jobs.labels.local_tax_amt")}
value={Dinero(job.job_totals.totals.local_tax).toFormat()}
/>
<Statistic
title={t("jobs.labels.federal_tax_amt")}
value={Dinero(job.job_totals.totals.federal_tax).toFormat()}
/>
</div>
<div
className="job-totals-stats"

View File

@@ -491,6 +491,7 @@ export const GET_JOB_BY_PK = gql`
notes
location
tax_part
db_ref
parts_order_lines {
id
parts_order {

View File

@@ -752,6 +752,7 @@
"PAL": "LKQ",
"PAM": "Remanufactured",
"PAN": "New/OEM",
"PAO": "Other",
"PAR": "Recored",
"PAS": "Sublet",
"PASL": "Sublet"
@@ -1035,6 +1036,7 @@
"inproduction": "In Production",
"job": "Job Details",
"jobcosting": "Job Costing",
"labor_rates_subtotal": "Labor Rates Subtotal",
"laborallocations": "Labor Allocations",
"labortotals": "Labor Totals",
"lines": "Estimate Lines",
@@ -1049,7 +1051,7 @@
"partssubletstotal": "Parts & Sublets Total",
"partstotal": "Parts Total",
"rates": "Rates",
"rates_subtotal": "Rates Subtotal",
"rates_subtotal": "All Rates Subtotal",
"reconciliation": {
"billlinestotal": "Bill Lines Total",
"byassoc": "By Line Association",

View File

@@ -752,6 +752,7 @@
"PAL": "",
"PAM": "",
"PAN": "",
"PAO": "",
"PAR": "",
"PAS": "",
"PASL": ""
@@ -1035,6 +1036,7 @@
"inproduction": "",
"job": "",
"jobcosting": "",
"labor_rates_subtotal": "",
"laborallocations": "",
"labortotals": "",
"lines": "Líneas estimadas",

View File

@@ -752,6 +752,7 @@
"PAL": "",
"PAM": "",
"PAN": "",
"PAO": "",
"PAR": "",
"PAS": "",
"PASL": ""
@@ -1035,6 +1036,7 @@
"inproduction": "",
"job": "",
"jobcosting": "",
"labor_rates_subtotal": "",
"laborallocations": "",
"labortotals": "",
"lines": "Estimer les lignes",