Receiving cancel delete should work now (confirm result was ignored)

receivings_items will now store the correct quantity_purchased when
using a value > 1 for receiving_quantity
Receiving delete message corrected
This commit is contained in:
jekkos committed 2015-03-30 16:37:26 +02:00
1 parent 138d1cbeef
commit 9b98f15f69
2 files changed
+18 -21

No files matched your search

+4 -4
View File
@@ -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
+14 -17
View File
@@ -93,13 +93,6 @@ $(document).ready(function()
}, '<?php echo $this->lang->line("recvs_invoice_number_duplicate"); ?>');
$('#date').datePicker({startDate: '<?php echo date("%Y/%M/%d");?>'});
$("#recvs_delete_form").submit(function()
{
if (!confirm('<?php echo $this->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('<?php echo $this->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);