www/js/inv_yeasts.js

changeset 313
9f45d09c2071
parent 311
f6fafccd8a6d
child 314
f943efa07d9f
equal deleted inserted replaced
312:ec26ad6ff509 313:9f45d09c2071
88 { name: 'max_reuse', type: 'int' }, 88 { name: 'max_reuse', type: 'int' },
89 { name: 'inventory', type: 'float' }, 89 { name: 'inventory', type: 'float' },
90 { name: 'cost', type: 'float' }, 90 { name: 'cost', type: 'float' },
91 { name: 'production_date', type: 'string' }, 91 { name: 'production_date', type: 'string' },
92 { name: 'tht_date', type: 'string' }, 92 { name: 'tht_date', type: 'string' },
93 { name: 'cells', type: 'float' } 93 { name: 'cells', type: 'float' },
94 { name: 'tolerance', type: 'float' }
94 ], 95 ],
95 id: 'record', 96 id: 'record',
96 url: url, 97 url: url,
97 deleterow: function (rowid, commit) { 98 deleterow: function (rowid, commit) {
98 // synchronize with the server - send delete command 99 // synchronize with the server - send delete command
168 width: 180, 169 width: 180,
169 height: 23, 170 height: 23,
170 autoDropDownHeight: true 171 autoDropDownHeight: true
171 }); 172 });
172 $("#notes").jqxInput({ theme: theme, width: 800, height: 120 }); 173 $("#notes").jqxInput({ theme: theme, width: 800, height: 120 });
173 $("#best_for").jqxInput({ theme: theme, width: 320, height: 75 }); 174 $("#best_for").jqxInput({ theme: theme, width: 320, height: 100 });
174 $("#inventory").jqxNumberInput( Spin1dec ); 175 $("#inventory").jqxNumberInput( Spin1dec );
175 $("#production_date").jqxDateTimeInput( Dateopts ); 176 $("#production_date").jqxDateTimeInput( Dateopts );
176 $("#min_temperature").jqxNumberInput( YeastT ); 177 $("#min_temperature").jqxNumberInput( YeastT );
177 $("#max_temperature").jqxNumberInput( YeastT ); 178 $("#max_temperature").jqxNumberInput( YeastT );
178 $("#flocculation").jqxDropDownList({ 179 $("#flocculation").jqxDropDownList({
189 $("#max_reuse").jqxNumberInput({ max: 10 }); 190 $("#max_reuse").jqxNumberInput({ max: 10 });
190 $("#cost").jqxNumberInput( Spin2dec ); 191 $("#cost").jqxNumberInput( Spin2dec );
191 $("#tht_date").jqxDateTimeInput( Dateopts ); 192 $("#tht_date").jqxDateTimeInput( Dateopts );
192 $("#totval").jqxNumberInput( Show2dec ); 193 $("#totval").jqxNumberInput( Show2dec );
193 $("#cells").jqxNumberInput( Spin1dec ); 194 $("#cells").jqxNumberInput( Spin1dec );
195 $("#tolerance").jqxNumberInput( Perc1dec );
196 $("#tolerance").jqxNumberInput({ max: 25 });
194 197
195 var dataAdapter = new $.jqx.dataAdapter(source); 198 var dataAdapter = new $.jqx.dataAdapter(source);
196 var editrow = -1; 199 var editrow = -1;
197 // initialize jqxGrid 200 // initialize jqxGrid
198 $("#jqxgrid").jqxGrid({ 201 $("#jqxgrid").jqxGrid({
229 $("#inventory").val(0); 232 $("#inventory").val(0);
230 $("#cost").val(0); 233 $("#cost").val(0);
231 $("#production_date").val(''); 234 $("#production_date").val('');
232 $("#tht_date").val(''); 235 $("#tht_date").val('');
233 $("#cells").val(1); 236 $("#cells").val(1);
237 $("#tolerance").val(0);
234 $("#popupWindow").jqxWindow('open'); 238 $("#popupWindow").jqxWindow('open');
235 }); 239 });
236 impButton.click(function (event) { 240 impButton.click(function (event) {
237 var url="import_ingredients.php?select=yeasts"; 241 var url="import_ingredients.php?select=yeasts";
238 window.location.href = url; 242 window.location.href = url;
252 { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', menu: false, width: 110, 256 { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', menu: false, width: 110,
253 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { 257 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
254 return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastFormData[value].nl + "</div>"; 258 return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastFormData[value].nl + "</div>";
255 } 259 }
256 }, 260 },
257 { text: 'SVG', datafield: 'attenuation', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' }, 261 { text: 'SVG', datafield: 'attenuation', width: 70, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
262 { text: 'Tol%', datafield: 'tolerance', width: 60, align: 'right', cellsalign: 'right', menu: false,
263 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
264 var amount = "";
265 if (value > 0)
266 amount = dataAdapter.formatNumber(value, "p0");
267 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
268 }
269 },
258 { text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', menu: false, 270 { text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', menu: false,
259 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { 271 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
260 var amount = ""; 272 var amount = "";
261 if (value > 0) { 273 if (value > 0) {
262 if ((rowdata.form == 0) && (value > 1)) 274 if ((rowdata.form == 0) && (value > 1))
297 $("#inventory").val(dataRecord.inventory * 1000); 309 $("#inventory").val(dataRecord.inventory * 1000);
298 $("#cost").val(dataRecord.cost); 310 $("#cost").val(dataRecord.cost);
299 $("#production_date").val(dataRecord.production_date); 311 $("#production_date").val(dataRecord.production_date);
300 $("#tht_date").val(dataRecord.tht_date); 312 $("#tht_date").val(dataRecord.tht_date);
301 $("#cells").val(dataRecord.cells); 313 $("#cells").val(dataRecord.cells);
314 $("#tolerance").val(dataRecord.tolerance);
302 calcTotal(); 315 calcTotal();
303 // show the popup window. 316 // show the popup window.
304 $("#popupWindow").jqxWindow('open'); 317 $("#popupWindow").jqxWindow('open');
305 } 318 }
306 } 319 }
327 }); 340 });
328 341
329 // initialize the popup window and buttons. 342 // initialize the popup window and buttons.
330 $("#popupWindow").jqxWindow({ 343 $("#popupWindow").jqxWindow({
331 width: 1050, 344 width: 1050,
332 height: 550, 345 height: 575,
333 resizable: false, 346 resizable: false,
334 theme: theme, 347 theme: theme,
335 isModal: true, 348 isModal: true,
336 autoOpen: false, 349 autoOpen: false,
337 cancelButton: $("#Cancel"), 350 cancelButton: $("#Cancel"),
380 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')), 393 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
381 inventory: n_inventory, 394 inventory: n_inventory,
382 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 395 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
383 production_date: $("#production_date").val(), 396 production_date: $("#production_date").val(),
384 tht_date: $("#tht_date").val(), 397 tht_date: $("#tht_date").val(),
385 cells: parseFloat($("#cells").jqxNumberInput('decimal')) 398 cells: parseFloat($("#cells").jqxNumberInput('decimal')),
399 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal'))
386 }; 400 };
387 if (editrow >= 0) { 401 if (editrow >= 0) {
388 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 402 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
389 } else { 403 } else {
390 $('#jqxgrid').jqxGrid('addrow', null, row); 404 $('#jqxgrid').jqxGrid('addrow', null, row);

mercurial