This commit is contained in:
@@ -119,27 +119,21 @@ export default {
|
|||||||
//so as similar as possible to the datatable system but handles the math and summarizing ideally in the db server itself
|
//so as similar as possible to the datatable system but handles the math and summarizing ideally in the db server itself
|
||||||
/*
|
/*
|
||||||
DateTrunc https://www.postgresqltutorial.com/postgresql-date_trunc/ will respect changes of month or year or whatever so this works
|
DateTrunc https://www.postgresqltutorial.com/postgresql-date_trunc/ will respect changes of month or year or whatever so this works
|
||||||
SELECT SUM(AWORKORDERITEMLABOR.serviceratequantity), date_trunc('day',AWORKORDERITEMLABOR.servicestartdate) m
|
|
||||||
|
SELECT row_to_json(t) as res from (
|
||||||
|
|
||||||
|
select SUM(AWORKORDERITEMLABOR.serviceratequantity) SERVICERATESUM, date_trunc('month',AWORKORDERITEMLABOR.servicestartdate) timeframe
|
||||||
|
|
||||||
FROM AWORKORDER
|
FROM AWORKORDER
|
||||||
LEFT JOIN AWORKORDERITEM ON AWORKORDER.ID = AWORKORDERITEM.WORKORDERID
|
LEFT JOIN AWORKORDERITEM ON AWORKORDER.ID = AWORKORDERITEM.WORKORDERID
|
||||||
LEFT JOIN AWORKORDERITEMLABOR ON AWORKORDERITEM.ID = AWORKORDERITEMLABOR.WORKORDERITEMID
|
LEFT JOIN AWORKORDERITEMLABOR ON AWORKORDERITEM.ID = AWORKORDERITEMLABOR.WORKORDERITEMID
|
||||||
WHERE AWORKORDERITEMLABOR.userid = 10
|
WHERE AWORKORDERITEMLABOR.userid = 10
|
||||||
|
|
||||||
GROUP BY m
|
GROUP BY timeframe
|
||||||
ORDER BY m ASC;
|
ORDER BY timeframe ASC
|
||||||
|
) t
|
||||||
|
|
||||||
|
|
||||||
SELECT SUM(AWORKORDERITEMLABOR.serviceratequantity), date_trunc('month',AWORKORDERITEMLABOR.servicestartdate) m
|
|
||||||
|
|
||||||
FROM AWORKORDER
|
|
||||||
LEFT JOIN AWORKORDERITEM ON AWORKORDER.ID = AWORKORDERITEM.WORKORDERID
|
|
||||||
LEFT JOIN AWORKORDERITEMLABOR ON AWORKORDERITEM.ID = AWORKORDERITEMLABOR.WORKORDERITEMID
|
|
||||||
WHERE AWORKORDERITEMLABOR.userid = 10
|
|
||||||
|
|
||||||
GROUP BY m
|
|
||||||
ORDER BY m ASC;
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// try {
|
// try {
|
||||||
|
|||||||
Reference in New Issue
Block a user