Fixed bugs on parts allocations + added totals BOD-131

This commit is contained in:
Patrick Fic
2020-05-20 10:03:03 -07:00
parent 94777bf661
commit 0dbacf0b9e
8 changed files with 118 additions and 32 deletions

View File

@@ -0,0 +1,60 @@
import { Descriptions, Statistic } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
export default function JobsCloseTotals({
jobTotals,
labMatTotal,
partsTotal,
}) {
const { t } = useTranslation();
return (
<div>
<Descriptions
bordered
size="small"
//column={1}
title={t("jobs.labels.totals")}
>
<Descriptions.Item label={t("jobs.labels.partstotal")}>
<Statistic
value={jobTotals.parts.parts.total.toFormat()}
suffix={`(${jobTotals.parts.parts.subtotal.toFormat()} ± ${jobTotals.parts.parts.adjustments.toFormat()})`}
/>
</Descriptions.Item>
<Descriptions.Item label={t("jobs.labels.subletstotal")}>
<Statistic
value={jobTotals.parts.sublets.total.toFormat()}
suffix={`(${jobTotals.parts.sublets.subtotal.toFormat()} ± ${jobTotals.parts.sublets.adjustments.toFormat()})`}
/>
</Descriptions.Item>
<Descriptions.Item label={t("jobs.labels.subtotal")}>
<Statistic value={jobTotals.totals.subtotal.toFormat()} />
</Descriptions.Item>
<Descriptions.Item label={t("jobs.labels.federal_tax_amt")}>
<Statistic value={jobTotals.totals.federal_tax.toFormat()} />
</Descriptions.Item>
<Descriptions.Item label={t("jobs.labels.state_tax_amt")}>
<Statistic value={jobTotals.totals.state_tax.toFormat()} />
</Descriptions.Item>
<Descriptions.Item label={t("jobs.labels.local_tax_amt")}>
<Statistic value={jobTotals.totals.local_tax.toFormat()} />
</Descriptions.Item>
</Descriptions>
<Statistic
title={t("jobs.labels.total_repairs")}
value={jobTotals.totals.total_repairs.toFormat()}
/>
<Statistic
title={t("jobs.labels.net_repairs")}
value={jobTotals.totals.net_repairs.toFormat()}
/>
<Statistic
title={t("jobs.labels.suspense")}
value={jobTotals.totals.subtotal
.subtract(labMatTotal)
.subtract(partsTotal)
.toFormat()}
/>
</div>
);
}