#6321 - Negative tickets #1945
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue