refs #5858 feat: improve itemLackDetail

This commit is contained in:
Javier Segarra 2024-03-13 14:27:45 +01:00
parent c8446eb9a1
commit ed6b25455b
1 changed files with 12 additions and 17 deletions

View File

@ -53,29 +53,24 @@ module.exports = Self => {
t.hour minTimed
FROM
vn.sale s
JOIN vn.ticket t ON t.id=s.ticketFk -- vn.ticket
LEFT JOIN vn.zone z ON z.id = t.zoneFk -- vn.zone
LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk -- AND zc.dated = DateValue(t.Fecha)
JOIN vn.client c ON c.id=t.clientFk -- vn.client
JOIN vn.ticket t ON t.id=s.ticketFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
JOIN vn.client c ON c.id=t.clientFk
LEFT JOIN bs.clientNewBorn cn ON cn.clientFk=c.id
JOIN vn.agencyMode agm ON agm.id=t.agencyModeFk -- vn.agencyMode
JOIN vn.agency ag ON ag.id=agm.id -- vn.agencyMode
JOIN vn.ticketState ts ON ts.ticketFk=t.id -- vn.sale
JOIN vn.agencyMode agm ON agm.id=t.agencyModeFk
JOIN vn.agency ag ON ag.id=agm.id
JOIN vn.ticketState ts ON ts.ticketFk=t.id
LEFT JOIN vn.state st ON st.id=ts.state
LEFT JOIN vn.alertLevel al ON al.id = st.alertLevel
LEFT JOIN vn.saleCloned sc ON sc.saleClonedFk = s.id
LEFT JOIN vn.ticketRequest tr ON tr.saleFk = s.id
LIMIT 1
WHERE
s.itemFk = ?
AND t.landed >= util.VN_CURDATE()
AND t.landed < util.VN_CURDATE() + INTERVAL ? + 1 DAY
`,
null
);
// WHERE
// s.itemFk = ?
// AND t.landed >= util.VN_CURDATE()
// AND t.landed < INTERVAL util.VN_CURDATE() + INTERVAL ? + 1 DAY
// ORDER BY s.id DESC+
// [id,2]
[id, 2]);
const sql = ParameterizedSQL.join([stmt], ';');
const result = await conn.executeStmt(sql, myOptions);