Revision 3b31aeed
Von Moritz Bunkus vor fast 2 Jahren hinzugefügt
js/kivi.Order.js | ||
---|---|---|
60 | 60 |
data.push({ name: 'action', value: 'Order/' + action }); |
61 | 61 |
|
62 | 62 |
if (back_to_caller) data.push({ name: 'back_to_caller', value: '1' }); |
63 |
if (params.convert_to_purchase_delivery_order_selected_items_only) data.push({ name: 'convert_to_purchase_delivery_order_selected_items_only', value: '1' }); |
|
63 | 64 |
|
64 | 65 |
$.post("controller.pl", data, kivi.eval_json_result); |
65 | 66 |
}; |
... | ... | |
954 | 955 |
window.open("controller.pl?action=CustomerVendor/edit&db=" + encodeURIComponent(db) + "&id=" + encodeURIComponent($(id_selector).val()), '_blank'); |
955 | 956 |
}; |
956 | 957 |
|
958 |
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 |
}); |
|
985 |
|
|
986 |
kivi.popup_dialog({ |
|
987 |
id: "convert_to_purchase_delivery_order_item_selection", |
|
988 |
dialog: { |
|
989 |
title: kivi.t8("Select items for delivery order"), |
|
990 |
} |
|
991 |
}); |
|
992 |
}; |
|
993 |
|
|
994 |
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"); |
|
999 |
params.convert_to_purchase_delivery_order_selected_items_only = 1; |
|
1000 |
|
|
1001 |
$dlg.remove(); |
|
1002 |
$('#order_form').append($dlg); |
|
1003 |
|
|
1004 |
kivi.Order.save(params); |
|
1005 |
}; |
|
957 | 1006 |
}); |
958 | 1007 |
|
959 | 1008 |
$(function() { |
Auch abrufbar als: Unified diff
Lieferantenauftrag→Einkaufslieferschein: optional nur mit ausgewählten Positionen