production: filter by date fix

This commit is contained in:
Michał Zieliński
2025-10-08 08:26:37 +02:00
parent 7e0d56c670
commit e52fb4e039

View File

@@ -105,8 +105,8 @@ WHERE ps.deleted = 0 ";
if ($dateFrom != null && $dateTo != null) { if ($dateFrom != null && $dateTo != null) {
$query .= " AND ( $query .= " AND (
(ps.production_date >= '$dateFrom' AND ps.production_date <= '$dateTo') (DATE(ps.production_date) >= '$dateFrom' AND DATE(ps.production_date) <= '$dateTo')
OR ps.production_date IS NULL OR ps.production_date = '0000-00-00')"; OR ps.production_date IS NULL OR DATE(ps.production_date) = '0000-00-00')";
} }
if ($ids != null) { if ($ids != null) {
@@ -114,12 +114,14 @@ WHERE ps.deleted = 0 ";
} }
$query .= "GROUP BY ps.id, s.id, si.id, p.id, ps_main.id, p_main.id "; $query .= "GROUP BY ps.id, s.id, si.id, p.id, ps_main.id, p_main.id ";
$query .= "ORDER BY s.delivery_date, s.register_date, s.document_no;";
echo $query;
$rows = $db->query($query); $rows = $db->query($query);
$data = array(); $data = array();
$i = 0; $i = 0;
while ($r = $db->fetchByAssoc($rows)) { while ($r = $db->fetchByAssoc($rows)) {
var_dump( $r['production_date']);
$row = array(); $row = array();
$i++; $i++;
$row['position'] = $i; $row['position'] = $i;