When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.

Sat, 02 Feb 2019 14:57:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 02 Feb 2019 14:57:41 +0100
changeset 232
daf2d9d6fa18
parent 231
9881453a49b3
child 233
14a84d42031d

When adding yeast the flocculation and cells fields were not added. Possible fix for double water agents in the miscs grid. Better efforts to set the initial water infuse amount. The new recipe wizzard now uses indexed fields. In recipe print fixed the yeast amount and cost.

www/getyeastsources.php file | annotate | diff | comparison | revisions
www/js/global.js file | annotate | diff | comparison | revisions
www/js/rec_edit.js file | annotate | diff | comparison | revisions
www/js/rec_new.js file | annotate | diff | comparison | revisions
www/rec_new.php file | annotate | diff | comparison | revisions
www/rec_print.php file | annotate | diff | comparison | revisions
--- a/www/getyeastsources.php	Sat Feb 02 11:53:39 2019 +0100
+++ b/www/getyeastsources.php	Sat Feb 02 14:57:41 2019 +0100
@@ -18,7 +18,9 @@
 		'product_id' => $row['product_id'],
 		'min_temperature' => $row['min_temperature'],
 		'max_temperature' => $row['max_temperature'],
+		'flocculation' => $row['flocculation'],
 		'attenuation' => $row['attenuation'],
+		'cells' => $row['cells'],
 		'inventory' => $row['inventory'],
 		'cost' => $row['cost']
 	);
--- a/www/js/global.js	Sat Feb 02 11:53:39 2019 +0100
+++ b/www/js/global.js	Sat Feb 02 14:57:41 2019 +0100
@@ -624,7 +624,9 @@
 		{ name: 'product_id', type: 'string' },
 		{ name: 'min_temperature', type: 'float' },
 		{ name: 'max_temperature', type: 'float' },
+		{ name: 'flocculation', type: 'int' },
 		{ name: 'attenuation', type: 'float' },
+		{ name: 'cells', type: 'float' },
 		{ name: 'inventory', type: 'float' },
 		{ name: 'cost', type: 'float' }
 	],
