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 t.hour minTimed
FROM FROM
vn.sale s vn.sale s
JOIN vn.ticket t ON t.id=s.ticketFk -- vn.ticket JOIN vn.ticket t ON t.id=s.ticketFk
LEFT JOIN vn.zone z ON z.id = t.zoneFk -- vn.zone LEFT JOIN vn.zone z ON z.id = t.zoneFk
LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk -- AND zc.dated = DateValue(t.Fecha) LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
JOIN vn.client c ON c.id=t.clientFk -- vn.client JOIN vn.client c ON c.id=t.clientFk
LEFT JOIN bs.clientNewBorn cn ON cn.clientFk=c.id LEFT JOIN bs.clientNewBorn cn ON cn.clientFk=c.id
JOIN vn.agencyMode agm ON agm.id=t.agencyModeFk -- vn.agencyMode JOIN vn.agencyMode agm ON agm.id=t.agencyModeFk
JOIN vn.agency ag ON ag.id=agm.id -- vn.agencyMode JOIN vn.agency ag ON ag.id=agm.id
JOIN vn.ticketState ts ON ts.ticketFk=t.id -- vn.sale JOIN vn.ticketState ts ON ts.ticketFk=t.id
LEFT JOIN vn.state st ON st.id=ts.state LEFT JOIN vn.state st ON st.id=ts.state
LEFT JOIN vn.alertLevel al ON al.id = st.alertLevel LEFT JOIN vn.alertLevel al ON al.id = st.alertLevel
LEFT JOIN vn.saleCloned sc ON sc.saleClonedFk = s.id LEFT JOIN vn.saleCloned sc ON sc.saleClonedFk = s.id
LEFT JOIN vn.ticketRequest tr ON tr.saleFk = 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 [id, 2]);
);
// 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]
const sql = ParameterizedSQL.join([stmt], ';'); const sql = ParameterizedSQL.join([stmt], ';');
const result = await conn.executeStmt(sql, myOptions); const result = await conn.executeStmt(sql, myOptions);