www/js/inv_miscs.js

changeset 528
202272a28052
parent 514
3c680d1dea35
child 563
acdd54144838
equal deleted inserted replaced
527:9dfefad3ae1d 528:202272a28052
18 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 18 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 *****************************************************************************/ 19 *****************************************************************************/
20 20
21 21
22 function createDelElements() { 22 function createDelElements() {
23 $('#eventWindow').jqxWindow({ 23 $('#eventWindow').jqxWindow({
24 theme: theme, 24 theme: theme,
25 position: { x: 490, y: 210 }, 25 position: { x: 490, y: 210 },
26 width: 300, 26 width: 300,
27 height: 175, 27 height: 175,
28 resizable: false, 28 resizable: false,
29 isModal: true, 29 isModal: true,
30 modalOpacity: 0.4, 30 modalOpacity: 0.4,
31 okButton: $('#delOk'), 31 okButton: $('#delOk'),
32 cancelButton: $('#delCancel'), 32 cancelButton: $('#delCancel'),
33 initContent: function () { 33 initContent: function() {
34 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); 34 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
35 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); 35 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
36 $('#delCancel').focus(); 36 $('#delCancel').focus();
37 } 37 }
38 }); 38 });
39 $('#eventWindow').jqxWindow('hide'); 39 $('#eventWindow').jqxWindow('hide');
40 } 40 }
41 41
42 42
43 $(document).ready(function () { 43 $(document).ready(function() {
44 44
45 function calcTotal(cost, inventory) { 45 function calcTotal(cost, inventory) {
46 46
47 $('#totval').val(cost * (inventory / 1000)); 47 $('#totval').val(cost * (inventory / 1000));
48 } 48 }
49 49
50 function prompts(isweight) { 50 function prompts(isweight) {
51 51
52 if (isweight) { 52 if (isweight) {
53 $("#pmpt_cost").html('Prijs per kg:'); 53 $('#pmpt_cost').html('Prijs per kg:');
54 $("#pmpt_inventory").html('Voorraad gram:'); 54 $('#pmpt_inventory').html('Voorraad gram:');
55 } else { 55 } else {
56 $("#pmpt_cost").html('Prijs per liter:'); 56 $('#pmpt_cost').html('Prijs per liter:');
57 $("#pmpt_inventory").html('Voorraad ml:'); 57 $('#pmpt_inventory').html('Voorraad ml:');
58 } 58 }
59 } 59 }
60 60
61 var dataRecord = {}, 61 var dataRecord = {},
62 url = 'includes/db_inventory_miscs.php', 62 url = 'includes/db_inventory_miscs.php',
63 // prepare the data 63 // prepare the data
64 source = { 64 source = {
65 datatype: "json", 65 datatype: 'json',
66 cache: false, 66 cache: false,
67 datafields: [ 67 datafields: [
68 { name: 'record', type: 'number' }, 68 { name: 'record', type: 'number' },
69 { name: 'name', type: 'string' }, 69 { name: 'name', type: 'string' },
70 { name: 'type', type: 'string' }, 70 { name: 'type', type: 'string' },
71 { name: 'use_use', type: 'string' }, 71 { name: 'use_use', type: 'string' },
72 { name: 'time', type: 'int' }, 72 { name: 'time', type: 'int' },
73 { name: 'amount', type: 'float' }, 73 { name: 'amount', type: 'float' },
74 { name: 'amount_is_weight', type: 'int' }, 74 { name: 'amount_is_weight', type: 'int' },
75 { name: 'use_for', type: 'string' }, 75 { name: 'use_for', type: 'string' },
76 { name: 'notes', type: 'string' }, 76 { name: 'notes', type: 'string' },
77 { name: 'always_on_stock', type: 'int' }, 77 { name: 'always_on_stock', type: 'int' },
78 { name: 'inventory', type: 'float' }, 78 { name: 'inventory', type: 'float' },
79 { name: 'cost', type: 'float' }, 79 { name: 'cost', type: 'float' },
80 { name: 'production_date', type: 'string' }, 80 { name: 'production_date', type: 'string' },
81 { name: 'tht_date', type: 'string' } 81 { name: 'tht_date', type: 'string' }
82 ], 82 ],
83 id: 'record', 83 id: 'record',
84 url: url, 84 url: url,
85 deleterow: function (rowid, commit) { 85 deleterow: function(rowid, commit) {
86 // synchronize with the server - send delete command 86 // synchronize with the server - send delete command
87 var data = "delete=true&" + $.param({ record: rowid }); 87 var data = 'delete=true&' + $.param({ record: rowid });
88 $.ajax({ 88 $.ajax({
89 dataType: 'json', 89 dataType: 'json',
90 url: url, 90 url: url,
91 cache: false, 91 cache: false,
92 data: data, 92 data: data,
93 type: "POST", 93 type: 'POST',
94 success: function (data, status, xhr) { 94 success: function(data, status, xhr) {
95 commit(true); 95 commit(true);
96 location.reload( true ); 96 location.reload(true);
97 }, 97 },
98 error: function (jqXHR, textStatus, errorThrown) { 98 error: function(jqXHR, textStatus, errorThrown) {
99 commit(false); 99 commit(false);
100 } 100 }
101 }); 101 });
102 }, 102 },
103 addrow: function (rowid, rowdata, position, commit) { 103 addrow: function(rowid, rowdata, position, commit) {
104 var data = "insert=true&" + $.param(rowdata); 104 var data = 'insert=true&' + $.param(rowdata);
105 $.ajax({ 105 $.ajax({
106 dataType: 'json', 106 dataType: 'json',
107 url: url, 107 url: url,
108 cache: false, 108 cache: false,
109 data: data, 109 data: data,
110 type: "POST", 110 type: 'POST',
111 success: function (data, status, xhr) { 111 success: function(data, status, xhr) {
112 commit(true); 112 commit(true);
113 location.reload( true ); 113 location.reload(true);
114 }, 114 },
115 error: function(jqXHR, textStatus, errorThrown) { 115 error: function(jqXHR, textStatus, errorThrown) {
116 commit(false); 116 commit(false);
117 } 117 }
118 }); 118 });
119 }, 119 },
120 updaterow: function (rowid, rowdata, commit) { 120 updaterow: function(rowid, rowdata, commit) {
121 var data = "update=true&" + $.param(rowdata); 121 var data = 'update=true&' + $.param(rowdata);
122 $.ajax({ 122 $.ajax({
123 dataType: 'json', 123 dataType: 'json',
124 url: url, 124 url: url,
125 cache: false, 125 cache: false,
126 data: data, 126 data: data,
127 type: "POST", 127 type: 'POST',
128 success: function (data, status, xhr) { 128 success: function(data, status, xhr) {
129 commit(true); 129 commit(true);
130 location.reload( true ); 130 location.reload(true);
131 }, 131 },
132 error: function(jqXHR, textStatus, errorThrown) { 132 error: function(jqXHR, textStatus, errorThrown) {
133 commit(false); 133 commit(false);
134 } 134 }
135 }); 135 });
136 } 136 }
137 }, 137 },
138 dataAdapter = new $.jqx.dataAdapter(source), 138 dataAdapter = new $.jqx.dataAdapter(source),
139 editrow = -1; 139 editrow = -1;
140 140
141 // initialize the input fields. 141 // initialize the input fields.
142 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); 142 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
143 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); 143 $('#notes').jqxInput({ theme: theme, width: 800, height: 100 });
144 144
145 $("#type").jqxDropDownList({theme: theme, 145 $('#type').jqxDropDownList({theme: theme,
146 source: MiscTypeAdapter, 146 source: MiscTypeAdapter,
147 valueMember: 'nl', 147 valueMember: 'nl',
148 displayMember: 'nl', 148 displayMember: 'nl',
149 width: 180, 149 width: 180,
150 height: 23, 150 height: 23,
151 autoDropDownHeight: true 151 autoDropDownHeight: true
152 }); 152 });
153 $("#use_use").jqxDropDownList({ 153 $('#use_use').jqxDropDownList({
154 theme: theme, 154 theme: theme,
155 source: MiscUseAdapter, 155 source: MiscUseAdapter,
156 valueMember: 'nl', 156 valueMember: 'nl',
157 displayMember: 'nl', 157 displayMember: 'nl',
158 width: 180, 158 width: 180,
159 height: 23, 159 height: 23,
160 autoDropDownHeight: true 160 autoDropDownHeight: true
161 }); 161 });
162 $("#time").jqxNumberInput( PosInt ); 162 $('#time').jqxNumberInput(PosInt);
163 $("#amount_is_weight").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 163 $('#amount_is_weight').jqxCheckBox({ theme: theme, width: 120, height: 23 });
164 $("#use_for").jqxInput({ theme: theme, width: 640, height: 48 }); 164 $('#use_for').jqxInput({ theme: theme, width: 640, height: 48 });
165 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 165 $('#always_on_stock').jqxCheckBox({ theme: theme, width: 120, height: 23 });
166 $("#inventory").jqxNumberInput( Spin1dec ); 166 $('#inventory').jqxNumberInput(Spin1dec);
167 $("#production_date").jqxDateTimeInput( Dateopts ); 167 $('#production_date').jqxDateTimeInput(Dateopts);
168 $("#cost").jqxNumberInput( Spin2dec ); 168 $('#cost').jqxNumberInput(Spin2dec);
169 $("#tht_date").jqxDateTimeInput( Dateopts ); 169 $('#tht_date').jqxDateTimeInput(Dateopts);
170 $("#totval").jqxNumberInput( Show2dec ); 170 $('#totval').jqxNumberInput(Show2dec);
171 171
172 // initialize jqxGrid 172 // initialize jqxGrid
173 $("#jqxgrid").jqxGrid({ 173 $('#jqxgrid').jqxGrid({
174 width: 1280, 174 width: 1280,
175 height: 630, 175 height: 630,
176 source: dataAdapter, 176 source: dataAdapter,
177 theme: theme, 177 theme: theme,
178 showstatusbar: true, 178 showstatusbar: true,
179 renderstatusbar: function (statusbar) { 179 renderstatusbar: function(statusbar) {
180 var container, addButton, impButton; 180 var container, addButton, impButton;
181 container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); 181 container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
182 addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); 182 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' +
183 impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>"); 183 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>');
184 container.append(addButton); 184 impButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' +
185 container.append(impButton); 185 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Import</span></div>');
186 statusbar.append(container); 186 container.append(addButton);
187 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); 187 container.append(impButton);
188 impButton.jqxButton({ theme: theme, width: 90, height: 20 }); 188 statusbar.append(container);
189 // add new row. 189 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
190 addButton.click(function (event) { 190 impButton.jqxButton({ theme: theme, width: 90, height: 20 });
191 editrow = -1; 191 // add new row.
192 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); 192 addButton.click(function(event) {
193 $("#name").val(''); 193 editrow = -1;
194 $("#type").val('Specerij'); 194 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
195 $("#use_use").val('Starter'); 195 $('#name').val('');
196 $("#time").val(0); 196 $('#type').val('Specerij');
197 $("#amount_is_weight").val(1); 197 $('#use_use').val('Starter');
198 $("#use_for").val(''); 198 $('#time').val(0);
199 $("#notes").val(''); 199 $('#amount_is_weight').val(1);
200 $("#always_on_stock").val(0); 200 $('#use_for').val('');
201 $("#inventory").val(0); 201 $('#notes').val('');
202 $("#cost").val(0); 202 $('#always_on_stock').val(0);
203 $("#production_date").val(''); 203 $('#inventory').val(0);
204 $("#tht_date").val(''); 204 $('#cost').val(0);
205 $("#popupWindow").jqxWindow('open'); 205 $('#production_date').val('');
206 }); 206 $('#tht_date').val('');
207 impButton.click(function (event) { 207 $('#popupWindow').jqxWindow('open');
208 window.location.href = 'import_ingredients.php?select=miscs'; 208 });
209 }); 209 impButton.click(function(event) {
210 }, 210 window.location.href = 'import_ingredients.php?select=miscs';
211 filterable: true, 211 });
212 filtermode: 'excel', 212 },
213 columns: [ 213 filterable: true,
214 { text: 'Ingredient naam', datafield: 'name', menu: false }, 214 filtermode: 'excel',
215 { text: 'Type', datafield: 'type', align: 'left', width: 120 }, 215 columns: [
216 { text: 'Gebruik', datafield: 'use_use', align: 'left', width: 120 }, 216 { text: 'Ingredient naam', datafield: 'name', menu: false },
217 { text: 'Tijd', datafield: 'time', width: 90, align: 'left', menu: false, 217 { text: 'Type', datafield: 'type', align: 'left', width: 120 },
218 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { 218 { text: 'Gebruik', datafield: 'use_use', align: 'left', width: 120 },
219 var duration = ""; 219 { text: 'Tijd', datafield: 'time', width: 90, align: 'left', menu: false,
220 if (value > 0) { 220 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
221 if (value == 1) 221 var duration = '';
222 duration = "1 minuut"; 222 if (value > 0) {
223 else if (value < 60) 223 if (value == 1)
224 duration = dataAdapter.formatNumber(value, "f0")+" minuten"; 224 duration = '1 minuut';
225 else if (value == 60) 225 else if (value < 60)
226 duration = "1 uur"; 226 duration = dataAdapter.formatNumber(value, 'f0') + ' minuten';
227 else if (value < 1440) 227 else if (value == 60)
228 duration = dataAdapter.formatNumber(value / 60, "f0")+" uren"; 228 duration = '1 uur';
229 else if (value == 1440) 229 else if (value < 1440)
230 duration = "1 dag"; 230 duration = dataAdapter.formatNumber(value / 60, 'f0') + ' uren';
231 else 231 else if (value == 1440)
232 duration = dataAdapter.formatNumber(value / 1440, "f0")+" dagen"; 232 duration = '1 dag';
233 } 233 else
234 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + duration + "</span>"; 234 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
235 } 235 }
236 }, 236 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + duration + '</span>';
237 { text: 'Voorraad', datafield: 'inventory', width: 110, menu: false, align: 'right', 237 }
238 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { 238 },
239 var amount = ""; 239 { text: 'Voorraad', datafield: 'inventory', width: 110, menu: false, align: 'right',
240 if (value > 0) { 240 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
241 if (rowdata.amount_is_weight) 241 var amount = '';
242 amount = dataAdapter.formatNumber(value,"f1")+" gr"; 242 if (value > 0) {
243 else 243 if (rowdata.amount_is_weight)
244 amount = dataAdapter.formatNumber(value,"f1")+" ml"; 244 amount = dataAdapter.formatNumber(value, 'f1') + ' gr';
245 } 245 else
246 return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + amount + "</span>"; 246 amount = dataAdapter.formatNumber(value, 'f1') + ' ml';
247 } 247 }
248 }, 248 return '<span style="margin: 3px; margin-top: 6px; float: right;">' + amount + '</span>';
249 { text: 'THT datum', datafield: 'tht_date', width: 100, menu: false, align: 'center', cellsalign: 'center' }, 249 }
250 { text: '', datafield: 'Edit', columntype: 'button', width: 100, menu: false, align: 'center', 250 },
251 cellsrenderer: function () { 251 { text: 'THT datum', datafield: 'tht_date', width: 100, menu: false, align: 'center', cellsalign: 'center' },
252 return "Wijzig"; 252 { text: '', datafield: 'Edit', columntype: 'button', width: 100, menu: false, align: 'center',
253 }, buttonclick: function (row) { 253 cellsrenderer: function() {
254 // open the popup window when the user clicks a button. 254 return 'Wijzig';
255 editrow = row; 255 }, buttonclick: function(row) {
256 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); 256 // open the popup window when the user clicks a button.
257 // get the clicked row's data and initialize the input fields. 257 editrow = row;
258 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); 258 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
259 $("#name").val(dataRecord.name); 259 // get the clicked row's data and initialize the input fields.
260 $("#type").val(dataRecord.type); 260 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
261 $("#use_use").val(dataRecord.use_use); 261 $('#name').val(dataRecord.name);
262 $("#time").val(dataRecord.time); 262 $('#type').val(dataRecord.type);
263 $("#amount_is_weight").val(dataRecord.amount_is_weight); 263 $('#use_use').val(dataRecord.use_use);
264 $("#use_for").val(dataRecord.use_for); 264 $('#time').val(dataRecord.time);
265 $("#notes").val(dataRecord.notes); 265 $('#amount_is_weight').val(dataRecord.amount_is_weight);
266 $("#always_on_stock").val(dataRecord.always_on_stock); 266 $('#use_for').val(dataRecord.use_for);
267 $("#inventory").val(dataRecord.inventory); 267 $('#notes').val(dataRecord.notes);
268 $("#cost").val(dataRecord.cost); 268 $('#always_on_stock').val(dataRecord.always_on_stock);
269 $("#production_date").val(dataRecord.production_date); 269 $('#inventory').val(dataRecord.inventory);
270 $("#tht_date").val(dataRecord.tht_date); 270 $('#cost').val(dataRecord.cost);
271 calcTotal(dataRecord.cost, dataRecord.inventory); 271 $('#production_date').val(dataRecord.production_date);
272 prompts(dataRecord.amount_is_weight); 272 $('#tht_date').val(dataRecord.tht_date);
273 // show the popup window. 273 calcTotal(dataRecord.cost, dataRecord.inventory);
274 $("#popupWindow").jqxWindow('open'); 274 prompts(dataRecord.amount_is_weight);
275 } 275 // show the popup window.
276 } 276 $('#popupWindow').jqxWindow('open');
277 ] 277 }
278 }); 278 }
279 279 ]
280 $("#cost").on('change', function (event) { 280 });
281 dataRecord.cost = parseFloat(event.args.value); 281
282 calcTotal(dataRecord.cost, dataRecord.inventory); 282 $('#cost').on('change', function(event) {
283 }); 283 dataRecord.cost = parseFloat(event.args.value);
284 $("#inventory").on('change', function (event) { 284 calcTotal(dataRecord.cost, dataRecord.inventory);
285 dataRecord.inventory = parseFloat(event.args.value); 285 });
286 calcTotal(dataRecord.cost, dataRecord.inventory); 286 $('#inventory').on('change', function(event) {
287 }); 287 dataRecord.inventory = parseFloat(event.args.value);
288 $("#amount_is_weight").on('checked', function (event) { 288 calcTotal(dataRecord.cost, dataRecord.inventory);
289 dataRecord.amount_is_weight = true; 289 });
290 prompts(true); 290 $('#amount_is_weight').on('checked', function(event) {
291 }); 291 dataRecord.amount_is_weight = true;
292 $("#amount_is_weight").on('unchecked', function (event) { 292 prompts(true);
293 dataRecord.amount_is_weight = false; 293 });
294 prompts(false); 294 $('#amount_is_weight').on('unchecked', function(event) {
295 }); 295 dataRecord.amount_is_weight = false;
296 296 prompts(false);
297 // initialize the popup window and buttons. 297 });
298 $("#popupWindow").jqxWindow({ 298
299 width: 1050, 299 // initialize the popup window and buttons.
300 height: 550, 300 $('#popupWindow').jqxWindow({
301 resizable: false, 301 width: 1050,
302 theme: theme, 302 height: 550,
303 isModal: true, 303 resizable: false,
304 autoOpen: false, 304 theme: theme,
305 cancelButton: $("#Cancel"), 305 isModal: true,
306 modalOpacity: 0.40 306 autoOpen: false,
307 }); 307 cancelButton: $('#Cancel'),
308 $("#popupWindow").on('open', function () { 308 modalOpacity: 0.40
309 $("#name").jqxInput('selectAll'); 309 });
310 }); 310 $('#popupWindow').on('open', function() {
311 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); 311 $('#name').jqxInput('selectAll');
312 $("#Delete").click(function () { 312 });
313 if (editrow >= 0) { 313 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
314 // Open a popup to confirm this action. 314 $('#Delete').click(function() {
315 $('#eventWindow').jqxWindow('open'); 315 if (editrow >= 0) {
316 $("#delOk").click(function () { 316 // Open a popup to confirm this action.
317 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); 317 $('#eventWindow').jqxWindow('open');
318 $("#jqxgrid").jqxGrid('deleterow', rowID); 318 $('#delOk').click(function() {
319 }); 319 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
320 } 320 $('#jqxgrid').jqxGrid('deleterow', rowID);
321 $("#popupWindow").jqxWindow('hide'); 321 });
322 }); 322 }
323 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); 323 $('#popupWindow').jqxWindow('hide');
324 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); 324 });
325 // update the edited row when the user clicks the 'Save' button. 325 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
326 $("#Save").click(function () { 326 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
327 var row, rowID = -1; 327 // update the edited row when the user clicks the 'Save' button.
328 if (editrow >= 0) { 328 $('#Save').click(function() {
329 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); 329 var row, rowID = -1;
330 } 330 if (editrow >= 0) {
331 row = { 331 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
332 record: rowID, 332 }
333 name: $("#name").val(), 333 row = {
334 type: $("#type").val(), 334 record: rowID,
335 use_use: $("#use_use").val(), 335 name: $('#name').val(),
336 time: parseFloat($("#time").jqxNumberInput('decimal')), 336 type: $('#type').val(),
337 amount_is_weight: $("#amount_is_weight").val(), 337 use_use: $('#use_use').val(),
338 use_for: $("#use_for").val(), 338 time: parseFloat($('#time').jqxNumberInput('decimal')),
339 notes: $("#notes").val(), 339 amount_is_weight: $('#amount_is_weight').val(),
340 always_on_stock: $("#always_on_stock").val(), 340 use_for: $('#use_for').val(),
341 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')), 341 notes: $('#notes').val(),
342 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 342 always_on_stock: $('#always_on_stock').val(),
343 production_date: $("#production_date").val(), 343 inventory: parseFloat($('#inventory').jqxNumberInput('decimal')),
344 tht_date: $("#tht_date").val() 344 cost: parseFloat($('#cost').jqxNumberInput('decimal')),
345 }; 345 production_date: $('#production_date').val(),
346 if (editrow >= 0) { 346 tht_date: $('#tht_date').val()
347 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 347 };
348 } else { 348 if (editrow >= 0) {
349 $('#jqxgrid').jqxGrid('addrow', null, row); 349 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
350 } 350 } else {
351 $("#popupWindow").jqxWindow('hide'); 351 $('#jqxgrid').jqxGrid('addrow', null, row);
352 }); 352 }
353 createDelElements(); 353 $('#popupWindow').jqxWindow('hide');
354 });
355 createDelElements();
354 }); 356 });
355 357

mercurial