IO-972 Parts & Sublet screen helpers.

This commit is contained in:
Patrick Fic
2021-04-29 16:40:11 -07:00
parent 126067c9be
commit be5501f55c
6 changed files with 418 additions and 65 deletions

View File

@@ -1,4 +1,4 @@
import { Card, Space, Statistic } from "antd";
import { Card, Col, Row, Space, Statistic, Tooltip, Typography } from "antd";
import Dinero from "dinero.js";
import React from "react";
import { useTranslation } from "react-i18next";
@@ -50,7 +50,7 @@ export default function JobBillsTotalComponent({
} else {
billCms = billCms.add(
Dinero({
amount: Math.round((il.actual_price || 0) * -100),
amount: Math.round((il.actual_price || 0) * 100),
}).multiply(il.quantity)
);
}
@@ -73,64 +73,166 @@ export default function JobBillsTotalComponent({
const discrepWithLbrAdj = discrepancy.add(lbrAdjustments);
const discrepWithCms = discrepWithLbrAdj.subtract(billCms);
const discrepWithCms = discrepWithLbrAdj.add(billCms);
const creditsNotReceived = totalReturns.add(billCms); //billCms is tracked as a negative number.
return (
<Card title={t("jobs.labels.jobtotals")}>
<Space wrap size="large">
<Statistic
title={t("jobs.labels.rosaletotal")}
value={totalPartsSublet.toFormat()}
/>
<Statistic
title={t("bills.labels.retailtotal")}
value={billTotals.toFormat()}
/>
<Statistic
title={t("bills.labels.discrepancy")}
valueStyle={{
color: discrepancy.getAmount() === 0 ? "green" : "red",
}}
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()}
/>
<Statistic
title={t("bills.labels.totalreturns")}
value={totalReturns.toFormat()}
/>
<Statistic
title={t("bills.labels.creditsreceived")}
value={billCms.toFormat()}
/>
<Statistic
title={t("bills.labels.creditsnotreceived")}
valueStyle={{
color: creditsNotReceived.getAmount() === 0 ? "green" : "red",
}}
value={creditsNotReceived.toFormat()}
/>
</Space>
</Card>
<Row gutter={16}>
<Col span={18}>
<Card title={t("jobs.labels.jobtotals")} style={{ height: "100%" }}>
<Space wrap size="large">
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.partstotal"),
}}
/>
}
>
<Statistic
title={t("jobs.labels.rosaletotal")}
value={totalPartsSublet.toFormat()}
/>
</Tooltip>
<Typography.Title>-</Typography.Title>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.billtotal"),
}}
/>
}
>
<Statistic
title={t("bills.labels.retailtotal")}
value={billTotals.toFormat()}
/>
</Tooltip>
<Typography.Title>=</Typography.Title>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.discrep1"),
}}
/>
}
>
<Statistic
title={t("bills.labels.discrepancy")}
valueStyle={{
color: discrepancy.getAmount() === 0 ? "green" : "red",
}}
value={discrepancy.toFormat()}
/>
</Tooltip>
<Typography.Title>+</Typography.Title>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.laboradj"),
}}
/>
}
>
<Statistic
title={t("bills.labels.dedfromlbr")}
value={lbrAdjustments.toFormat()}
/>
</Tooltip>
<Typography.Title>=</Typography.Title>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.discrep2"),
}}
/>
}
>
<Statistic
title={t("bills.labels.discrepancy")}
valueStyle={{
color: discrepWithLbrAdj.getAmount() === 0 ? "green" : "red",
}}
value={discrepWithLbrAdj.toFormat()}
/>
</Tooltip>
<Typography.Title>+</Typography.Title>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.creditmemos"),
}}
/>
}
>
<Statistic
title={t("bills.labels.billcmtotal")}
value={billCms.toFormat()}
/>
</Tooltip>
<Typography.Title>=</Typography.Title>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.discrep3"),
}}
/>
}
>
<Statistic
title={t("bills.labels.discrepancy")}
valueStyle={{
color: discrepWithCms.getAmount() === 0 ? "green" : "red",
}}
value={discrepWithCms.toFormat()}
/>
</Tooltip>
</Space>
</Card>
</Col>
<Col span={6}>
<Card title={t("jobs.labels.returntotals")} style={{ height: "100%" }}>
<Space wrap>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.totalreturns"),
}}
/>
}
>
<Statistic
title={t("bills.labels.totalreturns")}
value={totalReturns.toFormat()}
/>
</Tooltip>
<Tooltip
title={
<div
dangerouslySetInnerHTML={{
__html: t("jobs.labels.plitooltips.creditsnotreceived"),
}}
/>
}
>
<Statistic
title={t("bills.labels.creditsnotreceived")}
valueStyle={{
color: creditsNotReceived.getAmount() === 0 ? "green" : "red",
}}
value={creditsNotReceived.toFormat()}
/>
</Tooltip>
</Space>
</Card>
</Col>
</Row>
);
}

View File

@@ -319,7 +319,7 @@ export function JobsDetailRatesParts({
);
}}
</Form.Item>
</LayoutFormRow>{" "}
</LayoutFormRow>
<LayoutFormRow header={t("joblines.fields.part_types.PAO")}>
<Form.Item
label={t("jobs.fields.parts_tax_rates.prt_discp")}
@@ -369,7 +369,7 @@ export function JobsDetailRatesParts({
);
}}
</Form.Item>
</LayoutFormRow>{" "}
</LayoutFormRow>
<LayoutFormRow header={t("joblines.fields.part_types.PAP")}>
<Form.Item
label={t("jobs.fields.parts_tax_rates.prt_discp")}