diff --git a/app/Controllers/Reports.php b/app/Controllers/Reports.php
index 98ad47055..ba2ffca5f 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'])),
+ 'sale_date' => to_date(strtotime($row['sale_date']) ?? null),
'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']));
+ $date = to_date(strtotime($row['sale_date'] ?? null));
$labels[] = $date;
$series[] = ['meta' => $date, 'value' => $row['total']];
}
@@ -1211,7 +1211,7 @@ class Reports extends Secure_Controller
* @param string $payment_type
* @return void
*/
- public function specific_customer(string $start_date, string $end_date, string $customer_id, string $sale_type, string $payment_type): void
+ public function specific_customers(string $start_date, string $end_date, string $customer_id, string $sale_type, string $payment_type): void
{
$this->clearCache();
@@ -1245,7 +1245,7 @@ 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'])),
+ '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']),
@@ -1340,7 +1340,7 @@ class Reports extends Secure_Controller
* @param string $sale_type
* @return void
*/
- public function specific_employee(string $start_date, string $end_date, string $employee_id, string $sale_type): void
+ public function specific_employees(string $start_date, string $end_date, string $employee_id, string $sale_type): void
{
$this->clearCache();
@@ -1373,7 +1373,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'])),
+ 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)),
'quantity' => to_quantity_decimals($row['items_purchased']),
'customer_name' => $row['customer_name'],
'subtotal' => to_currency($row['subtotal']),
@@ -1466,7 +1466,7 @@ class Reports extends Secure_Controller
* @param string $discount_type
* @return void
*/
- public function specific_discount(string $start_date, string $end_date, string $discount, string $sale_type, string $discount_type): void
+ public function specific_discounts(string $start_date, string $end_date, string $discount, string $sale_type, string $discount_type): void
{
$this->clearCache();
@@ -1505,7 +1505,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'])),
+ 'sale_date' => to_date(strtotime($row['sale_date']?? null)),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'customer_name' => $row['customer_name'],
@@ -1648,7 +1648,7 @@ class Reports extends Secure_Controller
* @param string $sale_type
* @return void
*/
- public function specific_supplier(string $start_date, string $end_date, string $supplier_id, string $sale_type): void
+ public function specific_suppliers(string $start_date, string $end_date, string $supplier_id, string $sale_type): void
{
$inputs = [
'start_date' => $start_date,
@@ -1669,7 +1669,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'])),
+ 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)),
'name' => $row['name'],
'category' => $row['category'],
'item_number' => $row['item_number'],
@@ -1768,7 +1768,7 @@ class Reports extends Secure_Controller
$summary_data[] = [
'id' => $row['sale_id'],
'type_code' => $row['type_code'],
- 'sale_date' => isset($row['sale_date']) ? to_date(strtotime($row['sale_date'])) : null,
+ 'sale_date' => to_date(strtotime($row['sale_date'] ?? null)),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'customer_name' => $row['customer_name'],
@@ -1908,7 +1908,7 @@ class Reports extends Secure_Controller
{
$summary_data[] = [
'id' => $row['receiving_id'],
- 'receiving_date' => to_date(strtotime($row['receiving_date'])),
+ 'receiving_date' => to_date(strtotime($row['receiving_date'] ?? null)),
'quantity' => to_quantity_decimals($row['items_purchased']),
'employee_name' => $row['employee_name'],
'supplier_name' => $row['supplier_name'],
diff --git a/app/Models/Reports/Specific_supplier.php b/app/Models/Reports/Specific_supplier.php
index 2628c1f57..8f802a3ab 100644
--- a/app/Models/Reports/Specific_supplier.php
+++ b/app/Models/Reports/Specific_supplier.php
@@ -117,7 +117,7 @@ class Specific_supplier extends Report
$builder->where('sale_type', SALE_TYPE_RETURN);
}
- $builder->groupBy('item_id');
+ $builder->groupBy(['item_id', 'sale_id']);
$builder->orderBy('sale_id');
return $builder->get()->getResultArray();
diff --git a/app/Views/reports/listing.php b/app/Views/reports/listing.php
index 47309acdc..46d74b7d4 100644
--- a/app/Views/reports/listing.php
+++ b/app/Views/reports/listing.php
@@ -43,8 +43,8 @@ $detailed_reports = [
-
+ ?>
+
@@ -64,8 +64,8 @@ $detailed_reports = [
-
+ ?>
+
@@ -85,8 +85,8 @@ $detailed_reports = [
-
+ ?>
+
+ $inventory_summary_report = get_report_link('reports_inventory_summary');
+ ?>
= $inventory_low_report['label'] ?>
= $inventory_summary_report['label'] ?>
+ ?>
diff --git a/app/Views/reports/tabular.php b/app/Views/reports/tabular.php
index 35dc6e664..b618e56d2 100644
--- a/app/Views/reports/tabular.php
+++ b/app/Views/reports/tabular.php
@@ -51,7 +51,7 @@
.addClass("table-striped")
.addClass("table-bordered")
.bootstrapTable({
- columns: = transform_headers(esc($headers, 'js'), true, false) ?>,
+ columns: = transform_headers(esc($headers), true, false) ?>,
stickyHeader: true,
stickyHeaderOffsetLeft: $('#table').offset().left + 'px',
stickyHeaderOffsetRight: $('#table').offset().right + 'px',
@@ -62,10 +62,10 @@
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel', 'pdf'],
pagination: true,
showColumns: true,
- data: = json_encode(esc($data, 'js')) ?>,
+ data: = json_encode(esc($data)) ?>,
iconSize: 'sm',
paginationVAlign: 'bottom',
- escape: false,
+ escape: true,
search: true
});
});