diff --git a/application/models/receiving.php b/application/models/receiving.php index 9e3a0365d..687cfd03a 100644 --- a/application/models/receiving.php +++ b/application/models/receiving.php @@ -74,6 +74,8 @@ class Receiving extends CI_Model foreach($items as $line=>$item) { $cur_item_info = $this->Item->get_info($item['item_id']); + + $items_received = $item['receiving_quantity'] != 0 ? $item['quantity'] * $item['receiving_quantity'] : $item['quantity']; $receivings_items_data = array ( @@ -82,7 +84,7 @@ class Receiving extends CI_Model 'line'=>$item['line'], 'description'=>$item['description'], 'serialnumber'=>$item['serialnumber'], - 'quantity_purchased'=>$item['quantity'], + 'quantity_purchased'=>$items_received, 'discount_percent'=>$item['discount'], 'item_cost_price' => $cur_item_info->cost_price, 'item_unit_price'=>$item['price'], @@ -91,8 +93,6 @@ class Receiving extends CI_Model $this->db->insert('receivings_items',$receivings_items_data); - $items_received = $item['receiving_quantity'] != 0 ? $item['quantity'] * $item['receiving_quantity'] : $item['quantity']; - // update cost price, if changed AND is set in config as wanted if($cur_item_info->cost_price != $item['price'] AND $this->config->item('receiving_calculate_average_price') == 'receiving_calculate_average_price') @@ -158,7 +158,7 @@ class Receiving extends CI_Model 'trans_date'=>date('Y-m-d H:i:s'), 'trans_items'=>$item['item_id'], 'trans_user'=>$employee_id, - 'trans_comment'=>'Deleting sale ' . $receiving_id, + 'trans_comment'=>'Deleting receiving ' . $receiving_id, 'trans_location'=>$item['item_location'], 'trans_inventory'=>$item['quantity_purchased']*-1 diff --git a/application/views/receivings/form.php b/application/views/receivings/form.php index ebb8082c5..dbf05a69a 100755 --- a/application/views/receivings/form.php +++ b/application/views/receivings/form.php @@ -93,13 +93,6 @@ $(document).ready(function() }, 'lang->line("recvs_invoice_number_duplicate"); ?>'); $('#date').datePicker({startDate: ''}); - $("#recvs_delete_form").submit(function() - { - if (!confirm('lang->line("recvs_delete_confirmation"); ?>')) - { - return false; - } - }); var format_item = function(row) { @@ -173,17 +166,21 @@ $(document).ready(function() { success:function(response) { - tb_remove(); - set_feedback(response.message,'success_message',false); - var $element = get_table_row(id).parent().parent(); - $element.find("td").animate({backgroundColor:"green"},1200,"linear") - .end().animate({opacity:0},1200,"linear",function() + if (confirm('lang->line("recvs_delete_confirmation"); ?>')) { - $element.next().remove(); - $(this).remove(); - //Re-init sortable table as we removed a row - update_sortable_table(); - }); + tb_remove(); + set_feedback(response.message,'success_message',false); + var $element = get_table_row(id).parent().parent(); + $element.find("td").animate({backgroundColor:"green"},1200,"linear") + .end().animate({opacity:0},1200,"linear",function() + { + $element.next().remove(); + $(this).remove(); + //Re-init sortable table as we removed a row + update_sortable_table(); + }); + } + return false; }, error: function(jqXHR, textStatus, errorThrown) { set_feedback(textStatus,'error_message',true);