feat: refs #7010 added filter fields to show packing type field in ticket list
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-09-26 14:06:45 +02:00
parent 40f3b6b67a
commit 4ebda1a06f
1 changed files with 51 additions and 45 deletions

View File

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