X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8ee7fcb0ed6575b116050ccbe711a26f7d1a86fc..53593baa211863fbf66540cf1bcc36c8fb37257f:/js/kivi.DeliveryOrder.js diff --git a/js/kivi.DeliveryOrder.js b/js/kivi.DeliveryOrder.js index 87fca36fb..00a929450 100644 --- a/js/kivi.DeliveryOrder.js +++ b/js/kivi.DeliveryOrder.js @@ -91,8 +91,8 @@ namespace('kivi.DeliveryOrder', function(ns) { type: $("#type").val(), parts_id: $row.find("[name$=parts_id]").val(), unit: $row.find("[name$=unit]").val(), - qty_as_number: $("qty_" + id).val(), - stock: $("stock_" + id).val(), + qty_as_number: $row.find("[name$=qty_as_number]").val(), + stock: $row.find("[name$=stock_info]").val(), item_id: id, row: $row.attr("id"), }, @@ -106,8 +106,12 @@ namespace('kivi.DeliveryOrder', function(ns) { let data = []; $("#stock-in-out-table tr.listrow").each((i,row) => { + let qty = kivi.parse_amount($(row).find(".data-qty").val()); + + if (qty === 0) return; + data.push({ - qty: kivi.parse_amount($(row).find(".data-qty").val()), + qty: qty, warehouse_id: $(row).find(".data-warehouse-id").val(), bin_id: $(row).find(".data-bin-id").val(), chargenumber: $(row).find(".data-chargenumber").val(), @@ -121,12 +125,14 @@ namespace('kivi.DeliveryOrder', function(ns) { $.post("controller.pl", kivi.serialize({ - action: "DeliveryOrder/pack_stock_information", + action: "DeliveryOrder/update_stock_information", + unit: $("#" + row).find("[name$=unit]").val(), stock_info: data, row: row }), (data) => { - $("#" + row + " .data-stock-info").val(data); + $("#" + row + " .data-stock-info").val(data.stock_info); + $("#" + row + " .data-stock-qty").text(data.stock_qty) $("#stock_in_out_dialog").dialog("close"); } );