--- a/www/js/rec_edit.js	Sat Feb 02 11:53:39 2019 +0100
+++ b/www/js/rec_edit.js	Sat Feb 02 14:57:41 2019 +0100
@@ -1066,20 +1066,32 @@
 			calcWater();
 		});
 		$('#wa_cacl2').on('change', function (event) {
-			setWaterAgent('CaCl2', event.args.value);
-			calcWater();
+			if (event.args) {
+				setWaterAgent('CaCl2', 0);	// This can prevent double entries.
+				setWaterAgent('CaCl2', event.args.value);
+				calcWater();
+			}
 		});
 		$('#wa_caso4').on('change', function (event) {
-			setWaterAgent('CaSO4', event.args.value);
-			calcWater();
+			if (event.args) {
+				setWaterAgent('CaSO4', 0);
+				setWaterAgent('CaSO4', event.args.value);
+				calcWater();
+			}
 		});
 		$('#wa_mgso4').on('change', function (event) {
-			setWaterAgent('MgSO4', event.args.value);
-			calcWater();
+			if (event.args) {
+				setWaterAgent('MgSO4', 0);
+				setWaterAgent('MgSO4', event.args.value);
+				calcWater();
+			}
 		});
 		$('#wa_nacl').on('change', function (event) {
-			setWaterAgent('NaCl', event.args.value);
-			calcWater();
+			if (event.args) {
+				setWaterAgent('NaCl', 0);
+				setWaterAgent('NaCl', event.args.value);
+				calcWater();
+			}
 		});
 		$('#wa_base_name').on('change', function (event) {
 			if (event.args) {
@@ -3040,6 +3052,8 @@
 				row["step_name"] = data.step_name;
 				row["step_type"] = data.step_type;
 				// For now, but this must be smarter.
+				if (mash_infuse == 0 && dataRecord.w1_amount > 0)
+					mash_infuse = dataRecord.w1_amount;
 				if (i == 0)
 					row["step_infuse_amount"] = mash_infuse;
 				else
--- a/www/js/rec_new.js	Sat Feb 02 11:53:39 2019 +0100
+++ b/www/js/rec_new.js	Sat Feb 02 14:57:41 2019 +0100
@@ -23,27 +23,46 @@
 
 $(document).ready(function () {
 
-	// tooltips
-	$("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
-	$("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
-	$("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' });
+	var recipe_type = 2;
+	var style_type = 0;
 
-	// editers
-	var srcType = [ "All Grain", "Partial Mash", "Extract" ];
+	// Tab 1, Base
+	$("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
+	$("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
 	$("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
-	$("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 });
-	$("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 4, max: 360, decimalDigits: 0, spinButtons: true });
-	$("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 40, max: 100, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right'  });
-	$("#est_og").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 100, height: 23, min: 1.010, max: 1.2, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 });
+	$("#type").jqxDropDownList({
+		theme: theme,
+		source: RecipeTypeAdapter,
+		valueMember: 'id',
+		displayMember: 'nl',
+		width: 180,
+		height: 23,
+		autoDropDownHeight: true
+	});
+	$("#type").jqxDropDownList('selectItem', 2);
+	$("#type").on('select', function (event) {
+		if (event.args) {
+			recipe_type = event.args.index;
+		}
+	});
+	$("#boil_time").jqxNumberInput( PosInt );
+	$("#boil_time").jqxNumberInput({ min: 4, max: 360 });
+	$("#efficiency").jqxNumberInput( Perc0 );
+	$("#est_og").jqxNumberInput( SGopts );
+	// Default values.
+	$("#boil_time").val(90);
+	$("#efficiency").val(75);
+	$("#est_og").val(1.052);
 
+	// Tab 2, Style
 	$("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
 	$("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
 	$("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 });
 	$("#st_style_letter").jqxInput({ theme: theme, width: 250, height: 23 });
 	$("#st_style_guide").jqxInput({ theme: theme, width: 250, height: 23 });
 	$("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 });
-	$("#st_type").jqxInput({ theme: theme, width: 90, height: 23 });
+	$("#st_type").jqxInput({ theme: theme, width: 250, height: 23 });
 	$("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
 	$("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
 	$("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
@@ -60,18 +79,12 @@
 	$("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
 	$("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 });
 
-	// Default values.
-	$("#type").val('All Grain');
-	$("#boil_time").val(90);
-	$("#efficiency").val(75);
-	$("#est_og").val(1.052);
-
 	$("#styleSelect").jqxDropDownList({
 		placeHolder: "Kies bierstijl:",
 		theme: theme,
 		source: styleslist,
 		displayMember: "name",
-		width: 150,
+		width: 250,
 		height: 27,
 		dropDownWidth: 500,
 		dropDownHeight: 500,
@@ -89,7 +102,8 @@
 			$("#st_category_number").val(datarecord.category_number);
 			$("#st_style_letter").val(datarecord.style_letter);
 			$("#st_style_guide").val(datarecord.style_guide);
-			$("#st_type").val(datarecord.type);
+			style_type = datarecord.type;
+			$("#st_type").val(StyleTypeData[datarecord.type].nl);
 			$("#st_og_min").val(datarecord.og_min);
 			$("#st_og_max").val(datarecord.og_max);
 			$("#st_fg_min").val(datarecord.fg_min);
@@ -124,6 +138,7 @@
 				console.log("insert start");
 				var newrow = {
 					record: -1,
+					locked: 0,
 					name: $("#name").val(),
 					notes: $("#notes").val(),
 					st_name: $('#st_name').val(),
@@ -131,7 +146,7 @@
 					st_guide: $('#st_style_guide').val(),
 					st_category: $('#st_category').val(),
 					st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')),
-					st_type: $("#st_type").val(),
+					st_type: style_type,
 					st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')),
 					st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')),
 					st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')),
@@ -144,7 +159,7 @@
 					st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')),
 					st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')),
 					st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')),
-					type: $("#type").val(),
+					type: recipe_type,
 					batch_size: 20.0,
 					boil_size: 22.0,
 					boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')),
@@ -154,19 +169,32 @@
 					est_color: 0,
 					est_abv: 0.0,
 					est_carb: 0.0,
-					color_method: "Morey",
+					color_method: 0,	// Morey
 					est_ibu: 0,
-					ibu_method: "Tinseth",
+					ibu_method: 0,		// Tinseth
 					mash_name: "",
 					mash_ph: 5.4,
-					sparge_temp: 78.0,
+					sparge_temp: 85.0,
 					sparge_volume: 12.0,
 					sparge_ph: 5.8,
-					sparge_source: 'Bron 1',
-					sparge_acid_type: 'Melkzuur',
+					sparge_source: 0,	// Source 1
+					sparge_acid_type: 0,	// Lactic acid
 					sparge_acid_perc: 80,
 					sparge_acid_amount: 0,
-					calc_acid: true
+					calc_acid: true,
+					w1_name: 'Tap water',
+					w1_amount: 15,
+					w1_calcium: 0,
+					w1_sulfate: 0,
+					w1_chloride: 0,
+					w1_sodium: 0,
+					w1_magnesium: 0,
+					w1_total_alkalinity: 0,
+					w1_ph: 7.0,
+					w1_cost: 0.0,
+					wa_acid_name: 0,	// Lactic acid
+					wa_acid_perc: 80,
+					wa_base_name: 0
 				};
 				var data = "insert=true&return=" + my_return + "&" + $.param(newrow);
 				$.ajax({
--- a/www/rec_new.php	Sat Feb 02 11:53:39 2019 +0100
+++ b/www/rec_new.php	Sat Feb 02 14:57:41 2019 +0100
@@ -30,7 +30,7 @@
        <tr>
         <td style="vertical-align: top; float: right; padding: 3px;">Kooktijd minuten:</td>
         <td style="padding: 3px;"><div id="boil_time"></div></td>
-        <td style="vertical-align: top; float: right; padding: 3px;">Brouwzaal rendement:</td>
+        <td style="vertical-align: top; float: right; padding: 3px;">Brouwzaal rendement %:</td>
         <td style="padding: 3px;"><div id="efficiency"></div></td>
        </tr>
       </table>
--- a/www/rec_print.php	Sat Feb 02 11:53:39 2019 +0100
+++ b/www/rec_print.php	Sat Feb 02 14:57:41 2019 +0100
@@ -252,7 +252,7 @@
 		$this->AddCol(20,'Gebruik','L');
 		$this->AddCol(15,'Attn','R');
 		$this->AddCol(22,'Vorm','L');
-		$this->AddCol(18,'Gram','R');
+		$this->AddCol(18,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -269,22 +269,26 @@
 			$name       = iconv('UTF-8','windows-1252',$item['y_name']);
 			$laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']);
 			$product_id = iconv('UTF-8','windows-1252',$item['y_product_id']);
-			$amount     = floatval($item['y_amount']) * 1000;
-			$costg      = floatval($item['y_cost']);
 			$attenuation = floatval($item['y_attenuation']);
-			$cost        = $amount * $costg;
+			$cost        = floatval($item['y_amount']) * floatval($item['y_cost']);
 			$cost_yeasts += $cost;
 
 			if ($item['y_use'] == 0)	// Primary
 				$svg = $attenuation;
 
+			if ($item['y_form'] == 0)	// Liquid
+				$amount = sprintf("%.0f",floatval($item['y_amount']))." pak";
+			else if ($item['y_form'] == 1)	// Dry
+				$amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr";
+			else
+				$amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml";
 			$this->Cell(27,5,$laboratory,0,0,'L',true);
 			$this->Cell(18,5,$product_id,0,0,'L',true);
 			$this->Cell($vul,5,$name,0,0,'L',true);
 			$this->Cell(20,5,$yeastuse[$item['y_use']],0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true);
 			$this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',true);
-			$this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true);
+			$this->Cell(18,5,$amount,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}

mercurial