# HG changeset patch # User Michiel Broek # Date 1561062544 -7200 # Node ID beb1a83af4e723b3636efb5ed562a2b24f1447a1 # Parent 5e9cbf2bb46fc4582f6a1aa9a9af4674249642dc# Parent 7671a5fc5171d46f32b02301f09ad681f21e360f Merged with default diff -r 5e9cbf2bb46f -r beb1a83af4e7 README.design diff -r 5e9cbf2bb46f -r beb1a83af4e7 config.status diff -r 5e9cbf2bb46f -r beb1a83af4e7 configure diff -r 5e9cbf2bb46f -r beb1a83af4e7 configure.ac diff -r 5e9cbf2bb46f -r beb1a83af4e7 www/crontasks.php --- a/www/crontasks.php Sat Jun 15 19:43:46 2019 +0200 +++ b/www/crontasks.php Thu Jun 20 22:29:04 2019 +0200 @@ -15,6 +15,28 @@ /* + * Upgrade package values. + */ +$query = "UPDATE products SET package_volume = bottle_amount + keg_amount WHERE package_volume='0';"; +$result = mysqli_query($connect, $query); +$changed = mysqli_affected_rows($connect); +if ($changed > 0) { + syslog(LOG_NOTICE, "Updated ".$changed." products to new package_volume value"); +} +$query = "UPDATE products SET bottle_priming_water = bottle_amount * bottle_priming_amount / 500 WHERE bottle_priming_water = 0;"; +$result = mysqli_query($connect, $query); +$changed = mysqli_affected_rows($connect); +if ($changed > 0) { + syslog(LOG_NOTICE, "Updated ".$changed." products to new package_volume value"); +} +$query = "UPDATE products SET keg_priming_water = keg_amount * keg_priming_amount / 500 WHERE keg_priming_water = 0;"; +$result = mysqli_query($connect, $query); +$changed = mysqli_affected_rows($connect); +if ($changed > 0) { + syslog(LOG_NOTICE, "Updated ".$changed." products to new package_volume value"); +} + +/* * Upgrade inventory_reduced value from old boolean to tiny integer value. */ $query = "UPDATE products SET inventory_reduced=stage WHERE inventory_reduced = 1"; diff -r 5e9cbf2bb46f -r beb1a83af4e7 www/includes/db_product.php --- a/www/includes/db_product.php Sat Jun 15 19:43:46 2019 +0200 +++ b/www/includes/db_product.php Thu Jun 20 22:29:04 2019 +0200 @@ -127,14 +127,19 @@ $sql .= "', package_date=NULL"; else $sql .= "', package_date='" . $_POST['package_date'] ."'"; - $sql .= ", bottle_amount='" . $_POST['bottle_amount']; + $sql .= ", package_volume='" . $_POST['package_volume']; + $sql .= "', package_infuse_amount='" . $_POST['package_infuse_amount']; + $sql .= "', package_infuse_abv='" . $_POST['package_infuse_abv']; + $sql .= "', package_infuse_notes='" . mysqli_real_escape_string($connect, $_POST['package_infuse_notes']); + $sql .= "', package_abv='" . $_POST['package_abv']; + $sql .= "', bottle_amount='" . $_POST['bottle_amount']; $sql .= "', bottle_carbonation='" . $_POST['bottle_carbonation']; - //$sql .= "', bottle_priming_sugar='" . $_POST['bottle_priming_sugar']; + $sql .= "', bottle_priming_water='" . $_POST['bottle_priming_water']; $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_water='" . $_POST['keg_priming_water']; $sql .= "', keg_priming_amount='" . $_POST['keg_priming_amount']; $sql .= "', keg_carbonation_temp='" . $_POST['keg_carbonation_temp']; $sql .= "', keg_forced_carb='" . $_POST['keg_forced_carb']; @@ -711,14 +716,19 @@ $brew .= ',"secondary_end_date":"' . $row['secondary_end_date']; $brew .= '","tertiary_temp":' . floatval($row['tertiary_temp']); $brew .= ',"package_date":"' . $row['package_date']; - $brew .= '","bottle_amount":' . floatval($row['bottle_amount']); + $brew .= '","package_volume":' . floatval($row['package_volume']); + $brew .= ',"package_infuse_amount":' . floatval($row['package_infuse_amount']); + $brew .= ',"package_infuse_abv":' . floatval($row['package_infuse_abv']); + $brew .= ',"package_infuse_notes":"' . $row['package_infuse_notes']; + $brew .= '","package_abv":' . floatval($row['package_abv']); + $brew .= ',"bottle_amount":' . floatval($row['bottle_amount']); $brew .= ',"bottle_carbonation":' . floatval($row['bottle_carbonation']); - //$brew .= ',"bottle_priming_sugar":' . $row['bottle_priming_sugar']; + $brew .= ',"bottle_priming_water":' . floatval($row['bottle_priming_water']); $brew .= ',"bottle_priming_amount":' . floatval($row['bottle_priming_amount']); $brew .= ',"bottle_carbonation_temp":' . floatval($row['bottle_carbonation_temp']); $brew .= ',"keg_amount":' . floatval($row['keg_amount']); $brew .= ',"keg_carbonation":' . floatval($row['keg_carbonation']); - //$brew .= ',"keg_priming_sugar":' . $row['keg_priming_sugar']; + $brew .= ',"keg_priming_water":' . floatval($row['keg_priming_water']); $brew .= ',"keg_priming_amount":' . floatval($row['keg_priming_amount']); $brew .= ',"keg_carbonation_temp":' . floatval($row['keg_carbonation_temp']); $brew .= ',"keg_forced_carb":' . floatval($row['keg_forced_carb']); diff -r 5e9cbf2bb46f -r beb1a83af4e7 www/js/prod_edit.js --- a/www/js/prod_edit.js Sat Jun 15 19:43:46 2019 +0200 +++ b/www/js/prod_edit.js Thu Jun 20 22:29:04 2019 +0200 @@ -1836,7 +1836,20 @@ var ABV = abvol(dataRecord.brew_fermenter_sg, parseFloat($("#est_fg").jqxNumberInput('decimal'))); else var ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg); - ABV = Math.round(ABV * 100) / 100; + + /* + * Calculate new volume and alcohol. + */ + var bvol = dataRecord.package_volume - (ABV * dataRecord.package_volume) / 100; + var balc = dataRecord.package_volume - bvol; + var mvol = dataRecord.package_infuse_amount - (dataRecord.package_infuse_abv * dataRecord.package_infuse_amount) / 100; + var malc = dataRecord.package_infuse_amount - mvol; + var talc = balc + malc; + var tvol = bvol + mvol; + ABV = Math.round(talc / (tvol + talc) * 10000) / 100; + //console.log("bvol:"+bvol+" balc:"+balc+" mvol:"+mvol+" malc:"+malc+" tvol:"+tvol+" talc:"+talc+" abv:"+ABV+" vol:"+(tvol + talc)); + dataRecord.package_abv = ABV; + $("#package_abv").val(ABV); console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV); if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { @@ -1857,7 +1870,13 @@ } $("#bottle_priming_amount").val(Math.round(dataRecord.bottle_priming_amount * 10) / 10); $("#bottle_priming_total").val(dataRecord.bottle_priming_total); - $("#bottle_abv").val(Math.round((ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907) * 10) / 10); + var pabv = ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907; + var pvol = dataRecord.bottle_amount - (pabv * dataRecord.bottle_amount) / 100; + var talc = dataRecord.bottle_amount - pvol; + var tvol = pvol + dataRecord.bottle_priming_water; + var babv = Math.round(talc / (tvol + talc) * 10000) / 100; + //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv); + $("#bottle_abv").val(babv); $("#bottle_pressure").val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp)); // Kegs @@ -1879,10 +1898,20 @@ $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000); } } + $("#keg_priming_amount").val(Math.round(dataRecord.keg_priming_amount * 10) / 10); + $("#keg_priming_total").val(dataRecord.keg_priming_total); + var pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907; + var pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100; + var talc = dataRecord.keg_amount - pvol; + var tvol = pvol + dataRecord.keg_priming_water; + var kabv = Math.round(talc / (tvol + talc) * 10000) / 100; + //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); + $("#keg_abv").val(kabv); + } else { + $("#keg_priming_amount").val(0); + $("#keg_priming_total").val(0); + $("#keg_abv").val(ABV); } - $("#keg_priming_amount").val(Math.round(dataRecord.keg_priming_amount * 10) / 10); - $("#keg_priming_total").val(dataRecord.keg_priming_total); - $("#keg_abv").val(Math.round((ABV + dataRecord.keg_priming_amount * 0.47 / 7.907) * 10) / 10); } function calcStage() { @@ -2042,7 +2071,13 @@ $("#fg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); $("#final_brix").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); $("#package_date").jqxDateTimeInput({ disabled: true }); + $("#package_volume").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#package_infuse_amount").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#package_infuse_abv").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#package_infuse_notes").jqxInput({ disabled: true }); $("#bottle_amount").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#bottle_priming_water").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); + $("#keg_priming_water").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); $("#keg_amount").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); $("#bottle_carbonation").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); $("#keg_carbonation").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); @@ -2374,12 +2409,78 @@ calcFermentation(); calcCarbonation(); + $('#package_volume').on('change', function (event) { + var told = dataRecord.package_volume + dataRecord.package_infuse_amount; + dataRecord.package_volume = parseFloat(event.args.value); + if (dataRecord.package_volume > dataRecord.brew_fermenter_volume) { + dataRecord.package_volume = dataRecord.brew_fermenter_volume; + $('#package_volume').val(dataRecord.package_volume); + } + var tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; + var diff = tnew - told; + if (told > 0) { + dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff; + dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff; + } else { + dataRecord.bottle_amount = tnew; + dataRecord.keg_amount = 0; + } + console.log("diff:"+diff+" old:"+told+" bottle:"+dataRecord.bottle_amount+" keg:"+dataRecord.keg_amount); + $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000); + $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000); + calcCarbonation(); + }); + $('#package_infuse_amount').on('change', function (event) { + var told = dataRecord.package_volume + dataRecord.package_infuse_amount; + dataRecord.package_infuse_amount = parseFloat(event.args.value); + var tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; + var diff = tnew - told; + if (told > 0) { + dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff; + dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff; + } else { + dataRecord.bottle_amount = tnew; + dataRecord.keg_amount = 0; + } + console.log("diff:"+diff+" old:"+told+" bottle:"+dataRecord.bottle_amount+" keg:"+dataRecord.keg_amount); + $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000); + $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000); + calcCarbonation(); + }); + $('#package_infuse_abv').on('change', function (event) { + dataRecord.package_infuse_abv = parseFloat(event.args.value); + calcCarbonation(); + }); $('#bottle_amount').on('change', function (event) { - dataRecord.bottle_amount = parseFloat(event.args.value); + var vnew = parseFloat(event.args.value); + var vtot = dataRecord.package_volume + dataRecord.package_infuse_amount; + if (vnew > vtot) + vnew = vtot; + diff = dataRecord.bottle_amount - vnew; + dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount - diff) * 1000) / 1000; + dataRecord.keg_amount = Math.round((dataRecord.keg_amount + diff) * 1000) / 1000; + $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); + $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); + calcCarbonation(); + }); + $("#bottle_priming_water").on('change', function (event) { + dataRecord.bottle_priming_water = parseFloat(event.args.value); calcCarbonation(); }); $('#keg_amount').on('change', function (event) { - dataRecord.keg_amount = parseFloat(event.args.value); + var vnew = parseFloat(event.args.value); + var vtot = dataRecord.package_volume + dataRecord.package_infuse_amount; + if (vnew > vtot) + vnew = vtot; + diff = dataRecord.keg_amount - vnew; + dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount + diff) * 1000) / 1000; + dataRecord.keg_amount = Math.round((dataRecord.keg_amount - diff) * 1000) / 1000; + $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); + $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); + calcCarbonation(); + }); + $("#keg_priming_water").on('change', function (event) { + dataRecord.keg_priming_water = parseFloat(event.args.value); calcCarbonation(); }); $('#bottle_carbonation').on('change', function (event) { @@ -2664,14 +2765,19 @@ secondary_end_date: $("#secondary_end_date").val(), tertiary_temp: parseFloat($("#tertiary_temp").jqxNumberInput('decimal')), package_date: $("#package_date").val(), + package_volume: parseFloat($("#package_volume").jqxNumberInput('decimal')), + package_infuse_amount: parseFloat($("#package_infuse_amount").jqxNumberInput('decimal')), + package_infuse_abv: parseFloat($("#package_infuse_abv").jqxNumberInput('decimal')), + package_infuse_notes: $("#package_infuse_notes").val(), + package_abv: parseFloat($("#package_abv").jqxNumberInput('decimal')), bottle_amount: parseFloat($("#bottle_amount").jqxNumberInput('decimal')), bottle_carbonation: parseFloat($("#bottle_carbonation").jqxNumberInput('decimal')), - //bottle_priming_sugar: $("#bottle_priming_sugar").val(), + bottle_priming_water: parseFloat($("#bottle_priming_water").jqxNumberInput('decimal')), bottle_priming_amount: parseFloat($("#bottle_priming_amount").jqxNumberInput('decimal')), bottle_carbonation_temp: parseFloat($("#bottle_carbonation_temp").jqxNumberInput('decimal')), keg_amount: parseFloat($("#keg_amount").jqxNumberInput('decimal')), keg_carbonation: parseFloat($("#keg_carbonation").jqxNumberInput('decimal')), - //keg_priming_sugar: $("#keg_priming_sugar").val(), + keg_priming_water: parseFloat($("#keg_priming_water").jqxNumberInput('decimal')), keg_priming_amount: parseFloat($("#keg_priming_amount").jqxNumberInput('decimal')), keg_carbonation_temp: parseFloat($("#keg_carbonation_temp").jqxNumberInput('decimal')), keg_forced_carb: dataRecord.keg_forced_carb, @@ -2887,14 +2993,19 @@ { name: 'secondary_end_date', type: 'string' }, { name: 'tertiary_temp', type: 'float' }, { name: 'package_date', type: 'string' }, + { name: 'package_volume', type: 'float' }, + { name: 'package_infuse_amount', type: 'float' }, + { name: 'package_infuse_abv', type: 'float' }, + { name: 'package_infuse_notes', type: 'string' }, + { name: 'package_abv', type: 'float' }, { name: 'bottle_amount', type: 'float' }, { name: 'bottle_carbonation', type: 'float' }, - //{ name: 'bottle_priming_sugar', type: 'int' }, + { name: 'bottle_priming_water', type: 'float' }, { name: 'bottle_priming_amount', type: 'float' }, { name: 'bottle_carbonation_temp', type: 'float' }, { name: 'keg_amount', type: 'float' }, { name: 'keg_carbonation', type: 'float' }, - //{ name: 'keg_priming_sugar', type: 'int' }, + { name: 'keg_priming_water', type: 'float' }, { name: 'keg_priming_amount', type: 'float' }, { name: 'keg_carbonation_temp', type: 'float' }, { name: 'keg_forced_carb', type: 'int' }, @@ -3091,14 +3202,19 @@ $("#secondary_end_date").val(dataRecord.secondary_end_date); $("#tertiary_temp").val(dataRecord.tertiary_temp); $("#package_date").val(dataRecord.package_date); + $("#package_volume").val(dataRecord.package_volume); + $("#package_infuse_amount").val(dataRecord.package_infuse_amount); + $("#package_infuse_abv").val(dataRecord.package_infuse_abv); + $("#package_infuse_notes").val(dataRecord.package_infuse_notes); + $("#package_abv").val(dataRecord.package_abv); $("#bottle_amount").val(dataRecord.bottle_amount); $("#bottle_carbonation").val(dataRecord.bottle_carbonation); - //$("#bottle_priming_sugar").val(dataRecord.bottle_priming_sugar); + $("#bottle_priming_water").val(dataRecord.bottle_priming_water); $("#bottle_priming_amount").val(dataRecord.bottle_priming_amount); $("#bottle_carbonation_temp").val(dataRecord.bottle_carbonation_temp); $("#keg_amount").val(dataRecord.keg_amount); $("#keg_carbonation").val(dataRecord.keg_carbonation); - //$("#keg_priming_sugar").val(dataRecord.keg_priming_sugar); + $("#keg_priming_water").val(dataRecord.keg_priming_water); $("#keg_priming_amount").val(dataRecord.keg_priming_amount); $("#keg_carbonation_temp").val(dataRecord.keg_carbonation_temp); $("#keg_forced_carb").val(dataRecord.keg_forced_carb); @@ -5697,6 +5813,16 @@ $("#package_date").jqxTooltip({ content: 'De verpakkings datum van dit bier.' }); $("#package_date").jqxDateTimeInput( Dateopts ); $('#package_date').on('close', function (event) { calcStage(); }); + $('#package_volume').jqxTooltip({ content: 'Het beschikbare volume om te bottelen of op fust te zetten.' }); + $('#package_volume').jqxNumberInput( Spin1dec ); + $('#package_infuse_amount').jqxTooltip({ content: 'De hoeveelheid water of drank extra toe te voegen.' }); + $('#package_infuse_amount').jqxNumberInput( Spin3dec ); + $('#package_infuse_abv').jqxTooltip({ content: 'De hoeveelheid alcohol in de drank, of 0.0 als het water is.' }); + $('#package_infuse_abv').jqxNumberInput( Spin1dec ); + $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' }); + $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 }); + $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' }); + $('#package_abv').jqxNumberInput( Show1dec ); $("#st_carb_min2").jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'}); $("#st_carb_min2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); $("#st_carb_max2").jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'}); @@ -5820,9 +5946,13 @@ } }); $("#bottle_priming_amount").jqxNumberInput( Show1dec ); + $("#bottle_priming_water").jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); + $("#bottle_priming_water").jqxNumberInput( Spin3dec ); $("#keg_priming_amount").jqxNumberInput( Show1dec ); + $("#keg_priming_water").jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); + $("#keg_priming_water").jqxNumberInput( Spin3dec ); $("#bottle_priming_total").jqxNumberInput( Show1dec ); - $("#bottle_pressure").jqxTooltip({ content: 'De maximal te verwachten druk tijdens het hergisten.' }); + $("#bottle_pressure").jqxTooltip({ content: 'De maximaal te verwachten druk tijdens het hergisten.' }); $("#bottle_pressure").jqxNumberInput( Show1dec ); $("#keg_priming_total").jqxNumberInput( Show1dec ); $("#keg_forced_carb").jqxCheckBox({ theme: theme, width: 120, height: 23 }); diff -r 5e9cbf2bb46f -r beb1a83af4e7 www/prod_checklist.php --- a/www/prod_checklist.php Sat Jun 15 19:43:46 2019 +0200 +++ b/www/prod_checklist.php Thu Jun 20 22:29:04 2019 +0200 @@ -464,7 +464,7 @@ foreach($hops as $item2) { if ($item2['h_useat'] == 5) { $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `'; - $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor'; + $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor '; $s .= sprintf("%.0f",$item2['h_time']/1440).' dagen toevoegen'; $this->Checkline($s); } @@ -498,7 +498,7 @@ */ $lines = 0; foreach($ferms as $item1) { - if ($item1['f_added'] == 4) + if ($item1['f_added'] >= 4) $lines++; } $yeasts = json_decode($row['json_yeasts'], true); @@ -521,7 +521,18 @@ foreach($ferms as $item1) { if ($item1['f_added'] == 4) { $s = sprintf("%.3f",$item1['f_amount']).' kg `'; - $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij bottelen'; + $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`'; + if ($row['bottle_priming_water'] > 0) + $s .= ' met '.sprintf("%.3f",$row['bottle_priming_water']).' liter water'; + $s .= ' bij bottelen'; + $this->Checkline($s); + } + if ($item1['f_added'] == 5) { + $s = sprintf("%.3f",$item1['f_amount']).' kg `'; + $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`'; + if ($row['keg_priming_water'] > 0) + $s .= ' met '.sprintf("%.3f",$row['keg_priming_water']).' liter water'; + $s .= ' bij op fust zetten'; $this->Checkline($s); } } diff -r 5e9cbf2bb46f -r beb1a83af4e7 www/prod_edit.php --- a/www/prod_edit.php Sat Jun 15 19:43:46 2019 +0200 +++ b/www/prod_edit.php Thu Jun 20 22:29:04 2019 +0200 @@ -733,8 +733,32 @@
+ Verdunnen of infusie + + + Volume na vergisting l: +
+ + + Toevoeging liter: +
+ Toevoeging ABV %: +
+ + + Toevoeging omschrijving: + + + + Finaal alcohol %: +
+ + +
+ + Flessen - Kegs + Fusten Hoeveelheid liter: @@ -767,6 +791,12 @@
+ Suikeroplossing water l: +
+ Suikeroplossing water l: +
+ + Op druk brengen met CO2:
diff -r 5e9cbf2bb46f -r beb1a83af4e7 www/prod_print.php --- a/www/prod_print.php Sat Jun 15 19:43:46 2019 +0200 +++ b/www/prod_print.php Thu Jun 20 22:29:04 2019 +0200 @@ -33,6 +33,10 @@ $mashkg = 0; date_default_timezone_set('Europe/Amsterdam'); $prdate = date(DATE_RFC2822); +$bottle_sugar = ''; +$keg_sugar = ''; +$bottle_sugar_amount = 0; +$keg_sugar_amount = 0; class PDF_MySQL_Table extends FPDF @@ -111,6 +115,10 @@ global $colorw; global $preboil_sg; global $mashkg; + global $bottle_sugar; + global $bottle_sugar_amount; + global $keg_sugar; + global $keg_sugar_amount; $added = array( 'Maischen', 'Koken 10 min', 'Vergisten', 'Nagisten/lageren', 'Bottelen', 'Op fust' ); $ftype = array( 'Mout', 'Suiker', 'Vloeibaar extract', 'Droog extract', 'Ongemout graan' ); $mtype = array( 'Basismout', 'Geroosterde mout', 'Cara- of crystalmout', 'Geƫeste mout', 'Zuurmout', 'Speciale mout', 'Geen mout' ); @@ -156,6 +164,15 @@ else $soort = iconv('UTF-8','windows-1252',$ftype[$item['f_type']]); + if ($item['f_added'] == 4) { + $bottle_sugar = $name; + $bottle_sugar_amount = $amount; + } + if ($item['f_added'] == 5) { + $keg_sugar = $name; + $keg_sugar_amount = $amount; + } + $cost = $amount * $costkg; $cost_fermentables += $cost; $total_fermentables += $amount; @@ -792,6 +809,277 @@ $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_ibu'])).' IBU',0,0,'L',true); $this->Ln(); } + + function Fermentation($row) { + + if ($this->GetY() > 230) + $this->AddPage(); + else + $this->Ln(10); + + $vul = $this->w - $this->rMargin - $this->lMargin - 180; + $cMargin=$this->cMargin; + $this->cMargin=2; + $this->TableX=$this->lMargin; + $this->SetFont('Helvetica','B',9); + $this->SetX($this->TableX); + $this->SetFillColor(255,150,100); + $this->Cell(0, 5, 'Vergisting gegevens',0,0,'C',true); + $this->Ln(); + + $this->SetFont('Helvetica','',9); + $this->SetFillColor(210,245,255); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hoofdvergisting start temp.',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['primary_start_temp']).DEG.'C',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Navergisting tempertuur',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['secondary_temp']).DEG.'C',0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hoofdvergisting piek temp.',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['primary_max_temp']).DEG.'C',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Navergisting einde',0,0,'L',true); + $this->Cell(45,5,$row['secondary_end_date'],0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hoofdvergisting eind temp.',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['primary_end_temp']).DEG.'C',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Lageren temperatuur',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['tertiary_temp']).DEG.'C',0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hoofdvergisting densiteit',0,0,'L',true); + $this->Cell(45,5,density_str(floatval($row['primary_end_sg'])),0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Lageren densiteit',0,0,'L',true); + $this->Cell(45,5,density_str(floatval($row['fg'])),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hoofdvergisting einde',0,0,'L',true); + $this->Cell(45,5,$row['primary_end_date'],0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Lageren einde',0,0,'L',true); + $this->Cell(45,5,$row['package_date'],0,0,'L',true); + $this->Ln(); + + $svg = 100 * (floatval($row['brew_fermenter_sg']) - floatval($row['fg'])) / (floatval($row['brew_fermenter_sg']) - 1); + $this->SetX($this->TableX); + $this->Cell($vul+90,5,'',0,0,'L',false); + $this->Cell(45,5,'Schijnbare vergistingsgraad',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$svg).'%',0,0,'L',true); + $this->Ln(); + } + + function Packaging($row) { + + global $bottle_sugar; + global $bottle_sugar_amount; + global $keg_sugar; + global $keg_sugar_amount; + + if ($this->GetY() > 230) + $this->AddPage(); + else + $this->Ln(10); + + $vul = $this->w - $this->rMargin - $this->lMargin - 180; + $cMargin=$this->cMargin; + $this->cMargin=2; + $this->TableX=$this->lMargin; + $this->SetFont('Helvetica','B',9); + $this->SetX($this->TableX); + $this->SetFillColor(255,150,100); + $this->Cell(0, 5, 'Verpakken',0,0,'C',true); + $this->Ln(); + + $this->SetFont('Helvetica','',9); + $this->SetFillColor(210,245,255); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Datum verpakken',0,0,'L',true); + $this->Cell(45,5,$row['package_date'],0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Hoeveelheid',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['package_volume']).' liter',0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Alcohol volume',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['package_abv']).'%',0,0,'L',true); + if (($row['package_infuse_amount'] > 0) && ($row['package_infuse_abv'] == 0)) { + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Water toevoegen',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['package_infuse_amount']).' liter',0,0,'L',true); + } + $this->Ln(7); + + if (($row['package_infuse_amount'] > 0) && ($row['package_infuse_abv'] > 0)) { + $this->SetX($this->TableX); + $this->Cell(45,5,'Drank toevoegen',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['package_infuse_amount']).' liter',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Bevat alcohol volume',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['package_infuse_abv']).'%',0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(180,5,iconv('UTF-8','windows-1252',$row['package_infuse_notes']),0,0,'L',true); + $this->Ln(7); + } + + $this->SetX($this->TableX); + $this->Cell(45,5,'Flessen volume',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['bottle_amount']).' liter',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Fusten volume',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['keg_amount']).' liter',0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'CO2 volumes',0,0,'L',true); + $this->Cell(45,5,sprintf("%.2f",$row['bottle_carbonation']),0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'CO2 volumes',0,0,'L',true); + $this->Cell(45,5,sprintf("%.2f", $row['keg_carbonation']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Suiker',0,0,'L',true); + $this->Cell(45,5,$bottle_sugar,0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Suiker',0,0,'L',true); + $this->Cell(45,5,$keg_sugar,0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hoeveelheid',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['bottle_priming_amount']).' gram/liter',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + if ($row['keg_forced_carb']) { + $this->Cell(45,5,'Geforceerd op druk zetten',0,0,'L',true); + $this->Cell(45,5,'Ja',0,0,'L',true); + } else { + $this->Cell(45,5,'Hoeveelheid',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['keg_priming_amount']).' gram/liter',0,0,'L',true); + } + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Totaal suiker',0,0,'L',true); + $this->Cell(45,5,sprintf("%.3f",$bottle_sugar_amount).' kg',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + if ($row['keg_forced_carb']) { + $this->Cell(45,5,'Druk op fust',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['keg_pressure']).' bar',0,0,'L',true); + } else { + $this->Cell(45,5,'Totaal suiker',0,0,'L',true); + $this->Cell(45,5,sprintf("%.3f",$keg_sugar_amount).' kg',0,0,'L',true); + } + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Water oplossen',0,0,'L',true); + $this->Cell(45,5,sprintf("%.3f",$row['bottle_priming_water']).' liter',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + if (! $row['keg_forced_carb']) { + $this->Cell(45,5,'Water oplossen',0,0,'L',true); + $this->Cell(45,5,sprintf("%.3f",$row['keg_priming_water']).' liter',0,0,'L',true); + } + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Alcohol volume',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['package_abv'] + $row['bottle_priming_amount'] * 0.47 / 7.907).'%',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Alcohol volume',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['package_abv'] + $row['keg_priming_amount'] * 0.47 / 7.907).'%',0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Hergisting temperatuur',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f",$row['bottle_carbonation_temp']).DEG.'C',0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Hergisting temperatuur',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['keg_carbonation_temp']).DEG.'C',0,0,'L',true); + $this->Ln(); + } + + function Tasting($row) { + + if ($this->GetY() > 200) + $this->AddPage(); + else + $this->Ln(10); + + $vul = $this->w - $this->rMargin - $this->lMargin - 180; + $cMargin=$this->cMargin; + $this->cMargin=2; + $this->TableX=$this->lMargin; + $this->SetFont('Helvetica','B',9); + $this->SetX($this->TableX); + $this->SetFillColor(255,150,100); + $this->Cell(0, 5, 'Proef notities',0,0,'C',true); + $this->Ln(); + + $this->SetFont('Helvetica','',9); + $this->SetFillColor(210,245,255); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Proeven datum',0,0,'L',true); + $this->Cell(45,5,$row['taste_date'],0,0,'L',true); + $this->Cell($vul,5,'',0,0,'L',false); + $this->Cell(45,5,'Waardering',0,0,'L',true); + $this->Cell(45,5,sprintf("%.1f", $row['taste_rate']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Kleur',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_color']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Helderheid',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_transparency']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Schuim',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_head']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Aroma',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_aroma']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Smaak',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_taste']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Mondgevoel',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_mouthfeel']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Nasmaak',0,0,'L',true); + $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_aftertaste']),0,0,'L',true); + $this->Ln(); + + $this->SetX($this->TableX); + $this->Cell(45,5,'Notities',0,0,'L',true); + $this->MultiCell(0,5,iconv('UTF-8','windows-1252',$row['taste_notes']),0,'L',true); + $this->Ln(); + } } @@ -848,7 +1136,7 @@ $pdf->Ln(); $pdf->SetFont('Helvetica','',9); $pdf->SetFillColor(210,245,255); - $pdf->MultiCell(0,4,$row['notes'],0,'L',true); + $pdf->MultiCell(0,4,iconv('UTF-8','windows-1252',$row['notes']),0,'L',true); } if ($row['stage'] > 2) { @@ -856,13 +1144,13 @@ } if ($row['stage'] > 3) { - // Vergisting gegevens + $pdf->Fermentation($row); } if ($row['stage'] > 6) { - // Package report + $pdf->Packaging($row); } if ($row['stage'] > 9) { - // Taste notes + $pdf->Tasting($row); } $pdf->Output();