Merge pull request 'fix: refs #6389 saleMonitor filter' (!3130) from 6389-changesMonitor into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #3130
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Carlos Satorres 2024-12-12 09:26:29 +00:00
commit a14989ddcf
1 changed files with 18 additions and 1 deletions

View File

@ -89,6 +89,11 @@ module.exports = Self => {
type: 'number', type: 'number',
description: `The alert level of the tickets` description: `The alert level of the tickets`
}, },
{
arg: 'packing',
type: 'string',
description: `The packing of the items`
},
{ {
arg: 'countryFk', arg: 'countryFk',
type: 'number', type: 'number',
@ -174,7 +179,7 @@ module.exports = Self => {
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`
CREATE OR REPLACE TEMPORARY TABLE tmp.filter CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(PRIMARY KEY (id)) (PRIMARY KEY (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,
@ -200,10 +205,18 @@ module.exports = Self => {
u.name userName, u.name userName,
c.salesPersonFk, c.salesPersonFk,
c.credit, c.credit,
pm.name payMethod,
z.hour zoneLanding, z.hour zoneLanding,
z.name zoneName, z.name zoneName,
z.id zoneFk, z.id zoneFk,
st.classColor, st.classColor,
d.id departmentFk,
d.name department,
(SELECT GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk SEPARATOR ',')
FROM sale s
JOIN item i ON i.id = s.itemFk
WHERE s.ticketFk = t.id
) AS packing,
TIME_FORMAT(t.shipped, '%H:%i') preparationHour, TIME_FORMAT(t.shipped, '%H:%i') preparationHour,
TIME_FORMAT(z.hour, '%H:%i') theoreticalhour, TIME_FORMAT(z.hour, '%H:%i') theoreticalhour,
TIME_FORMAT(zed.etc, '%H:%i') practicalHour TIME_FORMAT(zed.etc, '%H:%i') practicalHour
@ -217,7 +230,10 @@ module.exports = Self => {
LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN payMethod pm ON pm.id = c.payMethodFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN workerDepartment wd ON wd.workerFk = wk.id
LEFT JOIN department d ON d.id = wd.departmentFk
LEFT JOIN account.user u ON u.id = wk.id LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN ( LEFT JOIN (
SELECT zoneFk, SELECT zoneFk,
@ -362,6 +378,7 @@ module.exports = Self => {
} }
case 'agencyModeFk': case 'agencyModeFk':
case 'warehouseFk': case 'warehouseFk':
case 'packing':
case 'countryFk': case 'countryFk':
param = `f.${param}`; param = `f.${param}`;
return {[param]: value}; return {[param]: value};