From 34503b73b8019615eb903dc22f8f86d706d60b83 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Tue, 23 Apr 2024 17:07:16 +0400 Subject: [PATCH] Fixing Reports - Corrected sale_time data Signed-off-by: objecttothis --- app/Controllers/Reports.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/Controllers/Reports.php b/app/Controllers/Reports.php index ba2ffca5f..03eb272f1 100644 --- a/app/Controllers/Reports.php +++ b/app/Controllers/Reports.php @@ -145,7 +145,7 @@ class Reports extends Secure_Controller foreach($report_data as $row) { $tabular_data[] = [ - 'sale_date' => to_date(strtotime($row['sale_date']) ?? null), + 'sale_date' => to_date(strtotime($row['sale_date'])), 'sales' => to_quantity_decimals($row['sales']), 'quantity' => to_quantity_decimals($row['quantity_purchased']), 'subtotal' => to_currency($row['subtotal']), @@ -771,7 +771,7 @@ class Reports extends Secure_Controller $series = []; foreach($report_data as $row) { - $date = to_date(strtotime($row['sale_date'] ?? null)); + $date = to_date(strtotime($row['sale_date'])); $labels[] = $date; $series[] = ['meta' => $date, 'value' => $row['total']]; } @@ -1245,7 +1245,6 @@ class Reports extends Secure_Controller 'id' => $row['sale_id'], 'type_code' => $row['type_code'], 'sale_time' => to_datetime(strtotime($row['sale_time'])), - 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)), 'quantity' => to_quantity_decimals($row['items_purchased']), 'employee_name' => $row['employee_name'], 'subtotal' => to_currency($row['subtotal']), @@ -1373,7 +1372,7 @@ class Reports extends Secure_Controller $summary_data[] = [ 'id' => $row['sale_id'], 'type_code' => $row['type_code'], - 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)), + 'sale_time' => to_datetime(strtotime($row['sale_time'])), 'quantity' => to_quantity_decimals($row['items_purchased']), 'customer_name' => $row['customer_name'], 'subtotal' => to_currency($row['subtotal']), @@ -1505,7 +1504,7 @@ class Reports extends Secure_Controller $summary_data[] = [ 'id' => $row['sale_id'], 'type_code' => $row['type_code'], - 'sale_date' => to_date(strtotime($row['sale_date']?? null)), + 'sale_time' => to_datetime(strtotime($row['sale_time'])), 'quantity' => to_quantity_decimals($row['items_purchased']), 'employee_name' => $row['employee_name'], 'customer_name' => $row['customer_name'], @@ -1669,7 +1668,7 @@ class Reports extends Secure_Controller $tabular_data[] = [ 'id' => $row['sale_id'], 'type_code' => $row['type_code'], - 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)), + 'sale_time' => to_datetime(strtotime($row['sale_time'])), 'name' => $row['name'], 'category' => $row['category'], 'item_number' => $row['item_number'], @@ -1768,7 +1767,7 @@ class Reports extends Secure_Controller $summary_data[] = [ 'id' => $row['sale_id'], 'type_code' => $row['type_code'], - 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)), + 'sale_time' => to_datetime(strtotime($row['sale_time'])), 'quantity' => to_quantity_decimals($row['items_purchased']), 'employee_name' => $row['employee_name'], 'customer_name' => $row['customer_name'], @@ -1814,8 +1813,8 @@ class Reports extends Secure_Controller to_currency($drow['profit']), ($drow['discount_type'] == PERCENT) ? $drow['discount'].'%' : to_currency($drow['discount']) ], - $attribute_values - ); + $attribute_values + ); } if(isset($report_data['rewards'][$key])) @@ -1908,7 +1907,7 @@ class Reports extends Secure_Controller { $summary_data[] = [ 'id' => $row['receiving_id'], - 'receiving_date' => to_date(strtotime($row['receiving_date'] ?? null)), + 'receiving_time' => to_datetime(strtotime($row['receiving_time'])), 'quantity' => to_quantity_decimals($row['items_purchased']), 'employee_name' => $row['employee_name'], 'supplier_name' => $row['supplier_name'],