This commit is contained in:
2022-03-03 15:06:06 +00:00
parent 725fdefda0
commit db33afc40d
3 changed files with 33 additions and 3 deletions

View File

@@ -276,7 +276,6 @@ Available filter criteria:
- Work order tags
- Work order item tags
#### Count of work orders created
Management chart showing the number of new work orders created that fit criteria selected, available as a Line or Bar chart:
@@ -287,7 +286,6 @@ Management chart showing the number of new work orders created that fit criteria
These chart format widgets display counts of work orders created by selected time span and selected interval.
They will automatically update every 15 minutes approximately.
Available to the following roles:
@@ -304,3 +302,27 @@ Available filter criteria:
- Interval
- Work order tags
- Work order item tags
#### Percentage of Work orders completed on time
![pct workorder completed on time](img/widget-work-order-completed-on-time-bar.png)
Management bar chart showing the percentage of work orders that were completed on time for the criteria selected.
Here, completed on time means work orders that were set to a [Completed work order status](svc-work-order-status.md#is-a-completed-status) before the Work order's [date to be completed setting](svc-workorders.md#date-to-be-completed).
They will automatically update every 15 minutes approximately.
Available to the following roles:
- Accounting
- Business administration
- Business administration - restricted
- Service manager
- Service manager - restricted
Available filter criteria:
- Time span
- Interval
- Work order tags

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -47,13 +47,21 @@ AuthorizationRoles.Accounting;
bool wotagsany = options.Criteria["wotagsany"].ToObject<bool>();
string woTagsWhere = DataListSqlFilterCriteriaBuilder.KPITagFilterToSqlCriteria("aworkorder.tags", wotags, wotagsany);
_dataQuery = @$"SELECT row_to_json(t) as res from (
with subq as (
SELECT COUNT(AWORKORDER.ID) wocount,
DATE_TRUNC('{interval}',AWORKORDER.createddate) x,
(LASTSTATUSID IS NULL OR AWORKORDERSTATUS.COMPLETED = FALSE) z
(aworkorder.laststatusid is not null AND AWORKORDERSTATUS.COMPLETED = TRUE AND laststate.created < aworkorder.completebydate) Z
FROM AWORKORDER
LEFT JOIN AWORKORDERSTATUS ON (AWORKORDER.LASTSTATUSID = AWORKORDERSTATUS.ID)
LEFT JOIN LATERAL (SELECT created
FROM aworkorderstate
WHERE aworkorderstate.workorderid = aworkorder.id
ORDER BY aworkorderstate.created DESC
LIMIT 1) AS laststate ON TRUE
where AWORKORDER.COMPLETEBYDATE < NOW() AND {dateWhere} {woTagsWhere}
GROUP BY x,z
)