8144-devToTest_2444 #3137

Merged
alexm merged 90 commits from 8144-devToTest_2444 into test 2024-10-22 06:07:15 +00:00
1 changed files with 51 additions and 45 deletions
Showing only changes of commit 35621e9051 - Show all commits

View File

@ -228,52 +228,57 @@ module.exports = Self => {
stmt = new ParameterizedSQL(`
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
ENGINE = MEMORY
ENGINE = InnoDB
SELECT t.id,
t.shipped,
CAST(DATE(t.shipped) AS CHAR) shippedDate,
HOUR(t.shipped) shippedHour,
t.nickname,
t.refFk,
t.routeFk,
t.warehouseFk,
t.clientFk,
t.totalWithoutVat,
t.totalWithVat,
io.id invoiceOutId,
a.provinceFk,
p.name province,
w.name warehouse,
am.name agencyMode,
am.id agencyModeFk,
st.name state,
st.classColor,
wk.lastName salesPerson,
ts.stateFk stateFk,
ts.alertLevel alertLevel,
ts.code alertLevelCode,
u.name userName,
c.salesPersonFk,
z.hour zoneLanding,
HOUR(z.hour) zoneHour,
MINUTE(z.hour) zoneMinute,
z.name zoneName,
z.id zoneFk,
CAST(z.hour AS CHAR) hour,
a.nickname addressNickname
FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = a.provinceFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN route r ON r.id = t.routeFk
t.shipped,
CAST(DATE(t.shipped) AS CHAR) shippedDate,
HOUR(t.shipped) shippedHour,
t.nickname,
t.refFk,
t.routeFk,
t.warehouseFk,
t.clientFk,
t.totalWithoutVat,
t.totalWithVat,
io.id invoiceOutId,
a.provinceFk,
p.name province,
w.name warehouse,
am.name agencyMode,
am.id agencyModeFk,
st.name state,
st.classColor,
wk.lastName salesPerson,
ts.stateFk stateFk,
ts.alertLevel alertLevel,
ts.code alertLevelCode,
u.name userName,
c.salesPersonFk,
z.hour zoneLanding,
HOUR(z.hour) zoneHour,
MINUTE(z.hour) zoneMinute,
z.name zoneName,
z.id zoneFk,
CAST(z.hour AS CHAR) hour,
a.nickname addressNickname,
(SELECT GROUP_CONCAT(DISTINCT i2.itemPackingTypeFk ORDER BY i2.itemPackingTypeFk SEPARATOR ',')
FROM sale s2
JOIN item i2 ON i2.id = s2.itemFk
WHERE s2.ticketFk = t.id
) AS packing
FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = a.provinceFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN route r ON r.id = t.routeFk
`);
if (args.orderFk) {
@ -292,6 +297,7 @@ module.exports = Self => {
}
stmt.merge(conn.makeWhere(filter.where));
stmts.push(stmt);
stmt = new ParameterizedSQL(`