Update totals calculation

Update tax inclusive calculation
This commit is contained in:
jekkos-t520
2015-03-06 00:58:44 +01:00
parent 0e357f14f6
commit 4ac1a943eb
6 changed files with 13 additions and 13 deletions

View File

@@ -481,8 +481,8 @@ class Sales extends Secure_area
$this->sale_lib->copy_entire_sale($sale_id);
$data['cart']=$this->sale_lib->get_cart();
$data['payments']=$this->sale_lib->get_payments();
$data['subtotal']=$this->sale_lib->get_subtotal();
$data['discounted_subtotal']=$this->sale_lib->get_subtotal(TRUE);
$data['subtotal']=$this->sale_lib->get_subtotal(TRUE);
$data['discounted_subtotal']=$this->sale_lib->get_subtotal();
$data['taxes']=$this->sale_lib->get_taxes();
$data['total']=$this->sale_lib->get_total();
$data['discounts']=$this->sale_lib->get_discounts();
@@ -638,7 +638,7 @@ class Sales extends Secure_area
$data['stock_locations']=$this->Stock_locations->get_allowed_locations('sales');
$data['stock_location']=$this->sale_lib->get_sale_location();
$data['subtotal']=$this->sale_lib->get_subtotal();
$data['subtotal']=$this->sale_lib->get_subtotal(TRUE);
$data['taxes']=$this->sale_lib->get_taxes();
$data['discounts']=$this->sale_lib->get_discounts();
$data['total']=$this->sale_lib->get_total();

View File

@@ -91,7 +91,7 @@ $lang["config_print_left_margin_required"] = "The default left margin is a requi
$lang["config_print_right_margin"] = "Margin Right";
$lang["config_print_right_margin_number"] = "The default right margin must be a number";
$lang["config_print_right_margin_required"] = "The default right margin is a required field";
$lang["config_print_silently"] = "Top Margin";
$lang["config_print_silently"] = "Show Print Dialog";
$lang["config_print_top_margin"] = "Margin Top";
$lang["config_print_top_margin_number"] = "The default top margin must be a number";
$lang["config_print_top_margin_required"] = "The default top margin is a required field";

View File

@@ -91,7 +91,7 @@ $lang["config_print_left_margin_required"] = "The default left margin is a requi
$lang["config_print_right_margin"] = "Marge Rechts";
$lang["config_print_right_margin_number"] = "The default right margin must be a number";
$lang["config_print_right_margin_required"] = "The default right margin is a required field";
$lang["config_print_silently"] = "Marge Boven";
$lang["config_print_silently"] = "Toon Printvenster";
$lang["config_print_top_margin"] = "Marge Boven";
$lang["config_print_top_margin_number"] = "The default top margin must be a number";
$lang["config_print_top_margin_required"] = "The default top margin is a required field";

View File

@@ -575,10 +575,10 @@ class Sale_lib
return to_currency_no_money($subtotal);
}
function get_item_total_tax_exclusive($item_id, $quantity, $price, $discount_percentage, $include_discounts=TRUE)
function get_item_total_tax_exclusive($item_id, $quantity, $price, $discount_percentage, $include_discount=FALSE)
{
$tax_info = $this->CI->Item_taxes->get_info($item_id);
$item_price = $this->get_item_total($quantity, $price, $discount_percentage);
$item_price = $this->get_item_total($quantity, $price, $discount_percentage, $include_discount);
// only additive tax here
foreach($tax_info as $tax)
{
@@ -609,7 +609,7 @@ class Sale_lib
function get_item_tax($quantity, $price, $discount_percentage, $tax_percentage)
{
$price = $this->get_item_total($quantity, $price, $discount_percentage);
$price = $this->get_item_total($quantity, $price, $discount_percentage, TRUE);
$tax_fraction = bcdiv($tax_percentage, 100, PRECISION);
if ($this->CI->config->config['tax_included'])
@@ -639,9 +639,9 @@ class Sale_lib
return $subtotal;
}
function get_total($discount_included=TRUE)
function get_total($discount_included=FALSE)
{
$total = $this->calculate_subtotal();
$total = $this->calculate_subtotal($discount_included);
foreach($this->get_taxes() as $tax)
{

View File

@@ -86,7 +86,7 @@ if (isset($error_message))
<tr>
<td colspan="3" style='text-align:right;border-top:2px solid #000000;'><?php echo $this->lang->line('sales_sub_total'); ?></td>
<td style='text-align:right;border-top:2px solid #000000;'><?php echo to_currency($subtotal); ?></td>
<td style='text-align:right;border-top:2px solid #000000;'><?php echo to_currency($discounted_subtotal); ?></td>
</tr>
<?php if ($this->Appconfig->get('show_total_discount')): ?>
<?php foreach($discounts as $name=>$value) { ?>
@@ -97,7 +97,7 @@ if (isset($error_message))
<?php }; ?>
<tr>
<td colspan="3" style='text-align:right;border-top:2px solid #000000;'><?php echo $this->lang->line('sales_sub_total'); ?></td>
<td style='text-align:right;border-top:2px solid #000000;'><?php echo to_currency($discounted_subtotal); ?></td>
<td style='text-align:right;border-top:2px solid #000000;'><?php echo to_currency($subtotal); ?></td>
</tr>
<?php endif; ?>
<?php if ($this->Appconfig->get('receipt_show_taxes')): ?>

View File

@@ -90,7 +90,7 @@ config_print_left_margin_required,The default left margin is a required field,Th
config_print_right_margin,Marge Rechts,Margin Right,Margin Right,Margin Right,Margin Right,Margin Right,Margin Right,Margin Right,Margin Right
config_print_right_margin_number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number,The default right margin must be a number
config_print_right_margin_required,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field,The default right margin is a required field
config_print_silently,Marge Boven,Top Margin,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog
config_print_silently,Toon Printvenster,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog,Show Print Dialog
config_print_top_margin,Marge Boven,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top
config_print_top_margin_number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number
config_print_top_margin_required,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field
1 label nl-BE es en fr zh ru th tr id
90 config_print_right_margin Marge Rechts Margin Right Margin Right Margin Right Margin Right Margin Right Margin Right Margin Right Margin Right
91 config_print_right_margin_number The default right margin must be a number The default right margin must be a number The default right margin must be a number The default right margin must be a number The default right margin must be a number The default right margin must be a number The default right margin must be a number The default right margin must be a number The default right margin must be a number
92 config_print_right_margin_required The default right margin is a required field The default right margin is a required field The default right margin is a required field The default right margin is a required field The default right margin is a required field The default right margin is a required field The default right margin is a required field The default right margin is a required field The default right margin is a required field
93 config_print_silently Marge Boven Toon Printvenster Top Margin Show Print Dialog Show Print Dialog Show Print Dialog Show Print Dialog Show Print Dialog Show Print Dialog Show Print Dialog Show Print Dialog
94 config_print_top_margin Marge Boven Margin Top Margin Top Margin Top Margin Top Margin Top Margin Top Margin Top Margin Top
95 config_print_top_margin_number The default top margin must be a number The default top margin must be a number The default top margin must be a number The default top margin must be a number The default top margin must be a number The default top margin must be a number The default top margin must be a number The default top margin must be a number The default top margin must be a number
96 config_print_top_margin_required The default top margin is a required field The default top margin is a required field The default top margin is a required field The default top margin is a required field The default top margin is a required field The default top margin is a required field The default top margin is a required field The default top margin is a required field The default top margin is a required field