diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 682a9ce9d..6b6f4724d 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -51,13 +51,14 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['sale_date'], - to_quantity_decimals($row['quantity_purchased']), - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']), - to_currency($row['cost']), - to_currency($row['profit']) + $tabular_data[] = $this->xss_clean(array( + 'sale_date' => $row['sale_date'], + 'quantity' => to_quantity_decimals($row['quantity_purchased']), + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), + 'profit' => to_currency($row['profit']) )); } @@ -86,13 +87,14 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['category'], - to_quantity_decimals($row['quantity_purchased']), - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']), - to_currency($row['cost']), - to_currency($row['profit']) + $tabular_data[] = $this->xss_clean(array( + 'category' => $row['category'], + 'quantity' => to_quantity_decimals($row['quantity_purchased']), + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), + 'profit' => to_currency($row['profit']) )); } @@ -121,13 +123,14 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['customer'], - to_quantity_decimals($row['quantity_purchased']), - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']), - to_currency($row['cost']), - to_currency($row['profit']) + $tabular_data[] = $this->xss_clean(array( + 'customer_name' => $row['customer'], + 'quantity' => to_quantity_decimals($row['quantity_purchased']), + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), + 'profit' => to_currency($row['profit']) )); } @@ -156,13 +159,14 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['supplier'], - to_quantity_decimals($row['quantity_purchased']), - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']), - to_currency($row['cost']), - to_currency($row['profit']) + $tabular_data[] = $this->xss_clean(array( + 'supplier_name' => $row['supplier'], + 'quantity' => to_quantity_decimals($row['quantity_purchased']), + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), + 'profit' => to_currency($row['profit']) )); } @@ -191,13 +195,14 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['name'], - to_quantity_decimals($row['quantity_purchased']), - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']), - to_currency($row['cost']), - to_currency($row['profit']) + $tabular_data[] = $this->xss_clean(array( + 'item_name' => $row['name'], + 'quantity' => to_quantity_decimals($row['quantity_purchased']), + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), + 'profit' => to_currency($row['profit']) )); } @@ -226,13 +231,14 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['employee'], - to_quantity_decimals($row['quantity_purchased']), - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']), - to_currency($row['cost']), - to_currency($row['profit']) + $tabular_data[] = $this->xss_clean(array( + 'employee_name' => $row['employee'], + 'quantity' => to_quantity_decimals($row['quantity_purchased']), + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']), + 'cost' => to_currency($row['cost']), + 'profit' => to_currency($row['profit']) )); } @@ -261,11 +267,12 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['percent'], - $row['count'], - to_currency($row['subtotal']), - to_currency($row['tax']), - to_currency($row['total']) + $tabular_data[] = $this->xss_clean(array( + 'tax_percent' => $row['percent'], + 'report_count' => $row['count'], + 'subtotal' => to_currency($row['subtotal']), + 'tax' => to_currency($row['tax']), + 'total' => to_currency($row['total']) )); } @@ -294,8 +301,9 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['discount_percent'], - $row['count'] + $tabular_data[] = $this->xss_clean(array( + 'discount' => $row['discount_percent'], + 'count' => $row['count'] )); } @@ -324,9 +332,10 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['payment_type'], - $row['count'], - to_currency($row['payment_amount']) + $tabular_data[] = $this->xss_clean(array( + 'payment_type' => $row['payment_type'], + 'report_count' => $row['count'], + 'amount_tendered' => to_currency($row['payment_amount']) )); } @@ -899,8 +908,8 @@ class Reports extends Secure_Controller 'sale_id' => $report_data['sale_id'], 'sale_date' => $report_data['sale_date'], 'quantity' => to_quantity_decimals($report_data['items_purchased']), - 'employee' => $report_data['employee_name'], - 'customer' => $report_data['customer_name'], + 'employee_name' => $report_data['employee_name'], + 'customer_name' => $report_data['customer_name'], 'subtotal' => to_currency($report_data['subtotal']), 'tax' => to_currency($report_data['tax']), 'total' => to_currency($report_data['total']), @@ -992,8 +1001,8 @@ class Reports extends Secure_Controller 'receiving_id' => $report_data['receiving_id'], 'receiving_date' => $report_data['receiving_date'], 'quantity' => to_quantity_decimals($report_data['items_purchased']), - 'employee' => $report_data['employee_name'], - 'supplier' => $report_data['supplier_name'], + 'employee_name' => $report_data['employee_name'], + 'supplier_name' => $report_data['supplier_name'], 'total' => to_currency($report_data['total']), 'payment_type' => $report_data['payment_type'], 'reference' => $report_data['reference'], @@ -1076,11 +1085,12 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['name'], - $row['item_number'], - to_quantity_decimals($row['quantity']), - to_quantity_decimals($row['reorder_level']), - $row['location_name'] + $tabular_data[] = $this->xss_clean(array( + 'item_name' => $row['name'], + 'item_number' => $row['item_number'], + 'quantity' => to_quantity_decimals($row['quantity']), + 'reorder_level' => to_quantity_decimals($row['reorder_level']), + 'location_name' => $row['location_name'] )); } @@ -1122,14 +1132,15 @@ class Reports extends Secure_Controller $tabular_data = array(); foreach($report_data as $row) { - $tabular_data[] = $this->xss_clean(array($row['name'], - $row['item_number'], - to_quantity_decimals($row['quantity']), - to_quantity_decimals($row['reorder_level']), - $row['location_name'], - to_currency($row['cost_price']), - to_currency($row['unit_price']), - to_currency($row['sub_total_value']) + $tabular_data[] = $this->xss_clean(array( + 'item_name' => $row['name'], + 'item_number' => $row['item_number'], + 'quantity' => to_quantity_decimals($row['quantity']), + 'reorder_level' => to_quantity_decimals($row['reorder_level']), + 'location_name' => $row['location_name'], + 'cost_price' => to_currency($row['cost_price']), + 'unit_price' => to_currency($row['unit_price']), + 'subtotal' => to_currency($row['sub_total_value']) )); } diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index 48c2d9fb6..2e096a504 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -121,7 +121,7 @@ function transform_headers_readonly($array) return json_encode($result); } -function transform_headers($array, $readonly = FALSE) +function transform_headers($array, $readonly = FALSE, $editable = TRUE) { $result = array(); @@ -130,7 +130,10 @@ function transform_headers($array, $readonly = FALSE) $array = array_merge(array(array('checkbox' => 'select', 'sortable' => FALSE)), $array); } - $array[] = array('edit' => ''); + if ($editable) + { + $array[] = array('edit' => ''); + } foreach($array as $element) { diff --git a/application/models/reports/Inventory_low.php b/application/models/reports/Inventory_low.php index f874bb393..4cf5dd080 100644 --- a/application/models/reports/Inventory_low.php +++ b/application/models/reports/Inventory_low.php @@ -11,11 +11,12 @@ class Inventory_low extends Report public function getDataColumns() { - return array($this->lang->line('reports_item_name'), - $this->lang->line('reports_item_number'), - $this->lang->line('reports_quantity'), - $this->lang->line('reports_reorder_level'), - $this->lang->line('reports_stock_location')); + return array( + array('item_name' => $this->lang->line('reports_item_name')), + array('item_number' => $this->lang->line('reports_item_number')), + array('quantity' => $this->lang->line('reports_quantity')), + array('reorder_level' => $this->lang->line('reports_reorder_level')), + array('location_name' => $this->lang->line('reports_stock_location'))); } public function getData(array $inputs) diff --git a/application/models/reports/Inventory_summary.php b/application/models/reports/Inventory_summary.php index 1e84e105b..c8142343e 100644 --- a/application/models/reports/Inventory_summary.php +++ b/application/models/reports/Inventory_summary.php @@ -11,14 +11,14 @@ class Inventory_summary extends Report public function getDataColumns() { - return array($this->lang->line('reports_item_name'), - $this->lang->line('reports_item_number'), - $this->lang->line('reports_quantity'), - $this->lang->line('reports_reorder_level'), - $this->lang->line('reports_stock_location'), - $this->lang->line('reports_cost_price'), - $this->lang->line('reports_unit_price'), - $this->lang->line('reports_sub_total_value')); + return array(array('item_name' => $this->lang->line('reports_item_name')), + array('item_number' => $this->lang->line('reports_item_number')), + array('quantity' => $this->lang->line('reports_quantity')), + array('reorder_level' => $this->lang->line('reports_reorder_level')), + array('location_name' => $this->lang->line('reports_stock_location')), + array('cost_price' => $this->lang->line('reports_cost_price'), 'sorter' => 'currency_sorter'), + array('unit_price' => $this->lang->line('reports_unit_price'), 'sorter' => 'currency_sorter'), + array('subtotal' => $this->lang->line('reports_sub_total_value'), 'sorter' => 'currency_sorter')); } public function getData(array $inputs) diff --git a/application/models/reports/Summary_categories.php b/application/models/reports/Summary_categories.php index 801142d6e..4704f36d1 100644 --- a/application/models/reports/Summary_categories.php +++ b/application/models/reports/Summary_categories.php @@ -11,7 +11,14 @@ class Summary_categories extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_category'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit')); + return array( + array('category' => $this->lang->line('reports_category')), + array('quantity' => $this->lang->line('reports_quantity')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'), + array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'), + array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter')); } protected function _select(array $inputs) diff --git a/application/models/reports/Summary_customers.php b/application/models/reports/Summary_customers.php index 895addb7c..b298a1d4e 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -11,7 +11,14 @@ class Summary_customers extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_customer'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit')); + return array( + array('customer_name' => $this->lang->line('reports_customer')), + array('quantity' => $this->lang->line('reports_quantity')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'), + array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'), + array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter')); } protected function _select(array $inputs) diff --git a/application/models/reports/Summary_discounts.php b/application/models/reports/Summary_discounts.php index ff014a8ba..597ac809a 100644 --- a/application/models/reports/Summary_discounts.php +++ b/application/models/reports/Summary_discounts.php @@ -11,7 +11,9 @@ class Summary_discounts extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_discount_percent'), $this->lang->line('reports_count')); + return array( + array('discount' => $this->lang->line('reports_discount_percent')), + array('count' => $this->lang->line('reports_count'))); } public function getData(array $inputs) diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index 980570641..d4d00f38d 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -11,7 +11,14 @@ class Summary_employees extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_employee'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit')); + return array( + array('employee_name' => $this->lang->line('reports_employee')), + array('quantity' => $this->lang->line('reports_quantity')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'), + array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'), + array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter')); } protected function _select(array $inputs) diff --git a/application/models/reports/Summary_items.php b/application/models/reports/Summary_items.php index cad2540e5..322adffeb 100644 --- a/application/models/reports/Summary_items.php +++ b/application/models/reports/Summary_items.php @@ -11,7 +11,14 @@ class Summary_items extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_item'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit')); + return array( + array('item_name' => $this->lang->line('reports_item')), + array('quantity' => $this->lang->line('reports_quantity')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'), + array('cost', $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'), + array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter')); } protected function _select(array $inputs) diff --git a/application/models/reports/Summary_payments.php b/application/models/reports/Summary_payments.php index 306e3a62d..f1bdd747c 100644 --- a/application/models/reports/Summary_payments.php +++ b/application/models/reports/Summary_payments.php @@ -11,7 +11,10 @@ class Summary_payments extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_payment_type'), $this->lang->line('reports_count'), $this->lang->line('sales_amount_tendered')); + return array( + array('payment_type' => $this->lang->line('reports_payment_type')), + array('report_count' => $this->lang->line('reports_count')), + array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'currency_sorter')); } public function getData(array $inputs) diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index e47505f60..58861df4d 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -11,7 +11,14 @@ class Summary_sales extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_date'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit')); + return array( + array('sale_date' => $this->lang->line('reports_date')), + array('quantity' => $this->lang->line('reports_quantity')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'), + array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'), + array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter')); } protected function _select(array $inputs) diff --git a/application/models/reports/Summary_suppliers.php b/application/models/reports/Summary_suppliers.php index 193282b49..3b73dca7d 100644 --- a/application/models/reports/Summary_suppliers.php +++ b/application/models/reports/Summary_suppliers.php @@ -11,7 +11,14 @@ class Summary_suppliers extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_supplier'), $this->lang->line('reports_quantity'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total'), $this->lang->line('reports_cost'), $this->lang->line('reports_profit')); + return array( + array('supplier_name' => $this->lang->line('reports_supplier')), + array('quantity' => $this->lang->line('reports_quantity')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'), + array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'), + array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter')); } protected function _select(array $inputs) diff --git a/application/models/reports/Summary_taxes.php b/application/models/reports/Summary_taxes.php index b284b6497..00c87bbbe 100644 --- a/application/models/reports/Summary_taxes.php +++ b/application/models/reports/Summary_taxes.php @@ -11,7 +11,12 @@ class Summary_taxes extends Summary_report protected function _get_data_columns() { - return array($this->lang->line('reports_tax_percent'), $this->lang->line('reports_count'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_tax'), $this->lang->line('reports_total')); + return array( + array('tax' => $this->lang->line('reports_tax_percent'), 'sorter' => 'currency_sorter'), + array('report_count' => $this->lang->line('reports_count')), + array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'), + array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'), + array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter')); } public function getData(array $inputs) diff --git a/application/views/partial/header.php b/application/views/partial/header.php index cb5d27f8e..e7ac11354 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -70,11 +70,11 @@ - + - + diff --git a/application/views/reports/tabular.php b/application/views/reports/tabular.php index a8b145c55..8daa5bc9c 100644 --- a/application/views/reports/tabular.php +++ b/application/views/reports/tabular.php @@ -25,7 +25,7 @@ load->view('partial/bootstrap_tables_locale'); ?> $('#table').bootstrapTable({ - columns: , + columns: , pageSize: config->item('lines_per_page'); ?>, striped: true, sortable: true, diff --git a/application/views/reports/tabular_details.php b/application/views/reports/tabular_details.php index 3f1dd4815..7ba606272 100644 --- a/application/views/reports/tabular_details.php +++ b/application/views/reports/tabular_details.php @@ -21,15 +21,6 @@