mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-28 02:52:14 -04:00
On document reprint retrieve the taxes originally applied to the reprinted document.
This commit is contained in:
@@ -910,7 +910,7 @@ class Sales extends Secure_Controller
|
||||
$data['payments'] = $this->sale_lib->get_payments();
|
||||
$data['selected_payment_type'] = $this->sale_lib->get_payment_type();
|
||||
|
||||
$tax_details = $this->tax_lib->get_taxes($data['cart']);
|
||||
$tax_details = $this->tax_lib->get_taxes($data['cart'], $sale_id);
|
||||
$data['taxes'] = $this->Sale->get_sales_taxes($sale_id);
|
||||
$data['discount'] = $this->sale_lib->get_discount();
|
||||
$data['transaction_time'] = to_datetime(strtotime($sale_info['sale_time']));
|
||||
|
||||
@@ -52,7 +52,7 @@ class Tax_lib
|
||||
/**
|
||||
* Compute taxes for all items in the cart
|
||||
*/
|
||||
public function get_taxes(&$cart)
|
||||
public function get_taxes(&$cart, $sale_id = -1)
|
||||
{
|
||||
$register_mode = $this->CI->sale_lib->get_mode();
|
||||
$tax_decimals = tax_decimals();
|
||||
@@ -72,7 +72,15 @@ class Tax_lib
|
||||
{
|
||||
// Start of current Base System tax calculations
|
||||
|
||||
$tax_info = $this->CI->Item_taxes->get_info($item['item_id']);
|
||||
if($sale_id == -1)
|
||||
{
|
||||
$tax_info = $this->CI->Item_taxes->get_info($item['item_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tax_info = $this->CI->Sale->get_sales_item_taxes($sale_id, $item['item_id']);
|
||||
|
||||
}
|
||||
$tax_group_sequence = 0;
|
||||
$cascade_level = 0;
|
||||
$cascade_basis_level = 0;
|
||||
|
||||
@@ -806,6 +806,20 @@ class Sale extends CI_Model
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the taxes applied to a sale for a particular item
|
||||
*/
|
||||
public function get_sales_item_taxes($sale_id, $item_id)
|
||||
{
|
||||
$this->db->select('item_id, name, percent');
|
||||
$this->db->from('sales_items_taxes');
|
||||
$this->db->where('sale_id',$sale_id);
|
||||
$this->db->where('item_id',$item_id);
|
||||
|
||||
//return an array of taxes for an item
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes list of sales
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user