mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-04 07:12:48 -04:00
Fixing Reports
- Added checks for array keys not set - Renamed functions so that reports would generate - Minor reformatting - Added sale_id to the groupBy() call to remove error when only full group by is enabled. Signed-off-by: objecttothis <objecttothis@gmail.com>
This commit is contained in:
@@ -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'],
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -43,8 +43,8 @@ $detailed_reports = [
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,8 +64,8 @@ $detailed_reports = [
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,8 +85,8 @@ $detailed_reports = [
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
@@ -100,15 +100,15 @@ $detailed_reports = [
|
||||
<div class="list-group">
|
||||
<?php
|
||||
$inventory_low_report = get_report_link('reports_inventory_low');
|
||||
$inventory_summary_report = get_report_link('reports_inventory_summary');
|
||||
?>
|
||||
$inventory_summary_report = get_report_link('reports_inventory_summary');
|
||||
?>
|
||||
<a class="list-group-item" href="<?= $inventory_low_report['path'] ?>"><?= $inventory_low_report['label'] ?></a>
|
||||
<a class="list-group-item" href="<?= $inventory_summary_report['path'] ?>"><?= $inventory_summary_report['label'] ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user