Change date

This commit is contained in:
Michael RICOIS 2018-01-03 11:57:24 +01:00
parent 3b7800beca
commit ec06874b41

View File

@ -62,6 +62,8 @@ function getCat($id=0, $title='') {
// Start
echo date('Y-m-d H:i:s')." - START ".$dateSelect->format('Y-m-d')." \n";
$now = $dateSelect->format('Y-m-d').' 00:00:00';
$dateStartSql = $dateSelect->format('Y-m').'-01 00:00:00';
$dateEndSql = $dateSelect->format('Y-m').'-31 23:59:59';
$filename = date('Y-m-d', strtotime($now)).'_new.csv';
if ($optDebug === true) {
@ -134,8 +136,8 @@ foreach(Db::getInstance()->ExecuteS('
o.valid = 0
AND ( os.id_order_state = 6 OR os.id_order_state = 7 OR os.id_order_state = 11)
))
AND o.date_add >= DATE_FORMAT("'.$now.'" - INTERVAL 1 MONTH, \'%Y-%m-01 00:00:00\')
AND o.date_add <= DATE_FORMAT(LAST_DAY("'.$now.'" - INTERVAL 1 MONTH), \'%Y-%m-%d 23:59:59\')
AND o.date_add >= "'.$dateStartSql.'"
AND o.date_add <= "'.$dateEndSql.'"
GROUP BY o.id_order
') as $row){
$orders[(int)$row['id_order']] = array();
@ -488,8 +490,8 @@ $orderStateNoCredit = array(
$slips = Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'order_slip` os
WHERE os.date_add >= DATE_FORMAT("'.$now.'" - INTERVAL 1 MONTH, \'%Y-%m-01 00:00:00\')
AND os.date_add <= DATE_FORMAT(LAST_DAY("'.$now.'" - INTERVAL 1 MONTH), \'%Y-%m-%d 23:59:59\')
WHERE os.date_add >= "'.$dateStartSql.'"
AND os.date_add <= "'.$dateEndSql.'"
');
$slipNb = count($slips);
@ -833,5 +835,3 @@ if($slipNb > 0) {
}
fclose($f);
exit;