Get the first day of previous month

This commit is contained in:
Michael RICOIS 2018-01-04 10:30:31 +01:00
parent a248d66cde
commit 06bf95e914

View File

@ -33,7 +33,7 @@ $dateSelect = new DateTime();
if (isset($options['date'])) {
$dateSelect = DateTime::createFromFormat('Ymd', $options['date']);
} else {
$dateSelect->modify('first day of this month');
$dateSelect->modify('first day of previous month');
}
@ -131,11 +131,7 @@ foreach(Db::getInstance()->ExecuteS('
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.id_customer = o.id_customer
LEFT JOIN `'._DB_PREFIX_.'order_state_current` os ON os.id_order = o.id_order
WHERE
(o.valid = 1
OR (
o.valid = 0
AND ( os.id_order_state = 6 OR os.id_order_state = 7 OR os.id_order_state = 11)
))
( o.valid = 1 OR ( o.valid = 0 AND os.id_order_state IN (6, 7, 11, 15, 16) ) )
AND o.date_add >= "'.$dateStartSql.'"
AND o.date_add <= "'.$dateEndSql.'"
GROUP BY o.id_order