diff --git a/application/libraries/Sale_lib.php b/application/libraries/Sale_lib.php index ff32e6dc5..c2015d110 100644 --- a/application/libraries/Sale_lib.php +++ b/application/libraries/Sale_lib.php @@ -501,7 +501,7 @@ class Sale_lib { return array(); } - + $taxes = array(); foreach($this->get_cart() as $line=>$item) { @@ -572,21 +572,14 @@ class Sale_lib $subtotal = 0; foreach($this->get_cart() as $item) { - if ($this->is_customer_taxable()) + if ($this->CI->config->config['tax_included']) + { + $subtotal += $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount']); + } + else { $subtotal += $this->get_item_total($item['quantity'], $item['price'], $item['discount']); } - else - { - if ($this->CI->config->config['tax_included']) - { - $subtotal += $this->get_item_total($item['quantity'], $item['price'], $item['discount']); - } - else - { - $subtotal += $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount']); - } - } } return $subtotal; } @@ -595,12 +588,9 @@ class Sale_lib { $total = $this->calculate_subtotal(); - if (!$this->CI->config->config['tax_included']) + foreach($this->get_taxes() as $tax) { - foreach($this->get_taxes() as $tax) - { - $total = bcadd($total, $tax, 4); - } + $total = bcadd($total, $tax, 4); } return to_currency_no_money($total); diff --git a/application/models/receiving.php b/application/models/receiving.php index 7204249b2..3191f0ae8 100644 --- a/application/models/receiving.php +++ b/application/models/receiving.php @@ -50,7 +50,7 @@ class Receiving extends CI_Model 'employee_id'=>$employee_id, 'payment_type'=>$payment_type, 'comment'=>$comment, - 'invoice_number'=>empty($invoice_number) ? NULL : $invoice_number + 'invoice_number'=>$invoice_number ); //Run these queries as a transaction, we want to make sure we do all or nothing @@ -81,13 +81,13 @@ class Receiving extends CI_Model $this->db->insert('receivings_items',$receivings_items_data); //Update stock quantity - $item_quantity = $this->Item_quantities->get_item_quantity($item['item_id'], $item['item_location']); - $this->Item_quantities->save(array('quantity'=>$item_quantity->quantity + $item['quantity'], + $item_quantity = $this->Item_quantities->get_item_quantity($item['item_id'], $item['item_location']); + $items_received = $item['quantity'] * $item['receiving_quantity']; + $this->Item_quantities->save(array('quantity'=>$item_quantity->quantity + $items_received, 'item_id'=>$item['item_id'], 'location_id'=>$item['item_location']), $item['item_id'], $item['item_location']); - $qty_recv = $item['quantity']; $recv_remarks ='RECV '.$receiving_id; $inv_data = array ( @@ -96,7 +96,7 @@ class Receiving extends CI_Model 'trans_user'=>$employee_id, 'trans_location'=>$item['item_location'], 'trans_comment'=>$recv_remarks, - 'trans_inventory'=>$qty_recv + 'trans_inventory'=>$items_received ); $this->Inventory->insert($inv_data); diff --git a/application/models/sale.php b/application/models/sale.php index fe4766f85..39db20f74 100644 --- a/application/models/sale.php +++ b/application/models/sale.php @@ -59,7 +59,7 @@ class Sale extends CI_Model 'employee_id'=>$employee_id, 'payment_type'=>$payment_types, 'comment'=>$comment, - 'invoice_number'=>empty($invoice_number) ? NULL : $invoice_number + 'invoice_number'=>$invoice_number ); //Run these queries as a transaction, we want to make sure we do all or nothing diff --git a/application/views/receivings/receipt.php b/application/views/receivings/receipt.php index 174bbef71..514a0d816 100644 --- a/application/views/receivings/receipt.php +++ b/application/views/receivings/receipt.php @@ -37,7 +37,8 @@ if (isset($error_message))