epic-s6ts
[kivitendo-erp.git] / js / calculate_qty.js
1 function calculate_qty_selection_dialog(input_name, input_id, formel_name, formel_id) {
2   // The target input element is determined by it's dom id or by it's name.
3   // The formula input element (the one containing the formula) is determined by it's dom id or by it's name.
4   // If the id is not provided the name is used.
5   if (formel_id) {
6     var formel = $('#' + formel_id).val();
7   } else {
8     var formel = $('[name="' + formel_name + '"]').val();
9   }
10   var url  = "common.pl";
11   var data = {
12     action:     "calculate_qty",
13     input_name: input_name,
14     input_id:   input_id,
15     formel:     formel
16   };
17   kivi.popup_dialog({
18     id:     'calc_qty_dialog',
19     url:    url,
20     data:   data,
21     dialog: {
22       width:  500,
23       height: 400,
24       title:  kivi.t8('Please enter values'),
25     }
26   });
27 }