Revision fece0d1b
Von Moritz Bunkus vor fast 2 Jahren hinzugefügt
js/kivi.Order.js | ||
---|---|---|
62 | 62 |
if (back_to_caller) data.push({ name: 'back_to_caller', value: '1' }); |
63 | 63 |
if (params.convert_to_purchase_delivery_order_selected_items_only) data.push({ name: 'convert_to_purchase_delivery_order_selected_items_only', value: '1' }); |
64 | 64 |
|
65 |
if (params.data) |
|
66 |
data = $.merge(data, params.data); |
|
67 |
|
|
65 | 68 |
$.post("controller.pl", data, kivi.eval_json_result); |
66 | 69 |
}; |
67 | 70 |
|
... | ... | |
956 | 959 |
}; |
957 | 960 |
|
958 | 961 |
ns.convert_to_purchase_delivery_order_select_items = function(params) { |
959 |
$("#purchase_delivery_order_item_selection_checkall").attr("checked", "checked"); |
|
960 |
|
|
961 |
var $src = $("#row_table_id"); |
|
962 |
var $dest = $("#convert_to_purchase_delivery_order_item_selection_items"); |
|
963 |
|
|
964 |
$dest.data("params", params); |
|
965 |
$dest.empty(); |
|
966 |
|
|
967 |
$("#row_table_id tbody>tr:first-child").each(function(idx, tr) { |
|
968 |
const $row = $(tr); |
|
969 |
const partnumber = $row.find("div[name=partnumber]").text().replaceAll(" ", ""); |
|
970 |
const description = $row.find("input[name='order.orderitems[].description']").val(); |
|
971 |
const qty = $row.find("input[name='order.orderitems[].qty_as_number']").val(); |
|
972 |
const unit = $row.find("select[name='order.orderitems[].unit']").val(); |
|
973 |
var html = |
|
974 |
"<tr class=\"listrow\">" + |
|
975 |
" <td><input type=\"checkbox\" name=\"purchase_delivery_order_item_selection_indexes[+]\" class=\"purchase_delivery_order_item_selection_checkall\" value=\"" + (idx + 1) + "\" checked=\"checked\"></td>" + |
|
976 |
" <td align=\"right\" class=\"numeric\">" + (idx + 1) + "</td>" + |
|
977 |
" <td>" + partnumber + "</td>" + |
|
978 |
" <td>" + description + "</td>" + |
|
979 |
" <td align=\"right\" class=\"numeric\">" + qty + "</td>" + |
|
980 |
" <td>" + unit + "</td>" + |
|
981 |
"</tr>"; |
|
982 |
|
|
983 |
$dest.append(html); |
|
984 |
}); |
|
962 |
var data = $('#order_form').serializeArray(); |
|
963 |
data.push({ name: 'action', value: 'Order/show_conversion_to_purchase_delivery_order_item_selection' }); |
|
985 | 964 |
|
986 | 965 |
kivi.popup_dialog({ |
987 |
id: "convert_to_purchase_delivery_order_item_selection", |
|
988 |
dialog: { |
|
989 |
title: kivi.t8("Select items for delivery order"), |
|
966 |
id: "convert_to_purchase_delivery_order_item_selection", |
|
967 |
url: "controller.pl", |
|
968 |
data: data, |
|
969 |
type: "POST", |
|
970 |
dialog: { title: kivi.t8("Select items for delivery order") }, |
|
971 |
load: function() { |
|
972 |
$("body").data("convert_to_purchase_delivery_order_item_selection_params", params); |
|
990 | 973 |
} |
991 | 974 |
}); |
992 | 975 |
}; |
993 | 976 |
|
994 | 977 |
ns.convert_to_purchase_delivery_order = function() { |
995 |
var $dlg = $("#convert_to_purchase_delivery_order_item_selection"); |
|
996 |
$dlg.dialog('close'); |
|
997 |
|
|
998 |
var params = $("#convert_to_purchase_delivery_order_item_selection_items").data("params"); |
|
978 |
var params = $("body").data("convert_to_purchase_delivery_order_item_selection_params"); |
|
999 | 979 |
params.convert_to_purchase_delivery_order_selected_items_only = 1; |
1000 | 980 |
|
981 |
var $dlg = $("#convert_to_purchase_delivery_order_item_selection"); |
|
982 |
params.data = $dlg.find("tbody input").serializeArray(); |
|
983 |
|
|
984 |
$dlg.dialog('close'); |
|
1001 | 985 |
$dlg.remove(); |
1002 |
$('#order_form').append($dlg); |
|
1003 | 986 |
|
1004 | 987 |
kivi.Order.save(params); |
1005 | 988 |
}; |
Auch abrufbar als: Unified diff
Lieferantenauftrag→Einkaufslieferschein: Lieferantenartikelnummer anzeigen