mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-03 05:12:50 -04:00
Properly parse negative numbers + rename currency_sorter (#1003)
This commit is contained in:
@@ -24,7 +24,7 @@ class Detailed_receivings extends Report
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('employee_name' => $this->lang->line('reports_received_by')),
|
||||
array('supplier' => $this->lang->line('reports_supplied_by')),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('payment_type' => $this->lang->line('reports_payment_type')),
|
||||
array('reference' => $this->lang->line('receivings_reference')),
|
||||
array('comment' => $this->lang->line('reports_comments'))),
|
||||
|
||||
@@ -24,11 +24,11 @@ class Detailed_sales extends Report
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('employee_name' => $this->lang->line('reports_sold_by')),
|
||||
array('customer_name' => $this->lang->line('reports_sold_to')),
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'currency_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'currency_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'currency_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'currency_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter'),
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
|
||||
array('payment_type' => $this->lang->line('sales_amount_tendered')),
|
||||
array('comment' => $this->lang->line('reports_comments'))),
|
||||
'details' => array(
|
||||
|
||||
@@ -16,9 +16,9 @@ class Inventory_summary extends Report
|
||||
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'));
|
||||
array('cost_price' => $this->lang->line('reports_cost_price'), 'sorter' => 'number_sorter'),
|
||||
array('unit_price' => $this->lang->line('reports_unit_price'), 'sorter' => 'number_sorter'),
|
||||
array('subtotal' => $this->lang->line('reports_sub_total_value'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
public function getData(array $inputs)
|
||||
|
||||
@@ -23,11 +23,11 @@ class Specific_customer extends Report
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('sold_by' => $this->lang->line('reports_sold_by')),
|
||||
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'),
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
|
||||
array('payment_type' => $this->lang->line('reports_payment_type')),
|
||||
array('comments' => $this->lang->line('reports_comments'))),
|
||||
'details' => array(
|
||||
|
||||
@@ -23,10 +23,10 @@ class Specific_discount extends Report
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('customer_name' => $this->lang->line('reports_sold_to')),
|
||||
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('profit' => $this->lang->line('reports_profit'), 'sorter' => 'currency_sorter'),
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
|
||||
array('payment_type' => $this->lang->line('reports_payment_type')),
|
||||
array('comments' => $this->lang->line('reports_comments'))),
|
||||
'details' => array(
|
||||
|
||||
@@ -23,11 +23,11 @@ class Specific_employee extends Report
|
||||
array('sale_date' => $this->lang->line('reports_date')),
|
||||
array('quantity' => $this->lang->line('reports_quantity')),
|
||||
array('customer_name' => $this->lang->line('reports_sold_to')),
|
||||
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'),
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'),
|
||||
array('payment_type' => $this->lang->line('reports_payment_type')),
|
||||
array('comments' => $this->lang->line('reports_comments'))),
|
||||
'details' => array(
|
||||
|
||||
@@ -14,11 +14,11 @@ class Summary_categories extends Summary_report
|
||||
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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
protected function _select(array $inputs)
|
||||
|
||||
@@ -14,11 +14,11 @@ class Summary_customers extends Summary_report
|
||||
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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
protected function _select(array $inputs)
|
||||
|
||||
@@ -12,7 +12,7 @@ class Summary_discounts extends Summary_report
|
||||
protected function _get_data_columns()
|
||||
{
|
||||
return array(
|
||||
array('discount' => $this->lang->line('reports_discount_percent'), 'sorter' => 'currency_sorter'),
|
||||
array('discount' => $this->lang->line('reports_discount_percent'), 'sorter' => 'number_sorter'),
|
||||
array('count' => $this->lang->line('reports_count')));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ class Summary_employees extends Summary_report
|
||||
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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
protected function _select(array $inputs)
|
||||
|
||||
@@ -14,11 +14,11 @@ class Summary_items extends Summary_report
|
||||
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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
protected function _select(array $inputs)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Summary_payments extends Summary_report
|
||||
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'));
|
||||
array('amount_tendered' => $this->lang->line('sales_amount_tendered'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
public function getData(array $inputs)
|
||||
|
||||
@@ -14,11 +14,11 @@ class Summary_sales extends Summary_report
|
||||
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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
protected function _select(array $inputs)
|
||||
|
||||
@@ -14,11 +14,11 @@ class Summary_suppliers extends Summary_report
|
||||
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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
|
||||
array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'),
|
||||
array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
protected function _select(array $inputs)
|
||||
|
||||
@@ -12,11 +12,11 @@ class Summary_taxes extends Summary_report
|
||||
protected function _get_data_columns()
|
||||
{
|
||||
return array(
|
||||
array('tax_percent' => $this->lang->line('reports_tax_percent'), 'sorter' => 'currency_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax_percent'), 'sorter' => 'number_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'));
|
||||
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
|
||||
array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'),
|
||||
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'));
|
||||
}
|
||||
|
||||
public function getData(array $inputs)
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="dist/style.css"/>
|
||||
<!-- end mincss template tags -->
|
||||
<!-- start minjs template tags -->
|
||||
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=54e944c909"></script>
|
||||
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=cb5510f85a"></script>
|
||||
<!-- end minjs template tags -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
2
public/dist/opensourcepos.min.js
vendored
2
public/dist/opensourcepos.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -345,10 +345,10 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function currency_sorter(a, b)
|
||||
function number_sorter(a, b)
|
||||
{
|
||||
a = +a.replace(/[^0-9\.]+/g,"");
|
||||
b = +b.replace(/[^0-9\.]+/g,"");
|
||||
a = +a.replace(/[^%\-0-9\.]+/g,"");
|
||||
b = +b.replace(/[^%\-0-9\.]+/g,"");
|
||||
if (a > b) return 1;
|
||||
if (a < b) return -1;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user