diff --git a/modules/ticket/back/methods/ticket/itemLackDetail.js b/modules/ticket/back/methods/ticket/itemLackDetail.js index fc3ecd675..c7671c2e7 100644 --- a/modules/ticket/back/methods/ticket/itemLackDetail.js +++ b/modules/ticket/back/methods/ticket/itemLackDetail.js @@ -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);