www/js/prod_edit.js

changeset 484
2083c274b283
parent 479
67dbbf301ae7
child 489
18e5cfe5d126
--- a/www/js/prod_edit.js	Fri Sep 13 11:04:00 2019 +0200
+++ b/www/js/prod_edit.js	Fri Sep 13 15:09:04 2019 +0200
@@ -100,6 +100,7 @@
  Ka2 = 0.0000000000468,
  dataRecord = {},
  url = 'includes/db_product.php',
+ MaltVolume = 0.87,    // l/kg 0.688 volgens internetbronnen, gemeten 0.874 l/kg, na enige tijd maischen 0,715 l/kg (A3 Otten).
 
  // Prepare the data
  source = {
@@ -1907,19 +1908,26 @@
 
  function calcMash() {
 
-  var infused = 0, i, row;
-
-  if (!(rows = $('#mashGrid').jqxGrid('getrows')))
-   return;
-  if (mashkg == 0)
-   return;
-
-  for (i = 0; i < rows.length; i++) {
-   row = $('#mashGrid').jqxGrid('getrowdata', i);
-   if (row.step_type == 0) // Infusion
-    infused += row.step_infuse_amount;
-   $('#mashGrid').jqxGrid('setcellvalue', i, 'step_thickness', infused / mashkg);
+  var h, m, infused = 0, mashtime = 0, mashvol = 0, i, row;
+
+  if ((rows = $('#mashGrid').jqxGrid('getrows')) && (mashkg > 0)) {
+   for (i = 0; i < rows.length; i++) {
+    row = $('#mashGrid').jqxGrid('getrowdata', i);
+    if (row.step_type == 0) // Infusion
+     infused += row.step_infuse_amount;
+    mashtime += row.step_time + row.ramp_time;
+    $('#mashGrid').jqxGrid('setcellvalue', i, 'step_thickness', infused / mashkg);
+   }
   }
+  mashvol = mashkg * MaltVolume + infused;
+  $('#est_mashvol').val(mashvol);
+  h = Math.floor(mashtime / 60);
+  m = Math.floor(mashtime - (h * 60));
+  if (h < 10)
+    h = '0' + h;
+  if (m < 10)
+    m = '0' + m;
+  $('#est_mashtime').val(h + ':' + m);
  }
 
  /*
@@ -5351,6 +5359,10 @@
    }
   }
  });
+ $('#est_mashvol').jqxTooltip({ content: 'Het totale volume van het maishwater en de mout in de maish pan.' });
+ $('#est_mashvol').jqxNumberInput(Show1dec);
+ $('#est_mashtime').jqxTooltip({ content: 'De totale tijdsduur van het maischen.' });
+ $('#est_mashtime').jqxInput({ theme: theme, width: 70, height: 23 });
  $('#popupMash').jqxWindow({
   width: 800,
   height: 350,

mercurial