Mon, 04 Feb 2019 15:21:49 +0100
Depending on the product stage, more or less fields are saved in the database. Added begin of auto stage increase. Added missing inventory columns in the fermentables grid. New product wizzard now works with the indexed values. Product print works with indexed values and prepared for different print modules depending on the product stage.
www/includes/db_product.php | file | annotate | diff | comparison | revisions | |
www/js/prod_edit.js | file | annotate | diff | comparison | revisions | |
www/js/prod_new.js | file | annotate | diff | comparison | revisions | |
www/js/rec_new.js | file | annotate | diff | comparison | revisions | |
www/prod_new.php | file | annotate | diff | comparison | revisions | |
www/prod_print.php | file | annotate | diff | comparison | revisions | |
www/rec_print.php | file | annotate | diff | comparison | revisions |
--- a/www/includes/db_product.php Sun Feb 03 23:21:55 2019 +0100 +++ b/www/includes/db_product.php Mon Feb 04 15:21:49 2019 +0100 @@ -69,68 +69,83 @@ $sql .= "', eq_mash_volume='" . $_POST['eq_mash_volume']; $sql .= "', eq_mash_max='" . $_POST['eq_mash_max']; $sql .= "', eq_efficiency='" . $_POST['eq_efficiency']; - $sql .= "', brew_date_start='" . $_POST['brew_date_start']; - $sql .= "', brew_mash_ph='" . $_POST['brew_mash_ph']; - $sql .= "', brew_mash_sg='" . $_POST['brew_mash_sg']; - $sql .= "', brew_sparge_temperature='" . $_POST['brew_sparge_temperature']; - $sql .= "', brew_sparge_volume='" . $_POST['brew_sparge_volume']; - $sql .= "', brew_sparge_ph='" . $_POST['brew_sparge_ph']; - $sql .= "', brew_preboil_volume='" . $_POST['brew_preboil_volume']; - $sql .= "', brew_preboil_sg='" . $_POST['brew_preboil_sg']; - $sql .= "', brew_preboil_ph='" . $_POST['brew_preboil_ph']; - $sql .= "', brew_aboil_volume='" . $_POST['brew_aboil_volume']; - $sql .= "', brew_aboil_sg='" . $_POST['brew_aboil_sg']; - $sql .= "', brew_aboil_ph='" . $_POST['brew_aboil_ph']; - $sql .= "', brew_aboil_efficiency='" . $_POST['brew_aboil_efficiency']; - $sql .= "', brew_cooling_method='" . $_POST['brew_cooling_method']; - $sql .= "', brew_cooling_time='" . $_POST['brew_cooling_time']; - $sql .= "', brew_cooling_to='" . $_POST['brew_cooling_to']; - $sql .= "', brew_whirlpool9='" . $_POST['brew_whirlpool9']; - $sql .= "', brew_whirlpool7='" . $_POST['brew_whirlpool7']; - $sql .= "', brew_whirlpool6='" . $_POST['brew_whirlpool6']; - $sql .= "', brew_whirlpool2='" . $_POST['brew_whirlpool2']; - $sql .= "', brew_aeration_time='" . $_POST['brew_aeration_time']; - $sql .= "', brew_aeration_speed='" . $_POST['brew_aeration_speed']; - $sql .= "', brew_aeration_type='" . $_POST['brew_aeration_type']; - $sql .= "', brew_fermenter_volume='" . $_POST['brew_fermenter_volume']; - $sql .= "', brew_fermenter_extrawater='" . $_POST['brew_fermenter_extrawater']; - $sql .= "', brew_fermenter_sg='" . $_POST['brew_fermenter_sg']; - $sql .= "', brew_fermenter_ibu='" . $_POST['brew_fermenter_ibu']; - $sql .= "', brew_date_end='" . $_POST['brew_date_end']; - ($_POST['brew_log_available'] == 'true') ? $sql .= "', brew_log_available='1" : $sql .= "', brew_log_available='0"; + + if ($stage > 1) { + $sql .= "', brew_date_start='" . $_POST['brew_date_start']; + $sql .= "', brew_mash_ph='" . $_POST['brew_mash_ph']; + $sql .= "', brew_mash_sg='" . $_POST['brew_mash_sg']; + $sql .= "', brew_sparge_temperature='" . $_POST['brew_sparge_temperature']; + $sql .= "', brew_sparge_volume='" . $_POST['brew_sparge_volume']; + $sql .= "', brew_sparge_ph='" . $_POST['brew_sparge_ph']; + $sql .= "', brew_preboil_volume='" . $_POST['brew_preboil_volume']; + $sql .= "', brew_preboil_sg='" . $_POST['brew_preboil_sg']; + $sql .= "', brew_preboil_ph='" . $_POST['brew_preboil_ph']; + $sql .= "', brew_aboil_volume='" . $_POST['brew_aboil_volume']; + $sql .= "', brew_aboil_sg='" . $_POST['brew_aboil_sg']; + $sql .= "', brew_aboil_ph='" . $_POST['brew_aboil_ph']; + $sql .= "', brew_aboil_efficiency='" . $_POST['brew_aboil_efficiency']; + $sql .= "', brew_cooling_method='" . $_POST['brew_cooling_method']; + $sql .= "', brew_cooling_time='" . $_POST['brew_cooling_time']; + $sql .= "', brew_cooling_to='" . $_POST['brew_cooling_to']; + $sql .= "', brew_whirlpool9='" . $_POST['brew_whirlpool9']; + $sql .= "', brew_whirlpool7='" . $_POST['brew_whirlpool7']; + $sql .= "', brew_whirlpool6='" . $_POST['brew_whirlpool6']; + $sql .= "', brew_whirlpool2='" . $_POST['brew_whirlpool2']; + $sql .= "', brew_aeration_time='" . $_POST['brew_aeration_time']; + $sql .= "', brew_aeration_speed='" . $_POST['brew_aeration_speed']; + $sql .= "', brew_aeration_type='" . $_POST['brew_aeration_type']; + $sql .= "', brew_fermenter_volume='" . $_POST['brew_fermenter_volume']; + $sql .= "', brew_fermenter_extrawater='" . $_POST['brew_fermenter_extrawater']; + $sql .= "', brew_fermenter_sg='" . $_POST['brew_fermenter_sg']; + $sql .= "', brew_fermenter_ibu='" . $_POST['brew_fermenter_ibu']; + $sql .= "', brew_date_end='" . $_POST['brew_date_end']; + ($_POST['brew_log_available'] == 'true') ? $sql .= "', brew_log_available='1" : $sql .= "', brew_log_available='0"; + } $sql .= "', og='" . $_POST['og']; $sql .= "', fg='" . $_POST['fg']; - $sql .= "', primary_start_temp='" . $_POST['primary_start_temp']; - $sql .= "', primary_max_temp='" . $_POST['primary_max_temp']; - $sql .= "', primary_end_temp='" . $_POST['primary_end_temp']; - $sql .= "', primary_end_sg='" . $_POST['primary_end_sg']; - $sql .= "', primary_end_date='" . $_POST['primary_end_date']; - $sql .= "', secondary_temp='" . $_POST['secondary_temp']; - $sql .= "', secondary_end_date='" . $_POST['secondary_end_date']; - $sql .= "', tertiary_temp='" . $_POST['tertiary_temp']; - $sql .= "', package_date='" . $_POST['package_date']; - $sql .= "', bottle_amount='" . $_POST['bottle_amount']; - $sql .= "', bottle_carbonation='" . $_POST['bottle_carbonation']; - $sql .= "', bottle_priming_sugar='" . $_POST['bottle_priming_sugar']; - $sql .= "', bottle_priming_amount='" . $_POST['bottle_priming_amount']; - $sql .= "', bottle_carbonation_temp='" . $_POST['bottle_carbonation_temp']; - $sql .= "', keg_amount='" . $_POST['keg_amount']; - $sql .= "', keg_carbonation='" . $_POST['keg_carbonation']; - $sql .= "', keg_priming_sugar='" . $_POST['keg_priming_sugar']; - $sql .= "', keg_priming_amount='" . $_POST['keg_priming_amount']; - $sql .= "', keg_carbonation_temp='" . $_POST['keg_carbonation_temp']; - ($_POST['keg_forced_carb'] == 'true') ? $sql .= "', keg_forced_carb='1" : $sql .= "', keg_forced_carb='0"; - $sql .= "', keg_pressure='" . $_POST['keg_pressure']; - $sql .= "', taste_notes='" . mysqli_real_escape_string($connect, $_POST['taste_notes']); - $sql .= "', taste_rate='" . $_POST['taste_rate']; - $sql .= "', taste_date='" . $_POST['taste_date']; - $sql .= "', taste_color='" . mysqli_real_escape_string($connect, $_POST['taste_color']); - $sql .= "', taste_transparency='" . mysqli_real_escape_string($connect, $_POST['taste_transparency']); - $sql .= "', taste_head='" . mysqli_real_escape_string($connect, $_POST['taste_head']); - $sql .= "', taste_aroma='" . mysqli_real_escape_string($connect, $_POST['taste_aroma']); - $sql .= "', taste_taste='" . mysqli_real_escape_string($connect, $_POST['taste_taste']); - $sql .= "', taste_mouthfeel='" . mysqli_real_escape_string($connect, $_POST['taste_mouthfeel']); - $sql .= "', taste_aftertaste='" . mysqli_real_escape_string($connect, $_POST['taste_aftertaste']); + + if ($stage > 2) { + $sql .= "', primary_start_temp='" . $_POST['primary_start_temp']; + $sql .= "', primary_max_temp='" . $_POST['primary_max_temp']; + $sql .= "', primary_end_temp='" . $_POST['primary_end_temp']; + $sql .= "', primary_end_sg='" . $_POST['primary_end_sg']; + $sql .= "', primary_end_date='" . $_POST['primary_end_date']; + } + + if ($stage > 3) { + $sql .= "', secondary_temp='" . $_POST['secondary_temp']; + $sql .= "', secondary_end_date='" . $_POST['secondary_end_date']; + $sql .= "', tertiary_temp='" . $_POST['tertiary_temp']; + } + + if ($stage > 4) { + $sql .= "', package_date='" . $_POST['package_date']; + $sql .= "', bottle_amount='" . $_POST['bottle_amount']; + $sql .= "', bottle_carbonation='" . $_POST['bottle_carbonation']; + $sql .= "', bottle_priming_sugar='" . $_POST['bottle_priming_sugar']; + $sql .= "', bottle_priming_amount='" . $_POST['bottle_priming_amount']; + $sql .= "', bottle_carbonation_temp='" . $_POST['bottle_carbonation_temp']; + $sql .= "', keg_amount='" . $_POST['keg_amount']; + $sql .= "', keg_carbonation='" . $_POST['keg_carbonation']; + $sql .= "', keg_priming_sugar='" . $_POST['keg_priming_sugar']; + $sql .= "', keg_priming_amount='" . $_POST['keg_priming_amount']; + $sql .= "', keg_carbonation_temp='" . $_POST['keg_carbonation_temp']; + ($_POST['keg_forced_carb'] == 'true') ? $sql .= "', keg_forced_carb='1" : $sql .= "', keg_forced_carb='0"; + $sql .= "', keg_pressure='" . $_POST['keg_pressure']; + } + + if ($stage > 8) { + $sql .= "', taste_notes='" . mysqli_real_escape_string($connect, $_POST['taste_notes']); + $sql .= "', taste_rate='" . $_POST['taste_rate']; + $sql .= "', taste_date='" . $_POST['taste_date']; + $sql .= "', taste_color='" . mysqli_real_escape_string($connect, $_POST['taste_color']); + $sql .= "', taste_transparency='" . mysqli_real_escape_string($connect, $_POST['taste_transparency']); + $sql .= "', taste_head='" . mysqli_real_escape_string($connect, $_POST['taste_head']); + $sql .= "', taste_aroma='" . mysqli_real_escape_string($connect, $_POST['taste_aroma']); + $sql .= "', taste_taste='" . mysqli_real_escape_string($connect, $_POST['taste_taste']); + $sql .= "', taste_mouthfeel='" . mysqli_real_escape_string($connect, $_POST['taste_mouthfeel']); + $sql .= "', taste_aftertaste='" . mysqli_real_escape_string($connect, $_POST['taste_aftertaste']); + } /* * Recipe part
--- a/www/js/prod_edit.js Sun Feb 03 23:21:55 2019 +0100 +++ b/www/js/prod_edit.js Mon Feb 04 15:21:49 2019 +0100 @@ -132,11 +132,13 @@ $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); } var est_og = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); + dataRecord.est_og = est_og; $('#est_og').val(est_og); $('#est_og2').val(est_og); $('#est_og3').val(est_og); preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); var color = kw_to_ebc(dataRecord.color_method, colorw); + dataRecord.est_color = color; $('#est_color').val(color); $('#est_color2').val(color); var scolor = ebc_to_color(color); @@ -147,6 +149,7 @@ $("#perc_malts").jqxProgressBar('val', pmalts); $("#perc_sugars").jqxProgressBar('val', psugar); $("#perc_cara").jqxProgressBar('val', pcara); + calcStage(); }; function calcFermentablesFromOG(OG) { @@ -276,6 +279,7 @@ $('#est_ibu2').val(total_ibus); $("#hop_flavour").jqxProgressBar('val', hop_flavour * 10); $("#hop_aroma").jqxProgressBar('val', hop_aroma * 10); + calcStage(); }; function calcSVG() { @@ -1091,6 +1095,8 @@ var newstage = dataRecord.stage; + if (newstage < 1 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3) + newstage = 1; if (newstage < 2 && dataRecord.brew_date_start != '') newstage = 2; // Brewday if (newstage < 3 && dataRecord.brew_date_end != '') @@ -1125,8 +1131,10 @@ if (newstage < 10 && dataRecord.taste_date != '') newstage = 10; // Ready - - console.log("calcStage() now: "+dataRecord.stage+" new: "+newstage); + if (newstage > dataRecord.stage) { + console.log("calcStage() old: "+dataRecord.stage+" new: "+newstage); + dataRecord.stage = newstage; + } /* * Set stage and enable or disable parts of the screens. @@ -1144,9 +1152,14 @@ if (dataRecord.stage > 0) { $("#Delete").jqxButton({ disabled: true }); } + + if (dataRecord.stage < 1) // Planning, no ingredients + $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab + else + $('#jqxTabs').jqxTabs('enableAt', 8); + if (dataRecord.stage < 3) { // Primary $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab - // If recipe not complete, disable 8 too. } else { $('#jqxTabs').jqxTabs('enableAt', 9); } @@ -1796,7 +1809,7 @@ $("#st_guide").val(dataRecord.st_guide); $("#st_category").val(dataRecord.st_category); $("#st_category_number").val(dataRecord.st_category_number); - $("#st_type").val(dataRecord.st_type); + $("#st_type").val(StyleTypeData[dataRecord.st_type].nl); $("#st_og_min").val(dataRecord.st_og_min); $("#st_og_max").val(dataRecord.st_og_max); $("#st_fg_min").val(dataRecord.st_fg_min); @@ -2069,6 +2082,7 @@ }, { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, + { text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { @@ -2870,7 +2884,7 @@ $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); $("#st_letter").jqxInput({ theme: theme, width: 100, height: 23 }); $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); - $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 }); + $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
--- a/www/js/prod_new.js Sun Feb 03 23:21:55 2019 +0100 +++ b/www/js/prod_new.js Mon Feb 04 15:21:49 2019 +0100 @@ -23,104 +23,85 @@ $(document).ready(function () { - // tooltips + var recipe_type = 2; + var style_type = 0; + var tun_material = 0; + + // Tab 1, base $("#name").jqxTooltip({ content: 'De naam voor dit brouw project.' }); - $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' }); - $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit project.' }); - $("#type").jqxTooltip({ content: 'Het brouw type van bier in dit brouw project.' }); - - // editers - var srcType = [ "All Grain", "Partial Mash", "Extract" ]; $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); + $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' }); $("#code").jqxInput({ theme: theme, width: 100, height: 23 }); + $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit project.' }); $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); - $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 }); + $("#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; + } + }); + // Tab 2, style + $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); + $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); + $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 }); + $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); $("#st_letter").jqxInput({ theme: theme, width: 250, height: 23 }); + $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); $("#st_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_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 }); - $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); - $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); - $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); - $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); - $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); + $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); + $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); + $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); + $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); + $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); + $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); + $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); + $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); + $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); + $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); + $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); + $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); + $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); + $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); + $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 }); $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 }); $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 }); - - $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); - $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#eq_calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true }); - $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' }); - $("#eq_boil_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_batch_size").jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' }); - $("#eq_batch_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' }); - $("#eq_tun_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_tun_weight").jqxTooltip({ content: 'Maisch ketel gewicht.' }); - $("#eq_tun_weight").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_tun_height").jqxTooltip({ content: 'Maisch ketel hoogte.' }); - $("#eq_tun_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_tun_material").jqxTooltip({ content: 'Maisch ketel materiaal.' }); - $("#eq_tun_material").jqxInput({ theme: theme, width: 120, height: 23 }); - $("#eq_tun_specific_heat").jqxTooltip({ content: 'Maisch ketel warmte geleiding.' }); - $("#eq_tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_top_up_water").jqxTooltip({ content: 'Extra water in het gistvat.' }); - $("#eq_top_up_water").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_trub_chiller_loss").jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' }); - $("#eq_trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_evap_rate").jqxTooltip({ content: 'Verdamping in liters per uur.' }); - $("#eq_evap_rate").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 2, }); - $("#eq_boil_time").jqxTooltip({ content: 'Normale kooktijd in minuten.' }); - $("#eq_boil_time").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 }); - $("#eq_top_up_kettle").jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' }); - $("#eq_top_up_kettle").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_hop_utilization").jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' }); - $("#eq_hop_utilization").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 }); - $("#eq_notes").jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' }); - $("#eq_notes").jqxInput({ theme: theme, width: 960, height: 100 }); - $("#eq_lauter_volume").jqxTooltip({ content: 'Filterkuip volume.' }); - $("#eq_lauter_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_lauter_height").jqxTooltip({ content: 'Filterkuip hoogte.' }); - $("#eq_lauter_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_lauter_deadspace").jqxTooltip({ content: 'Filterkuip verlies in liters.' }); - $("#eq_lauter_deadspace").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_kettle_volume").jqxTooltip({ content: 'Kook ketel volume in liters.' }); - $("#eq_kettle_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_kettle_height").jqxTooltip({ content: 'Kook ketel hoogte in cm.' }); - $("#eq_kettle_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_mash_volume").jqxTooltip({ content: 'Maisch water voor de eerste stap.' }); - $("#eq_mash_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_mash_max").jqxTooltip({ content: 'De maximale moutstort in Kg.' }); - $("#eq_mash_max").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); - $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - - // Default values - $("#type").val('All Grain'); - $("#styleSelect").jqxDropDownList({ placeHolder: "Kies bierstijl:", theme: theme, source: styleslist, displayMember: "name", - width: 150, + width: 250, height: 27, dropDownWidth: 500, dropDownHeight: 500, renderer: function (index, label, value) { - var datarecord = styleslist.records[index]; + var datarecord = styleslist.records[index]; return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; } }); @@ -133,7 +114,8 @@ $("#st_category_number").val(datarecord.category_number); $("#st_letter").val(datarecord.style_letter); $("#st_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); @@ -153,13 +135,60 @@ } }); - // Equipemnt dropdown list + // Tab 3, equipment + $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); + $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 }); + $("#eq_calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true }); + $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' }); + $("#eq_boil_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_batch_size").jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' }); + $("#eq_batch_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' }); + $("#eq_tun_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_tun_weight").jqxTooltip({ content: 'Maisch ketel gewicht.' }); + $("#eq_tun_weight").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_tun_height").jqxTooltip({ content: 'Maisch ketel hoogte.' }); + $("#eq_tun_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_tun_material").jqxTooltip({ content: 'Maisch ketel materiaal.' }); + $("#eq_tun_material").jqxInput({ theme: theme, width: 180, height: 23 }); + $("#eq_tun_specific_heat").jqxTooltip({ content: 'Maisch ketel warmte geleiding.' }); + $("#eq_tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 3 }); + $("#eq_top_up_water").jqxTooltip({ content: 'Extra water in het gistvat.' }); + $("#eq_top_up_water").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_trub_chiller_loss").jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' }); + $("#eq_trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_evap_rate").jqxTooltip({ content: 'Verdamping in liters per uur.' }); + $("#eq_evap_rate").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 2, }); + $("#eq_boil_time").jqxTooltip({ content: 'Normale kooktijd in minuten.' }); + $("#eq_boil_time").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 0 }); + $("#eq_top_up_kettle").jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' }); + $("#eq_top_up_kettle").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_hop_utilization").jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' }); + $("#eq_hop_utilization").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 0 }); + $("#eq_notes").jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' }); + $("#eq_notes").jqxInput({ theme: theme, width: 960, height: 100 }); + $("#eq_lauter_volume").jqxTooltip({ content: 'Filterkuip volume.' }); + $("#eq_lauter_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_lauter_height").jqxTooltip({ content: 'Filterkuip hoogte.' }); + $("#eq_lauter_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_lauter_deadspace").jqxTooltip({ content: 'Filterkuip verlies in liters.' }); + $("#eq_lauter_deadspace").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_kettle_volume").jqxTooltip({ content: 'Kook ketel volume in liters.' }); + $("#eq_kettle_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_kettle_height").jqxTooltip({ content: 'Kook ketel hoogte in cm.' }); + $("#eq_kettle_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_mash_volume").jqxTooltip({ content: 'Maisch water voor de eerste stap.' }); + $("#eq_mash_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_mash_max").jqxTooltip({ content: 'De maximale moutstort in Kg.' }); + $("#eq_mash_max").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); + $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); $("#equipmentSelect").jqxDropDownList({ placeHolder: "Kies apparatuur:", theme: theme, source: equipmentlist, displayMember: "name", - width: 150, + width: 250, height: 27, dropDownWidth: 300, renderer: function (index, label, value) { @@ -177,7 +206,8 @@ $("#eq_tun_volume").val(datarecord.tun_volume); $("#eq_tun_weight").val(datarecord.tun_weight); $("#eq_tun_specific_heat").val(datarecord.tun_specific_heat); - $("#eq_tun_material").val(datarecord.tun_material); + tun_material = datarecord.tun_material; + $("#eq_tun_material").val(MaterialData[datarecord.tun_material].nl); $("#eq_tun_height").val(datarecord.tun_height); $("#eq_top_up_water").val(datarecord.top_up_water); $("#eq_trub_chiller_loss").val(datarecord.trub_chiller_loss); @@ -223,7 +253,7 @@ name: $("#name").val(), code: $("#code").val(), birth: b, - stage: 'Plan', + stage: 0, notes: $("#notes").val(), log_brew: false, log_fermentation: false, @@ -235,7 +265,7 @@ eq_tun_volume: parseFloat($("#eq_tun_volume").jqxNumberInput('decimal')), eq_tun_weight: parseFloat($("#eq_tun_weight").jqxNumberInput('decimal')), eq_tun_specific_heat: parseFloat($("#eq_tun_specific_heat").jqxNumberInput('decimal')), - eq_tun_material: $("#eq_tun_material").val(), + eq_tun_material: tun_material, eq_tun_height: parseFloat($("#eq_tun_height").jqxNumberInput('decimal')), eq_top_up_water: parseFloat($("#eq_top_up_water").jqxNumberInput('decimal')), eq_trub_chiller_loss: parseFloat($("#eq_trub_chiller_loss").jqxNumberInput('decimal')), @@ -266,7 +296,7 @@ brew_aboil_sg: 1.000, brew_aboil_ph: 0.0, brew_aboil_efficiency: 0, - brew_cooling_method: '-', + brew_cooling_method: 0, brew_cooling_time: 0, brew_cooling_to: 0, brew_whirlpool9: 0, @@ -277,7 +307,7 @@ brew_fermenter_extrawater: 0, brew_aeration_time: 0, brew_aeration_speed: 0, - brew_aeration_type: 'None', + brew_aeration_type: 0, brew_fermenter_sg: 0, brew_fermenter_ibu: 0, brew_date_end: '', @@ -295,12 +325,12 @@ package_date: '', bottle_amount: 0, bottle_carbonation: 0, - bottle_priming_sugar: 'Kristalsuiker', + bottle_priming_sugar: 0, bottle_priming_amount: 0, bottle_carbonation_temp: 23, keg_amount: 0, keg_carbonation: 0, - keg_priming_sugar: 'Kristalsuiker', + keg_priming_sugar: 0, keg_priming_amount: 0, keg_carbonation_temp: 23, keg_forced_carb: false, @@ -318,7 +348,7 @@ st_name: $('#st_name').val(), st_letter: $('#st_letter').val(), st_guide: $('#st_guide').val(), - st_type: $('#st_type').val(), + st_type: style_type, st_category: $('#st_category').val(), st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), @@ -333,7 +363,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: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')), boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')), boil_time: parseFloat($("#eq_boil_time").jqxNumberInput('decimal')), @@ -343,19 +373,33 @@ est_color: 0, est_abv: 0.0, est_carb: 0.0, - color_method: "Morey", + color_method: 0, est_ibu: 0, - ibu_method: "Tinseth", + ibu_method: 0, mash_name: "", mash_ph: 5.4, - sparge_temp: 78.0, + sparge_temp: 85.0, sparge_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')) / 2, sparge_ph: 5.8, - sparge_source: 'Bron 1', - sparge_acid_type: 'Melkzuur', + sparge_source: 0, + sparge_acid_type: 0, sparge_acid_perc: 80, sparge_acid_amount: 0, - calc_acid: true + calc_acid: true, + w1_name: 'Tap water', + w1_amount: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), + 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({ @@ -443,7 +487,9 @@ //Validating the first tab firstTab: function (notify) { - var name = $('#name').val(), code = $('#code').val(), message = ''; + var name = $('#name').val(), + code = $('#code').val(), + message = ''; if (name.length < 3) { message += 'Je moet een brouw project naam invullen. <br />'; } @@ -481,7 +527,7 @@ //Validating the third tab thirdTab: function (notify) { var equipsel = $('#equipmentSelect').val(), - message = ''; + message = ''; if (equipsel.length < 3) { message += 'Je moet een brouw installatie kiezen. <br />'; }
--- a/www/js/rec_new.js Sun Feb 03 23:21:55 2019 +0100 +++ b/www/js/rec_new.js Mon Feb 04 15:21:49 2019 +0100 @@ -89,7 +89,7 @@ dropDownWidth: 500, dropDownHeight: 500, renderer: function (index, label, value) { - var datarecord = styleslist.records[index]; + var datarecord = styleslist.records[index]; return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; } });
--- a/www/prod_new.php Sun Feb 03 23:21:55 2019 +0100 +++ b/www/prod_new.php Mon Feb 04 15:21:49 2019 +0100 @@ -13,7 +13,7 @@ <div class="section"> <div style="overflow: hidden;"> - <table> + <table style="width: 100%;"> <tr> <td style="vertical-align: top; float: right; padding: 3px;">Brouw project naam:</td> <td align="left" colspan="3" style="vertical-align: top; padding: 3px;"><input id="name" /></td> @@ -39,7 +39,7 @@ <div class="section"> <div style="overflow: hidden;"> - <table> + <table style="width: 100%;"> <tr> <td align="right" style="vertical-align: top;">Kies stijl:</td> <td align="left" colspan="3"><div id="styleSelect">Stylenlijst</div></td> @@ -108,7 +108,7 @@ <div class="section"> <div style="overflow: hidden;"> - <table> + <table style="width: 100%;"> <tr> <td align="right" style="vertical-align: top;">Kies apparatuur:</td> <td align="left" colspan="3"><div id="equipmentSelect">Apparatuur</div></td>
--- a/www/prod_print.php Sun Feb 03 23:21:55 2019 +0100 +++ b/www/prod_print.php Mon Feb 04 15:21:49 2019 +0100 @@ -30,6 +30,9 @@ $colorw = 0; $total_ibus = 0; $preboil_sg = 0; +date_default_timezone_set('Europe/Amsterdam'); +$prdate = date(DATE_RFC2822); + class PDF_MySQL_Table extends FPDF { @@ -58,6 +61,7 @@ function TableGlobal($row) { /* 2 Columns */ + $recipetype = array( 'Extract', 'Deelmaisch', 'Mout' ); $vul = $this->w - $this->rMargin - $this->lMargin - 160; $cMargin=$this->cMargin; $this->cMargin=2; @@ -73,7 +77,7 @@ $this->SetX($this->TableX); $this->Cell(35,5,'Type',0,0,'L',true); - $this->Cell(45,5,$row['type'],0,0,'L',true); + $this->Cell(45,5,$recipetype[$row['type']],0,0,'L',true); $this->Cell($vul,5,'',0,0,'L',false); $this->Cell(35,5,'Batch grootte',0,0,'L',true); $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true); @@ -105,6 +109,7 @@ global $pCara; global $colorw; global $preboil_sg; + $added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen' ); $vul = $this->w - $this->rMargin - $this->lMargin - 132; $this->AddCol($vul,'Grondstof','L'); $this->AddCol(30,'Leverancier','L'); @@ -129,9 +134,6 @@ foreach($arr as $item) { //foreach element in $arr $name = iconv('UTF-8','windows-1252',$item['f_name']); $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); - $added = iconv('UTF-8','windows-1252',$item['f_added']); - $type = iconv('UTF-8','windows-1252',$item['f_type']); - $graintype = iconv('UTF-8','windows-1252',$item['f_graintype']); $amount = floatval($item['f_amount']); $costkg = floatval($item['f_cost']); $yield = floatval($item['f_yield']); @@ -139,9 +141,9 @@ $color = floatval($item['f_color']); $percent = floatval($item['f_percentage']); - if ($type == "Sugar") + if ($item['f_type'] == 1) // Sugar $pSugar += $percent; - if ($graintype == "Crystal") + if ($item['f_graintype'] == 2) // Crystal $pCara += $percent; $cost = $amount * $costkg; @@ -149,7 +151,7 @@ $total_fermentables += $amount; /* Calculate the amount of sugars */ $d = $amount * ($yield / 100) * (1 - $moisture / 100); - if ($added == "Mash") { + if ($item['f_added'] == 0) { $d = floatval($row['efficiency']) / 100 * $d; $sugarsm += $d; } @@ -159,7 +161,7 @@ $this->Cell($vul,5,$name,0,0,'L',true); $this->Cell(30,5,$supplier,0,0,'L',true); $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); - $this->Cell(17,5,added_type_names($added),0,0,'L',true); + $this->Cell(17,5,$added[$item['f_added']],0,0,'L',true); $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); @@ -185,6 +187,8 @@ global $total_ibus; global $cost_hops; global $preboil_sg; + $hopform = array( 'Pellets', 'Plugs', 'Bellen' ); + $hopuse = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' ); $vul = $this->w - $this->rMargin - $this->lMargin - 135; $this->AddCol($vul,'Hop','L'); $this->AddCol(35,'Land','L'); @@ -208,8 +212,6 @@ foreach($arr as $item) { //foreach element in $arr $name = iconv('UTF-8','windows-1252',$item['h_name']); $origin = iconv('UTF-8','windows-1252',$item['h_origin']); - $useat = iconv('UTF-8','windows-1252',$item['h_useat']); - $form = iconv('UTF-8','windows-1252',$item['h_form']); $amount = floatval($item['h_amount']) * 1000; $mass = $amount; $costkg = floatval($item['h_cost']); @@ -220,16 +222,16 @@ $cost_hops += $cost; $total_hops += $amount; - $moment = hop_useat_names($useat); - if ($useat == "Boil") { + $moment = $hopuse[$item['h_useat']]; + if ($item['h_useat'] == 2) { // Boil $moment = "Kook@".$time; } - $ibu = calc_IBU($useat, $form, /*floatval($row['est_og'])*/ $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); + $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); $total_ibus += $ibu; $this->Cell($vul,5,$name,0,0,'L',true); $this->Cell(35,5,$origin,0,0,'L',true); - $this->Cell(15,5,hop_form_names($form),0,0,'L',true); + $this->Cell(15,5,$hopform[$item['h_form']],0,0,'L',true); $this->Cell(20,5,$moment,0,0,'L',true); $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); @@ -252,6 +254,8 @@ function TableYeasts($row) { global $cost_yeasts; global $svg; + $yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' ); + $yeastuse = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' ); $vul = $this->w - $this->rMargin - $this->lMargin - 140; $this->AddCol(27,'Laboratorium','L'); $this->AddCol(18,'Product','L'); @@ -276,24 +280,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']); - $form = iconv('UTF-8','windows-1252',$item['y_form']); - $use = iconv('UTF-8','windows-1252',$item['y_use']); - $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 ($use == "Primary") + 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,yeast_use_names($use),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,yeast_form_names($form),0,0,'L',true); - $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); + $this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',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(); } @@ -309,10 +315,12 @@ function TableMiscs($row) { global $cost_miscs; - $vul = $this->w - $this->rMargin - $this->lMargin - 95; + $misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' ); + $miscuse = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' ); + $vul = $this->w - $this->rMargin - $this->lMargin - 100; $this->AddCol($vul,'Naam','L'); $this->AddCol(30,'Soort','L'); - $this->AddCol(25,'Gebruik','L'); + $this->AddCol(30,'Gebruik','L'); $this->AddCol(20,'Hoeveel','R'); $this->AddCol(20,'Prijs','R'); @@ -328,8 +336,8 @@ $arr = json_decode($row['json_miscs'], true); foreach($arr as $item) { $name = iconv('UTF-8','windows-1252',$item['m_name']); - $type = iconv('UTF-8','windows-1252',$item['m_type']); - $use_use = iconv('UTF-8','windows-1252',$item['m_use_use']); + $type = $item['m_type']; + $use_use = $item['m_use_use']; $amount = floatval($item['m_amount']) * 1000; $costg = floatval($item['m_cost']) / 1000; $time = floatval($item['m_time']); @@ -337,24 +345,24 @@ $cost = $amount * $costg; $cost_miscs += $cost; - if ($type == "Water agent") + if ($type == 4) // Water agent $this->SetFillColor(240,140,130); - else if ($type == "Fining") + else if ($type == 3) // Fining $this->SetFillColor(95,180,25); - else if (($type == "Spice") || ($type == "Herb") || ($type == "Flavor") || ($type == "Yeast nutrient")) + else if (($type == 0) || ($type == 1) || ($type == 2) || ($type == 5)) // Spice, Herb, Flavour, Yeast nutrient $this->SetFillColor(240,250,65); else $this->SetFillColor(210,245,255); - if ($use_use == "Boil") - $gebruik = sprintf("%s %d min",misc_use_names($use_use),$time); + if ($use_use == 2) // Boil + $gebruik = sprintf("%s %d min",$miscuse[$use_use],$time); else - $gebruik = misc_use_names($use_use); + $gebruik = $miscuse[$use_use]; $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); $this->Cell($vul,5,$name,0,0,'L',true); - $this->Cell(30,5,misc_type_names($type),0,0,'L',true); - $this->Cell(25,5,$gebruik,0,0,'L',true); + $this->Cell(30,5,$misctype[$type],0,0,'L',true); + $this->Cell(30,5,$gebruik,0,0,'L',true); $this->Cell(20,5,$hoeveel,0,0,'R',true); $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); $this->Ln(); @@ -453,12 +461,25 @@ class PDF extends PDF_MySQL_Table { function Header() { global $row; + global $prdate; + $stage = array( 'Plan', 'Wacht', 'Brouwen', 'Hoofdgisting', 'Nagisting', 'Lagering', 'Afvullen', 'Hergisten', 'Rijpen', 'Proeven', 'Gereed', 'Afgesloten' ); $this->Image('images/logo.png',10,6,30); // Title $this->SetFont('Helvetica','B',18); $this->SetX(45); - $this->Cell(0,8,$row['name'],1,1,'L'); - $this->Ln(20); + $this->Cell(0,8,$row['name'],0,1,'L'); + $this->Ln(1); + $this->SetFont('Helvetica','',10); + $this->SetX(45); + $this->Cell(17,5,'Datum:',0,0,'L'); + $this->Cell(0,5,$prdate,0,1,'L'); + $this->SetX(45); + $this->Cell(17,5,'Stijl:',0,0,'L'); + $this->Cell(0,5,$row['st_name'],0,1,'L'); + $this->SetX(45); + $this->Cell(17,5,'Fase:',0,0,'L'); + $this->Cell(0,5,$stage[$row['stage']],0,1,'L'); + $this->Ln(6); // Ensure table header is printed parent::Header(); } @@ -483,6 +504,22 @@ $pdf->SetFillColor(210,245,255); $pdf->MultiCell(0,4,$row['notes'],0,'L',true); } -// Disclaimer toevoegen dat dit alleen recept ontwikkeling is. Uitkomsten zoals IBU zijn een berekende schatting. -// Footer sectie met berekende/geschatte uitkomsten zoals ABV, kostprijs per liter enz. + +if ($row['stage'] == 2) { + // Checklist +} +if ($row['stage'] > 2) { + // Brouw rapport +} +if ($row['stage'] > 3) { + // Vergisting gegevens +} +if ($row['stage'] > 6) { + // Package report +} +if ($row['stage'] > 9) { + // Taste notes +} + + $pdf->Output();
--- a/www/rec_print.php Sun Feb 03 23:21:55 2019 +0100 +++ b/www/rec_print.php Mon Feb 04 15:21:49 2019 +0100 @@ -465,7 +465,7 @@ $this->Cell(17,5,'Datum:',0,0,'L'); $this->Cell(0,5,$prdate,0,1,'L'); $this->SetX(45); - $this->Cell(17,5,'Styl:',0,0,'L'); + $this->Cell(17,5,'Stijl:',0,0,'L'); $this->Cell(0,5,$row['st_name'],0,1,'L'); $this->Ln(7); // Ensure table header is printed