mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-15 20:37:50 -04:00
Fix summary report and detailed sale report different tax issue (#1133)
This commit is contained in:
@@ -146,17 +146,17 @@ class Sale extends CI_Model
|
||||
$decimals = totals_decimals();
|
||||
|
||||
$sale_price = 'sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100)';
|
||||
$sale_cost = 'ROUND(SUM(sales_items.item_cost_price * sales_items.quantity_purchased), ' . $decimals . ')';
|
||||
$tax = 'ROUND(IFNULL(SUM(sales_items_taxes.tax), 0), ' . $decimals . ')';
|
||||
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
|
||||
$tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)';
|
||||
|
||||
if($this->config->item('tax_included'))
|
||||
{
|
||||
$sale_total = 'ROUND(SUM(' . $sale_price . '),' . $decimals . ')';
|
||||
$sale_total = 'ROUND(SUM(' . $sale_price . '), ' . $decimals . ')';
|
||||
$sale_subtotal = $sale_total . ' - ' . $tax;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_subtotal = 'ROUND(SUM(' . $sale_price . '),' . $decimals . ')';
|
||||
$sale_subtotal = 'ROUND(SUM(' . $sale_price . '), ' . $decimals . ')';
|
||||
$sale_total = $sale_subtotal . ' + ' . $tax;
|
||||
}
|
||||
|
||||
@@ -1084,17 +1084,17 @@ class Sale extends CI_Model
|
||||
$decimals = totals_decimals();
|
||||
|
||||
$sale_price = 'sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100)';
|
||||
$sale_cost = 'ROUND(IFNULL(SUM(sales_items.item_cost_price * sales_items.quantity_purchased), 0), ' . $decimals . ')';
|
||||
$tax = 'ROUND(IFNULL(SUM(sales_items_taxes.tax), 0), ' . $decimals . ')';
|
||||
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
|
||||
$tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)';
|
||||
|
||||
if($this->config->item('tax_included'))
|
||||
{
|
||||
$sale_total = 'ROUND(SUM(' . $sale_price . '),' . $decimals . ')';
|
||||
$sale_total = 'ROUND(SUM(' . $sale_price . '), ' . $decimals . ')';
|
||||
$sale_subtotal = $sale_total . ' - ' . $tax;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_subtotal = 'ROUND(SUM(' . $sale_price . '),' . $decimals . ')';
|
||||
$sale_subtotal = 'ROUND(SUM(' . $sale_price . '), ' . $decimals . ')';
|
||||
$sale_total = $sale_subtotal . ' + ' . $tax;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,17 +24,17 @@ abstract class Summary_report extends Report
|
||||
$decimals = totals_decimals();
|
||||
|
||||
$sale_price = 'sales_items.item_unit_price * sales_items.quantity_purchased * (1 - sales_items.discount_percent / 100)';
|
||||
$sale_cost = 'ROUND(IFNULL(SUM(sales_items.item_cost_price * sales_items.quantity_purchased), 0), ' . $decimals . ')';
|
||||
$tax = 'ROUND(IFNULL(SUM(sales_items_taxes.tax), 0), ' . $decimals . ')';
|
||||
$sale_cost = 'SUM(sales_items.item_cost_price * sales_items.quantity_purchased)';
|
||||
$tax = 'IFNULL(SUM(sales_items_taxes.tax), 0)';
|
||||
|
||||
if($this->config->item('tax_included'))
|
||||
{
|
||||
$sale_total = 'ROUND(SUM(' . $sale_price . '),' . $decimals . ')';
|
||||
$sale_total = 'ROUND(SUM(' . $sale_price . '), ' . $decimals . ')';
|
||||
$sale_subtotal = $sale_total . ' - ' . $tax;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_subtotal = 'ROUND(SUM(' . $sale_price . '),' . $decimals . ')';
|
||||
$sale_subtotal = 'ROUND(SUM(' . $sale_price . '), ' . $decimals . ')';
|
||||
$sale_total = $sale_subtotal . ' + ' . $tax;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class Summary_report extends Report
|
||||
ON sales.sale_id = sales_items_taxes.sale_id
|
||||
INNER JOIN ' . $this->db->dbprefix('sales_items') . ' AS sales_items
|
||||
ON sales_items.sale_id = sales_items_taxes.sale_id AND sales_items.line = sales_items_taxes.line
|
||||
WHERE sale_status = 0 AND ' . $where . '
|
||||
WHERE sales.sale_status = 0 AND ' . $where . '
|
||||
GROUP BY sale_id, item_id, line
|
||||
)'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user