diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql index 081ccb0bd..90c7381d8 100644 --- a/db/routines/vn/views/zoneEstimatedDelivery.sql +++ b/db/routines/vn/views/zoneEstimatedDelivery.sql @@ -17,19 +17,17 @@ FROM ( ( ( ( - ( - `vn`.`ticket` `t` - JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) - ) - JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) + `vn`.`ticket` `t` + JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) ) - JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) + JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) ) - LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) ) - JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) + LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + ) + JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) ) - JOIN `vn`.`warehouseAlias` `wa` ON(`wa`.`id` = `w`.`aliasFk`) ) STRAIGHT_JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`) ) LEFT JOIN `vn`.`zoneClosure` `zc` ON( @@ -43,6 +41,5 @@ FROM ( ) ) JOIN `vn`.`alertLevel` `al` ON(`al`.`id` = `s`.`alertLevel`) - ) WHERE `w`.`hasProduction` <> 0 - AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() + AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() \ No newline at end of file