mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-03-21 16:33:34 -04:00
Merge pull request #29 from marteserede/master
Two small edits (#27 and #28)
This commit is contained in:
@@ -344,7 +344,7 @@ class Receivings extends Secure_area
|
||||
'supplier_id' => $this->input->post('supplier_id') ? $this->input->post('supplier_id') : null,
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment'),
|
||||
'invoice_number' => $this->input->post('invoice_number')
|
||||
'invoice_number' => $this->input->post('invoice_number') != '' ? $this->input->post('invoice_number') : null
|
||||
);
|
||||
|
||||
if ($this->Receiving->update($receiving_data, $receiving_id))
|
||||
|
||||
@@ -614,7 +614,7 @@ class Item extends CI_Model
|
||||
$old_total_quantity = $this->db->get()->row()->quantity;
|
||||
|
||||
$total_quantity = $old_total_quantity + $items_received;
|
||||
$average_price = ($items_received * $new_price + $old_total_quantity * $old_price)/$total_quantity;
|
||||
$average_price = bcdiv(bcadd(bcmul($items_received, $new_price), bcmul($old_total_quantity, $old_price)), $total_quantity);
|
||||
|
||||
$data = array('cost_price' => $average_price);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user