IO-854 Costing Totals adjustments [ci-ignore]
This commit is contained in:
@@ -77,6 +77,7 @@ export default function JobCostingPartsTable({ data, summaryData }) {
|
|||||||
.includes(searchText.toLowerCase())
|
.includes(searchText.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("data :>> ", data);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table
|
<Table
|
||||||
@@ -98,7 +99,7 @@ export default function JobCostingPartsTable({ data, summaryData }) {
|
|||||||
x: "50%", //y: "40rem"
|
x: "50%", //y: "40rem"
|
||||||
}}
|
}}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
pagination={{ position: "top", defaultPageSize: 25 }}
|
pagination={{ position: "top", defaultPageSize: 50 }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={filteredData}
|
dataSource={filteredData}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ async function JobCostingMulti(req, res) {
|
|||||||
function GenerateCostingData(job) {
|
function GenerateCostingData(job) {
|
||||||
const defaultProfits =
|
const defaultProfits =
|
||||||
job.bodyshop.md_responsibility_centers.defaults.profits;
|
job.bodyshop.md_responsibility_centers.defaults.profits;
|
||||||
const allProfitCenters = _.union(
|
const allCenters = _.union(
|
||||||
job.bodyshop.md_responsibility_centers.profits.map((p) => p.name),
|
job.bodyshop.md_responsibility_centers.profits.map((p) => p.name),
|
||||||
job.bodyshop.md_responsibility_centers.costs.map((p) => p.name)
|
job.bodyshop.md_responsibility_centers.costs.map((p) => p.name)
|
||||||
);
|
);
|
||||||
@@ -359,7 +359,7 @@ function GenerateCostingData(job) {
|
|||||||
gppercentFormatted: null,
|
gppercentFormatted: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const costCenterData = allProfitCenters.map((key, idx) => {
|
const costCenterData = allCenters.map((key, idx) => {
|
||||||
const ccVal = key; // defaultProfits[key];
|
const ccVal = key; // defaultProfits[key];
|
||||||
const sale_labor =
|
const sale_labor =
|
||||||
jobLineTotalsByProfitCenter.labor[ccVal] || Dinero({ amount: 0 });
|
jobLineTotalsByProfitCenter.labor[ccVal] || Dinero({ amount: 0 });
|
||||||
@@ -410,6 +410,34 @@ function GenerateCostingData(job) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Push adjustments to bottom line.
|
||||||
|
if (job.adjustment_bottom_line) {
|
||||||
|
//Add to totals.
|
||||||
|
const Adjustment = Dinero({ amount: job.adjustment_bottom_line * -100 }); //Need to invert, since this is being assigned as a cost.
|
||||||
|
summaryData.totalLaborCost = summaryData.totalLaborCost.add(Adjustment);
|
||||||
|
summaryData.totalCost = summaryData.totalCost.add(Adjustment);
|
||||||
|
//Add to lines.
|
||||||
|
costCenterData.push({
|
||||||
|
id: "Adj",
|
||||||
|
cost_center: "Adjustment",
|
||||||
|
sale_labor: Dinero().toFormat(),
|
||||||
|
sale_labor_dinero: Dinero(),
|
||||||
|
sale_parts: Dinero().toFormat(),
|
||||||
|
sale_parts_dinero: Dinero(),
|
||||||
|
sales: Dinero().toFormat(),
|
||||||
|
sales_dinero: Dinero(),
|
||||||
|
cost_parts: Dinero().toFormat(),
|
||||||
|
cost_parts_dinero: Dinero(),
|
||||||
|
cost_labor: Adjustment.toFormat(),
|
||||||
|
cost_labor_dinero: Adjustment,
|
||||||
|
costs: Adjustment.toFormat(),
|
||||||
|
costs_dinero: Adjustment,
|
||||||
|
gpdollars_dinero: Dinero(),
|
||||||
|
gpdollars: Dinero().toFormat(),
|
||||||
|
gppercent: formatGpPercent(0),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//Final summary data massaging.
|
//Final summary data massaging.
|
||||||
summaryData.gpdollars = summaryData.totalSales.subtract(
|
summaryData.gpdollars = summaryData.totalSales.subtract(
|
||||||
summaryData.totalCost
|
summaryData.totalCost
|
||||||
|
|||||||
Reference in New Issue
Block a user