161 $("#inventory").jqxNumberInput( Spin1dec1 ); |
169 $("#inventory").jqxNumberInput( Spin1dec1 ); |
162 $("#production_date").jqxDateTimeInput( Dateopts ); |
170 $("#production_date").jqxDateTimeInput( Dateopts ); |
163 $("#cost").jqxNumberInput( Spin2dec1 ); |
171 $("#cost").jqxNumberInput( Spin2dec1 ); |
164 $("#tht_date").jqxDateTimeInput( Dateopts ); |
172 $("#tht_date").jqxDateTimeInput( Dateopts ); |
165 $("#total_oil").jqxNumberInput( Perc1dec1 ); |
173 $("#total_oil").jqxNumberInput( Perc1dec1 ); |
|
174 $("#totval").jqxNumberInput( Spin2dec1 ); |
|
175 $("#totval").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false }); |
|
176 |
166 var dataAdapter = new $.jqx.dataAdapter(source); |
177 var dataAdapter = new $.jqx.dataAdapter(source); |
167 var editrow = -1; |
178 var editrow = -1; |
168 // initialize jqxGrid |
179 // initialize jqxGrid |
169 $("#jqxgrid").jqxGrid({ |
180 $("#jqxgrid").jqxGrid({ |
170 width: 1280, |
181 width: 1280, |
232 }, buttonclick: function (row) { |
243 }, buttonclick: function (row) { |
233 // open the popup window when the user clicks a button. |
244 // open the popup window when the user clicks a button. |
234 editrow = row; |
245 editrow = row; |
235 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); |
246 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); |
236 // get the clicked row's data and initialize the input fields. |
247 // get the clicked row's data and initialize the input fields. |
237 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
248 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
238 $("#name").val(dataRecord.name); |
249 $("#name").val(dataRecord.name); |
239 $("#alpha").val(dataRecord.alpha); |
250 $("#alpha").val(dataRecord.alpha); |
240 $("#beta").val(dataRecord.beta); |
251 $("#beta").val(dataRecord.beta); |
241 $("#humulene").val(dataRecord.humulene); |
252 $("#humulene").val(dataRecord.humulene); |
242 $("#caryophyllene").val(dataRecord.caryophyllene); |
253 $("#caryophyllene").val(dataRecord.caryophyllene); |
252 $("#inventory").val(dataRecord.inventory); |
263 $("#inventory").val(dataRecord.inventory); |
253 $("#cost").val(dataRecord.cost); |
264 $("#cost").val(dataRecord.cost); |
254 $("#production_date").val(dataRecord.production_date); |
265 $("#production_date").val(dataRecord.production_date); |
255 $("#tht_date").val(dataRecord.tht_date); |
266 $("#tht_date").val(dataRecord.tht_date); |
256 $("#total_oil").val(dataRecord.total_oil); |
267 $("#total_oil").val(dataRecord.total_oil); |
|
268 calcTotal(dataRecord.cost, dataRecord.inventory); |
257 // show the popup window. |
269 // show the popup window. |
258 $("#popupWindow").jqxWindow('open'); |
270 $("#popupWindow").jqxWindow('open'); |
259 } |
271 } |
260 } |
272 } |
261 ] |
273 ] |
262 }); |
274 }); |
|
275 |
|
276 $("#cost").on('change', function (event) { |
|
277 dataRecord.cost = parseFloat(event.args.value); |
|
278 calcTotal(dataRecord.cost, dataRecord.inventory); |
|
279 }); |
|
280 $("#inventory").on('change', function (event) { |
|
281 dataRecord.inventory = parseFloat(event.args.value); |
|
282 calcTotal(dataRecord.cost, dataRecord.inventory); |
|
283 }); |
|
284 |
263 // initialize the popup window and buttons. |
285 // initialize the popup window and buttons. |
264 $("#popupWindow").jqxWindow({ |
286 $("#popupWindow").jqxWindow({ |
265 width: 1050, |
287 width: 1050, |
266 height: 550, |
288 height: 550, |
267 resizable: false, |
289 resizable: false, |