Merged in feature/IO-2501-Add-Jobs-Completed-Delivered-Not-Invoiced-Section (pull request #1107)
IO-2501 Add Jobs Complete Not Invoiced Section to Stats Approved-by: Dave Richer
This commit is contained in:
@@ -29,7 +29,7 @@ export default connect(
|
|||||||
|
|
||||||
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const startDate = moment().startOf("month")
|
const startDate = moment().startOf("month");
|
||||||
const endDate = moment().endOf("month");
|
const endDate = moment().endOf("month");
|
||||||
|
|
||||||
const fixedPeriods = useMemo(() => {
|
const fixedPeriods = useMemo(() => {
|
||||||
@@ -84,6 +84,8 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
end: endDate.format("YYYY-MM-DD"),
|
end: endDate.format("YYYY-MM-DD"),
|
||||||
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
||||||
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
||||||
|
jobStart: startDate,
|
||||||
|
jobEnd: endDate,
|
||||||
},
|
},
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
@@ -340,11 +342,21 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
larData.push({ ...r, ...lar });
|
larData.push({ ...r, ...lar });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const jobData = {};
|
||||||
|
data.jobs.forEach((job) => {
|
||||||
|
job.tthrs = job.joblines.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
|
||||||
|
});
|
||||||
|
jobData.tthrs = data.jobs
|
||||||
|
.reduce((acc, val) => acc + val.tthrs, 0)
|
||||||
|
.toFixed(1);
|
||||||
|
jobData.count = data.jobs.length.toFixed(0);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fixed: ret,
|
fixed: ret,
|
||||||
combinedData: combinedData,
|
combinedData: combinedData,
|
||||||
labData: labData,
|
labData: labData,
|
||||||
larData: larData,
|
larData: larData,
|
||||||
|
jobData: jobData,
|
||||||
};
|
};
|
||||||
}, [fixedPeriods, data, bodyshop]);
|
}, [fixedPeriods, data, bodyshop]);
|
||||||
|
|
||||||
@@ -356,7 +368,10 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
<ScoreboardTimeticketsTargetsTable />
|
<ScoreboardTimeticketsTargetsTable />
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<ScoreboardTicketsStats data={calculatedData.fixed} />
|
<ScoreboardTicketsStats
|
||||||
|
data={calculatedData.fixed}
|
||||||
|
jobData={calculatedData.jobData}
|
||||||
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<ScoreboardTimeTicketsChart
|
<ScoreboardTimeTicketsChart
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function useLocalStorage(key, initialValue) {
|
|||||||
return [storedValue, setStoredValue];
|
return [storedValue, setStoredValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ScoreboardTicketsStats({ data, bodyshop }) {
|
export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [isLarge, setIsLarge] = useLocalStorage("isLargeStatistic", false);
|
const [isLarge, setIsLarge] = useLocalStorage("isLargeStatistic", false);
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
{/* Monthly Stats */}
|
{/* Monthly Stats */}
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
{/* This Month */}
|
{/* This Month */}
|
||||||
<Col span={8} align="center">
|
<Col span={7} align="center">
|
||||||
<Card size="small" title={t("scoreboard.labels.thismonth")}>
|
<Card size="small" title={t("scoreboard.labels.thismonth")}>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
@@ -482,7 +482,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
{/* Last Month */}
|
{/* Last Month */}
|
||||||
<Col span={8} align="center">
|
<Col span={7} align="center">
|
||||||
<Card size="small" title={t("scoreboard.labels.lastmonth")}>
|
<Card size="small" title={t("scoreboard.labels.lastmonth")}>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
@@ -556,7 +556,7 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
{/* Efficiency Over Period */}
|
{/* Efficiency Over Period */}
|
||||||
<Col span={8} align="center">
|
<Col span={7} align="center">
|
||||||
<Card
|
<Card
|
||||||
size="small"
|
size="small"
|
||||||
title={t("scoreboard.labels.efficiencyoverperiod")}
|
title={t("scoreboard.labels.efficiencyoverperiod")}
|
||||||
@@ -604,6 +604,40 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
|||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col span={3} align="center">
|
||||||
|
<Card
|
||||||
|
size="small"
|
||||||
|
title={t("scoreboard.labels.jobscompletednotinvoiced")}
|
||||||
|
>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={jobData.count}
|
||||||
|
valueStyle={{
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.totalhrs")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={jobData.tthrs}
|
||||||
|
valueStyle={{
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Space>
|
</Space>
|
||||||
{/* Disclaimer */}
|
{/* Disclaimer */}
|
||||||
|
|||||||
@@ -143,9 +143,14 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
$end: date!
|
$end: date!
|
||||||
$fixedStart: date!
|
$fixedStart: date!
|
||||||
$fixedEnd: date!
|
$fixedEnd: date!
|
||||||
|
$jobStart: timestamptz!
|
||||||
|
$jobEnd: timestamptz!
|
||||||
) {
|
) {
|
||||||
timetickets(
|
timetickets(
|
||||||
where: { date: { _gte: $start, _lte: $end }, cost_center: {_neq: "timetickets.labels.shift"} }
|
where: {
|
||||||
|
date: { _gte: $start, _lte: $end }
|
||||||
|
cost_center: { _neq: "timetickets.labels.shift" }
|
||||||
|
}
|
||||||
order_by: { date: desc_nulls_first }
|
order_by: { date: desc_nulls_first }
|
||||||
) {
|
) {
|
||||||
actualhrs
|
actualhrs
|
||||||
@@ -176,7 +181,10 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fixedperiod: timetickets(
|
fixedperiod: timetickets(
|
||||||
where: { date: { _gte: $fixedStart, _lte: $fixedEnd }, cost_center: {_neq: "timetickets.labels.shift"} }
|
where: {
|
||||||
|
date: { _gte: $fixedStart, _lte: $fixedEnd }
|
||||||
|
cost_center: { _neq: "timetickets.labels.shift" }
|
||||||
|
}
|
||||||
order_by: { date: desc_nulls_first }
|
order_by: { date: desc_nulls_first }
|
||||||
) {
|
) {
|
||||||
actualhrs
|
actualhrs
|
||||||
@@ -205,6 +213,25 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
last_name
|
last_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jobs(
|
||||||
|
where: {
|
||||||
|
date_invoiced: { _is_null: true }
|
||||||
|
ro_number: { _is_null: false }
|
||||||
|
voided: { _eq: false }
|
||||||
|
_or: [
|
||||||
|
{ actual_completion: { _gte: $jobStart, _lte: $jobEnd } }
|
||||||
|
{ actual_delivery: { _gte: $jobStart, _lte: $jobEnd } }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
joblines(order_by: { line_no: asc }, where: { removed: { _eq: false } }) {
|
||||||
|
convertedtolbr
|
||||||
|
convertedtolbr_data
|
||||||
|
mod_lb_hrs
|
||||||
|
mod_lbr_ty
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -2695,6 +2695,7 @@
|
|||||||
"efficiencyoverperiod": "Efficiency over Selected Dates",
|
"efficiencyoverperiod": "Efficiency over Selected Dates",
|
||||||
"entries": "Scoreboard Entries",
|
"entries": "Scoreboard Entries",
|
||||||
"jobs": "Jobs",
|
"jobs": "Jobs",
|
||||||
|
"jobscompletednotinvoiced": "Completed Not Invoiced",
|
||||||
"lastmonth": "Last Month",
|
"lastmonth": "Last Month",
|
||||||
"lastweek": "Last Week",
|
"lastweek": "Last Week",
|
||||||
"monthlytarget": "Monthly",
|
"monthlytarget": "Monthly",
|
||||||
@@ -2709,6 +2710,7 @@
|
|||||||
"timetickets": "Time Tickets",
|
"timetickets": "Time Tickets",
|
||||||
"timeticketsemployee": "Time Tickets by Employee",
|
"timeticketsemployee": "Time Tickets by Employee",
|
||||||
"todateactual": "Actual (MTD)",
|
"todateactual": "Actual (MTD)",
|
||||||
|
"totalhrs": "Total Hours",
|
||||||
"totaloverperiod": "Total over Selected Dates",
|
"totaloverperiod": "Total over Selected Dates",
|
||||||
"weeklyactual": "Actual (W)",
|
"weeklyactual": "Actual (W)",
|
||||||
"weeklytarget": "Weekly",
|
"weeklytarget": "Weekly",
|
||||||
|
|||||||
@@ -2695,6 +2695,7 @@
|
|||||||
"efficiencyoverperiod": "",
|
"efficiencyoverperiod": "",
|
||||||
"entries": "",
|
"entries": "",
|
||||||
"jobs": "",
|
"jobs": "",
|
||||||
|
"jobscompletednotinvoiced": "",
|
||||||
"lastmonth": "",
|
"lastmonth": "",
|
||||||
"lastweek": "",
|
"lastweek": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
@@ -2709,6 +2710,7 @@
|
|||||||
"timetickets": "",
|
"timetickets": "",
|
||||||
"timeticketsemployee": "",
|
"timeticketsemployee": "",
|
||||||
"todateactual": "",
|
"todateactual": "",
|
||||||
|
"totalhrs": "",
|
||||||
"totaloverperiod": "",
|
"totaloverperiod": "",
|
||||||
"weeklyactual": "",
|
"weeklyactual": "",
|
||||||
"weeklytarget": "",
|
"weeklytarget": "",
|
||||||
|
|||||||
@@ -2695,6 +2695,7 @@
|
|||||||
"efficiencyoverperiod": "",
|
"efficiencyoverperiod": "",
|
||||||
"entries": "",
|
"entries": "",
|
||||||
"jobs": "",
|
"jobs": "",
|
||||||
|
"jobscompletednotinvoiced": "",
|
||||||
"lastmonth": "",
|
"lastmonth": "",
|
||||||
"lastweek": "",
|
"lastweek": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
@@ -2709,6 +2710,7 @@
|
|||||||
"timetickets": "",
|
"timetickets": "",
|
||||||
"timeticketsemployee": "",
|
"timeticketsemployee": "",
|
||||||
"todateactual": "",
|
"todateactual": "",
|
||||||
|
"totalhrs": "",
|
||||||
"totaloverperiod": "",
|
"totaloverperiod": "",
|
||||||
"weeklyactual": "",
|
"weeklyactual": "",
|
||||||
"weeklytarget": "",
|
"weeklytarget": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user