# HG changeset patch # User Michiel Broek # Date 1659532567 -7200 # Node ID ac5c3e97fcf1063c8a5d21ea187eb088095878d8 # Parent 45e87aa8d02ccf298a69a3daefce94cd781ad577 Phase 1, rebuild recipe editor to a vieuwer. diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/Makefile --- a/www/Makefile Tue Aug 02 20:35:00 2022 +0200 +++ b/www/Makefile Wed Aug 03 15:16:07 2022 +0200 @@ -13,8 +13,7 @@ prod_beerxml.php prod_checklist.php prod_divide.php prod_duplicate.php \ prod_edit.php prod_export.php prod_forum.php \ prod_impbrew.php prod_inprod.php prod_new.php prod_print.php prod_torecipe.php \ - rec_beerxml.php rec_duplicate.php rec_edit.php rec_export.php rec_forum.php \ - rec_import.php rec_main.php rec_new.php rec_print.php rec_toproduct.php \ + rec_edit.php rec_import.php rec_main.php rec_new.php \ upl_fermentables.php upl_hops.php upl_miscs.php upl_recipe.php \ upl_styles.php upl_yeasts.php version.php SUB = version.php.in images/* css/* jqwidgets/* jqwidgets/styles/* \ diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/js/rec_edit.js --- a/www/js/rec_edit.js Tue Aug 02 20:35:00 2022 +0200 +++ b/www/js/rec_edit.js Wed Aug 03 15:16:07 2022 +0200 @@ -57,27 +57,6 @@ eq_tun_specific_heat = 0.110, // Stainless Steel data_loaded = 0; -function createDelElements() { - $('#eventWindow').jqxWindow({ - theme: theme, - position: { x: 490, y: 210 }, - width: 300, - height: 175, - resizable: false, - isModal: true, - modalOpacity: 0.4, - okButton: $('#delOk'), - cancelButton: $('#delCancel'), - initContent: function() { - $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); - $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); - $('#delCancel').focus(); - } - }); - $('#eventWindow').jqxWindow('hide'); -} - - function hopFlavourContribution(bt, vol, use, amount) { var result; @@ -124,17 +103,6 @@ w100 = 90; w80 = 60; } - $('#batch_size').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); - $('#boil_size').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); - $('#boil_time').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); - $('#efficiency').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); - $('#est_og').jqxNumberInput({ spinButtons: rw, readOnly: ro, width: w100 }); - // id="st_fg_min" margin-left 15/35 maken - $('#type').jqxDropDownList({ disabled: ro }); - $('#styleSelect').jqxDropDownList({ disabled: ro }); - $('#color_method').jqxDropDownList({ disabled: ro }); - $('#ibu_method').jqxDropDownList({ disabled: ro }); - $('#Delete').jqxButton({ disabled: ro }); $('#fermentableGrid').jqxGrid({ editable: rw }); $('#faddrowbutton').jqxDropDownList({ disabled: ro }); $('#finstockbutton').jqxCheckBox({ disabled: ro }); @@ -831,7 +799,7 @@ $('#st_category').val(dataRecord.st_category); $('#st_category_number').val(dataRecord.st_category_number); $('#st_type').val(StyleTypeData[dataRecord.st_type].nl); - $('#type').val(dataRecord.type); + $('#type').val(RecipeTypeData[dataRecord.type].nl); $('#batch_size').val(dataRecord.batch_size); $('#boil_size').val(dataRecord.boil_size); $('#boil_time').val(dataRecord.boil_time); @@ -856,12 +824,12 @@ $('#st_abv_max').val(dataRecord.st_abv_max); $('#st_color_min').val(dataRecord.st_color_min); $('#st_color_max').val(dataRecord.st_color_max); - $('#color_method').val(dataRecord.color_method); + $('#color_method').val(ColorMethodData[dataRecord.color_method].nl); $('#est_ibu').val(dataRecord.est_ibu); $('#est_ibu2').val(dataRecord.est_ibu); $('#st_ibu_min').val(dataRecord.st_ibu_min); $('#st_ibu_max').val(dataRecord.st_ibu_max); - $('#ibu_method').val(dataRecord.ibu_method); + $('#ibu_method').val(IBUmethodData[dataRecord.ibu_method].nl); $('#est_carb').val(dataRecord.est_carb); $('#st_carb_min').val(dataRecord.st_carb_min); $('#st_carb_max').val(dataRecord.st_carb_max); @@ -2499,60 +2467,6 @@ calcWater(); }); - $('#color_method').on('select', function(event) { - dataRecord.color_method = event.args.index; - calcFermentables(); - }); - $('#ibu_method').on('select', function(event) { - dataRecord.ibu_method = event.args.index; - calcFermentables(); - calcIBUs(); - }); - $('#batch_size').on('change', function(event) { - console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size); - var evap = (0.1 * parseFloat(event.args.value)) * dataRecord.boil_time / 60; - dataRecord.boil_size = parseFloat(event.args.value) + evap; - var factor = parseFloat(event.args.value) / dataRecord.batch_size; - $('#boil_size').val(Round(dataRecord.boil_size, 2)); - dataRecord.sparge_volume *= factor; - $('#sparge_volume').val(dataRecord.sparge_volume); - dataRecord.batch_size = parseFloat(event.args.value); - calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG - adjustWaters(factor); - calcFermentables(); - adjustHops(factor); - adjustMiscs(factor); - adjustYeasts(factor); - calcIBUs(); - calcWater(); - calcSparge(); - calcMash(); - }); - $('#boil_time').on('change', function(event) { - console.log('boil_time change:' + parseFloat(event.args.value) + ' old:' + dataRecord.boil_time); - var new_evap = (0.1 * parseFloat(dataRecord.batch_size)) * parseFloat(event.args.value) / 60; - dataRecord.boil_size = parseFloat(dataRecord.batch_size) + new_evap; - dataRecord.boil_time = parseFloat(event.args.value); - $('#boil_size').val(Round(dataRecord.boil_size, 2)); - calcFermentables(); - calcIBUs(); - }); - $('#efficiency').on('change', function(event) { - var estog = parseFloat($('#est_og').jqxNumberInput('decimal')); - dataRecord.efficiency = parseFloat(event.args.value); - console.log('efficiency change:' + dataRecord.efficiency); - calcFermentablesFromOG(estog); // Keep the OG - calcFermentables(); - calcIBUs(); - }); - $('#est_og').on('change', function(event) { - dataRecord.est_og = parseFloat(event.args.value); - console.log('est_og change:' + dataRecord.est_og); - calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts - calcFermentables(); // Update the recipe details - calcIBUs(); - calcMash(); - }); $('#mash_ph').on('change', function(event) { dataRecord.mash_ph = parseFloat(event.args.value); calcWater(); @@ -2591,50 +2505,10 @@ }); $('#locked').on('unchecked', function(event) { dataRecord.locked = 0; - setReadonly(false); + setReadonly(true); }); }; - $('#styleSelect').jqxDropDownList({ - placeHolder: 'Kies bierstijl:', - theme: theme, - source: styleslist, - displayMember: 'name', - width: 180, - height: 23, - dropDownVerticalAlignment: 'top', - dropDownWidth: 500, - dropDownHeight: 350, - renderer: function(index, label, value) { - var datarecord = styleslist.records[index]; - return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name; - } - }); - $('#styleSelect').on('select', function(event) { - if (event.args) { - var datarecord, index = event.args.index; - datarecord = styleslist.records[index]; - $('#st_name').val(datarecord.name); - $('#st_category').val(datarecord.category); - $('#st_category_number').val(datarecord.category_number); - $('#st_letter').val(datarecord.style_letter); - $('#st_guide').val(datarecord.style_guide); - $('#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); - $('#st_fg_max').val(datarecord.fg_max); - $('#st_ibu_min').val(datarecord.ibu_min); - $('#st_ibu_max').val(datarecord.ibu_max); - $('#st_color_min').val(datarecord.color_min); - $('#st_color_max').val(datarecord.color_max); - $('#st_carb_min').val(datarecord.carb_min); - $('#st_carb_max').val(datarecord.carb_max); - $('#st_abv_min').val(datarecord.abv_min); - $('#st_abv_max').val(datarecord.abv_max); - } - }); - function saveRecord(goback) { var row = { record: my_record, @@ -2742,10 +2616,10 @@ } else { console.log('saveRecord(' + goback + ') success'); } - if (goback) +// if (goback) window.location.href = my_return; - else - window.location.href = 'rec_export.php?record=' + my_record + '&return=' + my_return + '&name=' + dataRecord.name; +// else +// window.location.href = 'rec_export.php?record=' + my_record + '&return=' + my_return + '&name=' + dataRecord.name; }, error: function(jqXHR, textStatus, errorThrown) { console.log('saveRecord() ' + textStatus); @@ -2763,24 +2637,16 @@ $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); $('#notes').jqxInput({ theme: theme, width: 960, height: 200 }); $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' }); - $('#type').jqxDropDownList({ - theme: theme, - source: RecipeTypeAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true - }); + $('#type').jqxInput({ theme: theme, width: 180, height: 23 }); $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' }); - $('#efficiency').jqxNumberInput(Perc1dec); + $('#efficiency').jqxNumberInput(Show1dec); $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' }); - $('#batch_size').jqxNumberInput(Spin1dec); + $('#batch_size').jqxNumberInput(Show1dec); $('#batch_size').jqxNumberInput({ min: 4 }); $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' }); $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true }); $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' }); - $('#boil_time').jqxNumberInput(PosInt); + $('#boil_time').jqxNumberInput(Show0dec); $('#boil_time').jqxNumberInput({ min: 4, max: 360 }); $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); @@ -2797,7 +2663,7 @@ $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 }); $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); - $('#est_og').jqxNumberInput(SGopts); + $('#est_og').jqxNumberInput(Show3dec); $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); @@ -2823,31 +2689,15 @@ $('#st_color_min').jqxNumberInput(Smal0dec); $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); $('#st_color_max').jqxNumberInput(Smal0dec); - $('#color_method').jqxDropDownList({ - theme: theme, - source: ColorMethodAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true - }); + $('#color_method').jqxInput({ theme: theme, width: 180, height: 23 }); $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); $('#est_ibu').jqxNumberInput(Show0dec); $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); $('#st_ibu_min').jqxNumberInput(Smal0dec); $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); $('#st_ibu_max').jqxNumberInput(Smal0dec); - $('#ibu_method').jqxDropDownList({ - theme: theme, - source: IBUmethodAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true, - dropDownVerticalAlignment: 'top' - }); + + $('#ibu_method').jqxInput({ theme: theme, width: 180, height: 23 }); $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' }); $('#kcal').jqxNumberInput(Smal0dec); $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); @@ -4020,32 +3870,6 @@ }); // Buttons below - $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme }); - $('#Export').bind('click', function() { - saveRecord(0); - }); - - $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme }); - $('#Delete').bind('click', function() { - // Open a popup to confirm this action. - $('#eventWindow').jqxWindow('open'); - $('#delOk').click(function() { - var data = 'delete=true&' + $.param({ record: my_record }); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data, status, xhr) { - // delete command is executed. - window.location.href = my_return; - }, - error: function(jqXHR, textStatus, errorThrown) { - } - }); - }); - }); $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme }); $('#Cancel').bind('click', function() { @@ -4054,8 +3878,7 @@ $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme }); $('#Save').bind('click', function() { - saveRecord(1); + window.location.href = my_return; }); - createDelElements(); }); diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/js/rec_export.js --- a/www/js/rec_export.js Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2019 - * - * Michiel Broek - * - * This file is part of BMS - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * BrewCloud is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -$(document).ready(function() { - - var choice = 0; - $('#name').html(my_name); - $('#jqxRadioButton1').jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $('#jqxRadioButton2').jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $('#jqxRadioButton3').jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $('#jqxRadioButton4').jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $('#jqxRadioButton5').jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $('#jqxRadioButton1').on('checked', function(event) { - $('#Start').jqxButton({ disabled: false }); - choice = 1; - }); - $('#jqxRadioButton2').on('checked', function(event) { - $('#Start').jqxButton({ disabled: false }); - choice = 2; - }); - $('#jqxRadioButton3').on('checked', function(event) { - $('#Start').jqxButton({ disabled: false }); - choice = 3; - }); - $('#jqxRadioButton4').on('checked', function(event) { - $('#Start').jqxButton({ disabled: false }); - choice = 4; - }); - $('#jqxRadioButton5').on('checked', function(event) { - $('#Start').jqxButton({ disabled: false }); - choice = 5; - }); - - $('#Start').jqxButton({ template: 'success', width: '100px', theme: theme, disabled: true }); - $('#Start').click(function() { - if (choice == 1) { - window.open('rec_beerxml.php?record=' + my_record); - } else if (choice == 2) { - window.open('rec_duplicate.php?record=' + my_record); - } else if (choice == 3) { - window.open('rec_toproduct.php?record=' + my_record); - } else if (choice == 4) { - window.open('rec_print.php?record=' + my_record); - } else if (choice == 5) { - window.open('rec_forum.php?record=' + my_record); - } - // Return to the original recipe - window.location.href = 'rec_edit.php?record=' + my_record + '&return=' + my_return; - }); -}); diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/js/rec_forum.js --- a/www/js/rec_forum.js Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - -$(document).ready(function() { - - /** - * This will copy the innerHTML of an element to the clipboard - * @param element reference OR string - */ - function copyToClipboard(e) { - var tempItem = document.createElement('textarea'); - - document.body.appendChild(tempItem); - tempItem.value = e; - tempItem.select(); - document.execCommand('Copy'); - - tempItem.parentElement.removeChild(tempItem); - } - - - $('#copytoClipboard').jqxButton({ template: 'success', theme: theme, width: 150 }); - $('#copytoClipboard').click(function() { - copyToClipboard(forumstr); - window.close(); - }); - -}); - diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_beerxml.php --- a/www/rec_beerxml.php Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +0,0 @@ - 0) { - field($xw, 'EST_OG', sprintf("%.3f",floatval($row['est_og']))); -} - -if (floatval($row['est_fg']) > 0) { - field($xw, 'EST_FG', sprintf("%.3f",floatval($row['est_fg']))); -} - -if (floatval($row['est_abv']) > 0) { - field($xw, 'EST_ABV', sprintf("%.1f",floatval($row['est_abv']))); -} - -if (floatval($row['est_color']) > 0) { - field($xw, 'EST_COLOR', sprintf("%.6f", ebc_to_srm(floatval($row['est_color'])))); - field($xw, 'COLOR_METHOD', $colormethod[$row['color_method']]); -} - -if (floatval($row['est_ibu']) > 0) { - field($xw, 'EST_IBU', sprintf("%.1f",floatval($row['est_ibu']))); - field($xw, 'IBU_METHOD', $ibumethod[$row['ibu_method']]); -} - - -// Style -xmlwriter_start_element($xw, 'STYLE'); -field($xw, 'VERSION', '1'); -field($xw, 'NAME', $row['st_name']); -field($xw, 'CATEGORY', $row['st_category']); -field($xw, 'CATEGORY_NUMBER', $row['st_category_number']); -field($xw, 'STYLE_LETTER', $row['st_letter']); -field($xw, 'STYLE_GUIDE', $row['st_guide']); -field($xw, 'TYPE', $styletype[$row['st_type']]); -field($xw, 'OG_MIN', sprintf("%.3f",floatval($row['st_og_min']))); -field($xw, 'OG_MAX', sprintf("%.3f",floatval($row['st_og_max']))); -field($xw, 'FG_MIN', sprintf("%.3f",floatval($row['st_fg_min']))); -field($xw, 'FG_MAX', sprintf("%.3f",floatval($row['st_fg_max']))); -field($xw, 'IBU_MIN', sprintf("%.0f",floatval($row['st_ibu_min']))); -field($xw, 'IBU_MAX', sprintf("%.0f",floatval($row['st_ibu_max']))); -field($xw, 'COLOR_MIN', sprintf("%.2f",ebc_to_srm(floatval($row['st_color_min'])))); -field($xw, 'COLOR_MAX', sprintf("%.2f",ebc_to_srm(floatval($row['st_color_max'])))); -field($xw, 'CARB_MIN', sprintf("%.1f",floatval($row['st_carb_min']))); -field($xw, 'CARB_MAX', sprintf("%.1f",floatval($row['st_carb_max']))); -field($xw, 'ABV_MIN', sprintf("%.1f",floatval($row['st_abv_min']))); -field($xw, 'ABV_MAX', sprintf("%.1f",floatval($row['st_abv_max']))); -xmlwriter_end_element($xw); // STYLE - -xmlwriter_start_element($xw, 'EQUIPMENT'); -field($xw, 'VERSION', '1'); -field($xw, 'NAME', 'Dummy Brewery'); -field($xw, 'BATCH_SIZE', sprintf("%.2f",floatval($row['batch_size']))); -field($xw, 'BOIL_SIZE', sprintf("%.2f",floatval($row['boil_size']))); -field($xw, 'BOIL_TIME', sprintf("%.0f",floatval($row['boil_time']))); -xmlwriter_end_element($xw); // EQUIPMENT - -xmlwriter_start_element($xw, 'HOPS'); -$arr = json_decode($row['json_hops'], true); -foreach($arr as $item) { //foreach element in $arr - xmlwriter_start_element($xw, 'HOP'); - field($xw, 'VERSION', '1'); - field($xw, 'NAME', $item['h_name']); - field($xw, 'ALPHA', sprintf("%.1f",floatval($item['h_alpha']))); - field($xw, 'AMOUNT', sprintf("%.4f",floatval($item['h_amount']))); - field($xw, 'USE', $hopuse[$item['h_useat']]); - field($xw, 'TIME', $item['h_time']); - field($xw, 'TYPE', $hoptype[$item['h_type']]); - field($xw, 'FORM', $hopform[$item['h_form']]); - field($xw, 'BETA', sprintf("%.1f",floatval($item['h_beta']))); - field($xw, 'HSI', sprintf("%.1f",floatval($item['h_hsi']))); - field($xw, 'ORIGIN', $item['h_origin']); - xmlwriter_end_element($xw); // HOP -} -xmlwriter_end_element($xw); // HOPS - -xmlwriter_start_element($xw, 'FERMENTABLES'); -$arr = json_decode($row['json_fermentables'], true); -foreach($arr as $item) { //foreach element in $arr - if ($item['f_added'] <= 3) { - xmlwriter_start_element($xw, 'FERMENTABLE'); - field($xw, 'VERSION', '1'); - field($xw, 'NAME', $item['f_name']); - field($xw, 'TYPE', $fermentabletype[$item['f_type']]); - field($xw, 'AMOUNT', sprintf("%.4f",floatval($item['f_amount']))); - field($xw, 'YIELD', sprintf("%.1f",floatval($item['f_yield']))); - field($xw, 'COLOR', sprintf("%.1f",ebc_to_srm(floatval($item['f_color'])))); - field($xw, 'ADD_AFTER_BOIL', ($item['f_added'] > 1) ? 'TRUE':'FALSE'); - field($xw, 'ORIGIN', $item['f_origin']); - field($xw, 'SUPPLIER', $item['f_supplier']); - if (floatval($item['f_coarse_fine_diff'])) - field($xw, 'COARSE_FINE_DIFF', sprintf("%.4f",floatval($item['f_coarse_fine_diff']))); - if (floatval($item['f_moisture'])) - field($xw, 'MOISTURE', sprintf("%.4f",floatval($item['f_moisture']))); - if (floatval($item['f_diastatic_power'])) - field($xw, 'DIASTATIC_POWER', sprintf("%.4f",floatval($item['f_diastatic_power']))); - if (floatval($item['f_protein'])) - field($xw, 'PROTEIN', sprintf("%.4f",floatval($item['f_protein']))); - if (floatval($item['f_max_in_batch'])) - field($xw, 'MAX_IN_BATCH', sprintf("%.1f",floatval($item['f_max_in_batch']))); - field($xw, 'RECOMMEND_MASH', ($item['f_recommend_mash']) ? 'TRUE':'FALSE'); - field($xw, 'GRAINTYPE', $graintype[$item['f_graintype']]); - xmlwriter_end_element($xw); // FERMENTABLE - } -} -xmlwriter_end_element($xw); // FERMENTABLES - -xmlwriter_start_element($xw, 'MISCS'); -$arr = json_decode($row['json_miscs'], true); -foreach($arr as $item) { - xmlwriter_start_element($xw, 'MISC'); - field($xw, 'VERSION', '1'); - field($xw, 'NAME', $item['m_name']); - field($xw, 'TYPE', $misctype[$item['m_type']]); - field($xw, 'AMOUNT', sprintf("%.5f",floatval($item['m_amount']))); - field($xw, 'AMOUNT_IS_WEIGHT', ($item['m_amount_is_weight']) ? 'TRUE':'FALSE'); - field($xw, 'USE', $miscuse[$item['m_use_use']]); - field($xw, 'TIME', sprintf("%.0f",floatval($item['m_time']))); - xmlwriter_end_element($xw); // MISC -} -xmlwriter_end_element($xw); // MISCS - -xmlwriter_start_element($xw, 'YEASTS'); -$arr = json_decode($row['json_yeasts'], true); -foreach($arr as $item) { //foreach element in $arr - xmlwriter_start_element($xw, 'YEAST'); - field($xw, 'VERSION', '1'); - field($xw, 'NAME', $item['y_name']); - field($xw, 'TYPE', $yeasttype[$item['y_type']]); - field($xw, 'FORM', $yeastform[$item['y_form']]); - field($xw, 'AMOUNT', sprintf("%.5f",floatval($item['y_amount']))); - field($xw, 'AMOUNT_IS_WEIGHT', ($item['y_form'] == 1) ? 'TRUE':'FALSE'); - field($xw, 'LABORATORY', $item['y_laboratory']); - field($xw, 'PRODUCT_ID', $item['y_product_id']); - field($xw, 'MIN_TEMPERATURE', sprintf("%.1f",floatval($item['y_min_temperature']))); - field($xw, 'MAX_TEMPERATURE', sprintf("%.1f",floatval($item['y_max_temperature']))); - field($xw, 'ATTENUATION', sprintf("%.1f",floatval($item['y_attenuation']))); - field($xw, 'ADD_TO_SECONDARY', ($item['y_use'] == 0) ? 'FALSE':'TRUE'); - xmlwriter_end_element($xw); // YEAST -} -xmlwriter_end_element($xw); // YEASTS - -xmlwriter_start_element($xw, 'WATERS'); -xmlwriter_start_element($xw, 'WATER'); // Source 1 -field($xw, 'VERSION', '1'); -field($xw, 'NAME', $row['w1_name']); -field($xw, 'AMOUNT', sprintf("%.2f",floatval($row['w1_amount']))); -field($xw, 'CALCIUM', sprintf("%.2f",floatval($row['w1_calcium']))); -field($xw, 'MAGNESIUM', sprintf("%.2f",floatval($row['w1_magnesium']))); -field($xw, 'BICARBONATE', sprintf("%.2f",floatval($row['w1_total_alkalinity']) * 1.22)); -field($xw, 'SULFATE', sprintf("%.2f",floatval($row['w1_sulfate']))); -field($xw, 'CHLORIDE', sprintf("%.2f",floatval($row['w1_chloride']))); -field($xw, 'SODIUM', sprintf("%.2f",floatval($row['w1_sodium']))); -field($xw, 'PH', sprintf("%.1f",floatval($row['w1_ph']))); -field($xw, 'TOTAL_ALKALINITY', sprintf("%.2f",floatval($row['w1_total_alkalinity']))); -xmlwriter_end_element($xw); // WATER -if (strlen($row['w2_name'])) { - xmlwriter_start_element($xw, 'WATER'); // Source 2 - field($xw, 'VERSION', '1'); - field($xw, 'NAME', $row['w2_name']); - field($xw, 'AMOUNT', sprintf("%.2f",floatval($row['w2_amount']))); - field($xw, 'CALCIUM', sprintf("%.2f",floatval($row['w2_calcium']))); - field($xw, 'MAGNESIUM', sprintf("%.2f",floatval($row['w2_magnesium']))); - field($xw, 'BICARBONATE', sprintf("%.2f",floatval($row['w2_total_alkalinity']) * 1.22)); - field($xw, 'SULFATE', sprintf("%.2f",floatval($row['w2_sulfate']))); - field($xw, 'CHLORIDE', sprintf("%.2f",floatval($row['w2_chloride']))); - field($xw, 'SODIUM', sprintf("%.2f",floatval($row['w2_sodium']))); - field($xw, 'PH', sprintf("%.1f",floatval($row['w2_ph']))); - field($xw, 'TOTAL_ALKALINITY', sprintf("%.2f",floatval($row['w2_total_alkalinity']))); - xmlwriter_end_element($xw); // WATER -} -xmlwriter_end_element($xw); // WATERS - -xmlwriter_start_element($xw, 'MASH'); -field($xw, 'VERSION', '1'); -field($xw, 'NAME', $row['mash_name']); -field($xw, 'GRAIN_TEMP', '10.0'); -field($xw, 'PH', sprintf("%.1f",floatval($row['sparge_ph']))); -field($xw, 'SPARGE_TEMP', sprintf("%.1f",floatval($row['sparge_temp']))); -xmlwriter_start_element($xw, 'MASH_STEPS'); -$arr = json_decode($row['json_mashs'], true); -foreach($arr as $item) { //foreach element in $arr - xmlwriter_start_element($xw, 'MASH_STEP'); - field($xw, 'VERSION', '1'); - field($xw, 'NAME', $item['step_name']); - field($xw, 'TYPE', $mashsteptype[$item['step_type']]); - if ($item['step_type'] == 0) { - field($xw, 'INFUSE_AMOUNT', sprintf("%.3f",floatval($item['step_infuse_amount']))); - field($xw, 'INFUSE_TEMP', sprintf("%.3f",floatval($item['step_infuse_temp']))); - } - if ($item['step_type'] == 2) { - field($xw, 'DECOCTION_AMT', sprintf("%.3f",floatval($item['step_infuse_amount']))); - } - field($xw, 'STEP_TEMP', sprintf("%.1f",floatval($item['step_temp']))); - field($xw, 'STEP_TIME', sprintf("%.1f",floatval($item['step_time']))); - field($xw, 'RAMP_TIME', sprintf("%.1f",floatval($item['ramp_time']))); - field($xw, 'END_TEMP', sprintf("%.1f",floatval($item['end_temp']))); - field($xw, 'PH', sprintf("%.1f",floatval($row['mash_ph']))); - xmlwriter_end_element($xw); // MASH_STEP -} -xmlwriter_end_element($xw); // MASH_STEPS -xmlwriter_end_element($xw); // MASH -xmlwriter_end_element($xw); // RECIPE -xmlwriter_end_element($xw); // RECIPES -xmlwriter_end_document($xw); - -$beerxml = xmlwriter_output_memory($xw); - -Header('Content-type: text/xml'); -header('Content-Disposition: attachment; filename="' . $row['name'] . '.xml"'); -header('Content-Transfer-Encoding: binary'); -header('Expires: 0'); -header('Pragma: no-cache'); -header('Content-Length: '.strlen($beerxml)); -exit($beerxml); diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_duplicate.php --- a/www/rec_duplicate.php Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -window.close();"; -exit; diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_edit.php --- a/www/rec_edit.php Tue Aug 02 20:35:00 2022 +0200 +++ b/www/rec_edit.php Wed Aug 03 15:16:07 2022 +0200 @@ -31,7 +31,7 @@ Brouw type: -
+ Brouwzaal rendement:
@@ -49,8 +49,7 @@ Bierstijl gegevens - -
Stylenlijst
+ Stijlgids: @@ -78,24 +77,22 @@ Kleur EBC: -
+
Kleur methode: -
+ Koolzuur vol:
Bitterheid IBU: -
+
Bitterheid methode: -
+ Energie-inhoud kcal/l:
- -
diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_export.php --- a/www/rec_export.php Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Export recept
 
Naam:
Maak beerxml bestand:
Dupliceer als nieuw recept:
Copieer als brouw product:
Print dit recept:
Export voor forum:
 
-
-
- - diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_forum.php --- a/www/rec_forum.php Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ - $sv)) { - $sv = floatval($row[$pv]); - } - } - $memo .= "Maak een giststarter van ".sprintf("%.1f", $sv)." liter.".PHP_EOL; -} -$memo .= PHP_EOL; - -if ($row['w1_name']) - $mashwater += floatval($row['w1_amount']); -if ($row['w2_name']) - $mashwater += floatval($row['w2_amount']); - -$memo .= '[u][b]Maischschema[/b][/u]'.PHP_EOL; -$memo .= $tabus.PHP_EOL; -$memo .= $heads.'Maisch stap'.$heade.$heads.'Stap type'.$heade.$heads.'Temperatuur'.$heade.$heads.'Rust tijd'.$heade.$heads.'Opwarmen tijd'.$heade.PHP_EOL; - -$arr = json_decode($row['json_mashs'], true); -foreach($arr as $item) { - - if ($item['step_type'] == 1) { - $stype = $mashtype[$item['step_type']]; - } else { - $stype = $mashtype[$item['step_type']].' '.sprintf("%.1f", $item['step_infuse_amount']).' liter'; - } - $memo .= $rows.$datas.$item['step_name'].$datae.$datas.$stype.$datae.$datas.sprintf("%.1f °C", $item['step_temp']); - $memo .= $datae.$datas.sprintf("%.0f min.", $item['step_time']).$datae.$datas.sprintf("%.0f min.", $item['ramp_time']); - $memo .= $datae.$rowe.PHP_EOL; -} -$memo .= $tabue.PHP_EOL; -$memo .= PHP_EOL; - -$memo .= '[u][b]Brouwwater[/b][/u]'.PHP_EOL; -$memo .= $tabus.PHP_EOL; -$memo .= $heads.'Omschrijving'.$heade.$heads.'Waarde'.$heade.PHP_EOL; - -if ($row['w1_name'] && $row['w2_name'] && floatval($row['w2_amount']) > 0) { - $memo .= $rows.$datas.'Maischwater 1'.$datae.$datas.sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name'].$datae.$rowe.PHP_EOL; - $memo .= $rows.$datas.'Maischwater 2'.$datae.$datas.sprintf("%.1f",floatval($row['w2_amount'])).' liter water '.$row['w2_name'].$datae.$rowe.PHP_EOL; -} else { - $memo .= $rows.$datas.'Maischwater'.$datae.$datas.sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name'].$datae.$rowe.PHP_EOL; -} -$memo .= $rows.$datas.'Maischwater aanzuren tot pH'.$datae.$datas.$row['mash_ph'].' pH'.$datae.$rowe.PHP_EOL; -$spoelw = ($row['boil_size'] - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03; // A small heat correction -$memo .= $rows.$datas.'Spoelwater geschat'.$datae.$datas.sprintf("%.1f",$spoelw)." liter".$datae.$rowe.PHP_EOL; -$memo .= $rows.$datas.'Spoelwater temperatuur'.$datae.$datas.$row['sparge_temp'].' °C'.$datae.$rowe.PHP_EOL; -$memo .= $rows.$datas.'Spoelwater aanzuren tot pH'.$datae.$datas.sprintf("%.1f",$row['sparge_ph']).' pH'.$datae.$rowe.PHP_EOL; -$memo .= $tabue.PHP_EOL; -$memo .= PHP_EOL; - -$memo .= '[u][b]Waterprofiel behandeld water[/b][/u]'.PHP_EOL; -$memo .= $tabus.PHP_EOL; -$memo .= $heads.'Ca'.$heade.$heads.'Mg'.$heade.$heads.'Na'.$heade.$heads.'HCO3'.$heade.$heads.'Cl'.$heade.$heads.'SO4'.$heade.PHP_EOL; -$memo .= $rows.$datas.sprintf("%.1f",floatval($row['wb_calcium'])).$datae; -$memo .= $datas.sprintf("%.1f",floatval($row['wb_magnesium'])).$datae; -$memo .= $datas.sprintf("%.1f",floatval($row['wb_sodium'])).$datae; -$memo .= $datas.sprintf("%.1f",floatval($row['wb_total_alkalinity'])*61/50).$datae; -$memo .= $datas.sprintf("%.1f",floatval($row['wb_chloride'])).$datae; -$memo .= $datas.sprintf("%.1f",floatval($row['wb_sulfate'])).$datae.$rowe.PHP_EOL; -$memo .= $tabue.PHP_EOL; - -page_header('Recept naar forum', 'rec_forum'); -?> - -
-
-

-

Het recept met alle gegevens staan gereed.

-

Zodra je de "Klembord" toets gebruikt zullen deze gegevens naar het klembord gekopieerd
- worden. In het scherm van het forum kun je deze gegevens vervolgens "plakken".

-

Na het drukken van de toets wordt dit scherm gesloten.

-

-
-
-
- - diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_print.php --- a/www/rec_print.php Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,659 +0,0 @@ -ProcessingTable) - $this->TableHeader(); - } - - function TableHeader() { - $this->SetFont('Helvetica','B',9); - $this->SetX($this->TableX); - $this->SetFillColor(255,150,100); - foreach($this->aCols as $col) - $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); - $this->Ln(); - } - - function AddCol($width=-1, $caption='', $align='L') { - $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); - } - - function TableGlobal($row) { - /* 2 Columns */ - global $recipetype; - $vul = $this->w - $this->rMargin - $this->lMargin - 120; - $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, 'Recept overzicht',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Type',0,0,'L',true); - $this->Cell(25,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(25,5,$row['batch_size'].' liter',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Kooktijd',0,0,'L',true); - $this->Cell(25,5,$row['boil_time'].' minuten',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Brouwzaal rendement',0,0,'L',true); - $this->Cell(25,5,$row['efficiency'].' %',0,0,'L',true); - $this->Ln(); - - $this->cMargin=$cMargin; - } - - function TableFermentables($row) { - global $cost_fermentables; - global $total_fermentables; - global $pSugar; - global $pCara; - global $colorw; - global $preboil_sg; - global $added; - global $fermentabletype; - global $graintype; - $vul = $this->w - $this->rMargin - $this->lMargin - 125; - $this->Ln(); - $this->AddCol($vul,'Mout, granen en suikers','L'); - $this->AddCol(15,'Procent','R'); - $this->AddCol(15,'Opbr.','R'); - $this->AddCol(25,'Soort', 'L'); - $this->AddCol(30,'Gebruik moment','L'); - $this->AddCol(20,'Hoeveel','R'); - $this->AddCol(20,'Prijs','R'); - - $cMargin=$this->cMargin; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $sugarsf = 0; - $sugarsm = 0; - $this->SetFont('Helvetica','',9); - $this->SetFillColor(250, 195, 65); - $arr = json_decode($row['json_fermentables'], true); - 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']); - $amount = floatval($item['f_amount']); - $costkg = floatval($item['f_cost']); - $yield = floatval($item['f_yield']); - $moisture = floatval($item['f_moisture']); - $color = floatval($item['f_color']); - $percent = floatval($item['f_percentage']); - - if ($item['f_type'] == 1) // Sugar - $pSugar += $percent; - if ($item['f_graintype'] == 2) // Crystal - $pCara += $percent; - - if ($item['f_type'] == 0) - $soort = iconv('UTF-8','windows-1252',$graintype[$item['f_graintype']]); - else - $soort = iconv('UTF-8','windows-1252',$fermentabletype[$item['f_type']]); - - $cost = $amount * $costkg; - $cost_fermentables += $cost; - $total_fermentables += $amount; - /* Calculate the amount of sugars */ - $d = $amount * ($yield / 100) * (1 - $moisture / 100); - if ($item['f_added'] == 0) { // Mash - $d = floatval($row['efficiency']) / 100 * $d; - $sugarsm += $d; - } - $sugarsf += $d; - $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; - - if ($amount > 100) - $amount = sprintf("%.1f",$amount).' kg'; - else if ($amount > 10) - $amount = sprintf("%.2f",$amount).' kg'; - else - $amount = sprintf("%.0f",$amount * 1000).' gr'; - $this->Cell($vul,5,$name.' ('.$supplier.') '.sprintf("%.0f",$color).' EBC',0,0,'L',true); - $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); - $this->Cell(25,5,$soort,0,0,'L',true); - $this->Cell(30,5,$added[$item['f_added']],0,0,'L',true); - $this->Cell(20,5,$amount,0,0,'R',true); - $this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true); - $this->Ln(); - } - - $row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size'])); - $preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size'])); - $this->SetFillColor(210,245,255); - $this->Cell($vul+105,5,'',0,0,'L',false); - $this->Cell(20,5,sprintf("%.3f",$cost_fermentables).EURO,0,0,'R',true); - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableHops($row) { - global $total_hops; - global $total_ibus; - global $cost_hops; - global $preboil_sg; - global $hopform; - global $hopuse; - $vul = $this->w - $this->rMargin - $this->lMargin - 122; - $this->Ln(); - $this->AddCol($vul,'Hop','L'); - $this->AddCol(15,'Alpha','R'); - $this->AddCol(12,'IBU','R'); - $this->AddCol(25,'Soort','L'); - $this->AddCol(30,'Gebruik moment','L'); - $this->AddCol(20,'Hoeveel','R'); - $this->AddCol(20,'Prijs','R'); - - $cMargin=$this->cMargin; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(100, 250, 65); - - $arr = json_decode($row['json_hops'], true); - 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']); - $amount = floatval($item['h_amount']); - $mass = $amount * 1000; - $costkg = floatval($item['h_cost']); - $time = floatval($item['h_time']); - $alpha = floatval($item['h_alpha']); - - $cost = ($amount * $costkg); - $cost_hops += $cost; - $total_hops += $amount; - - $moment = $hopuse[$item['h_useat']]; - if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) { // Boil or Whirlpool - $moment = $hopuse[$item['h_useat']].' '.$time." min"; - } else if ($item['h_useat'] == 5) { // Dryhop - $moment = $hopuse[$item['h_useat']].' '.sprintf("%.0f", $time / 1440).' dagen'; - } - $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, - $row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']); - $total_ibus += $ibu; - - if ($amount > 1) - $amount = sprintf("%.3f",$amount).' kg'; - else - $amount = sprintf("%.1f",$amount * 1000).' gr'; - - $this->Cell($vul,5,$name.' ('.$origin.')',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); - $this->Cell(25,5,$hopform[$item['h_form']],0,0,'L',true); - $this->Cell(30,5,$moment,0,0,'L',true); - $this->Cell(20,5,$amount,0,0,'R',true); - $this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true); - $this->Ln(); - } - - $this->SetFillColor(210,245,255); - $this->Cell($vul+102,5,'',0,0,'L',false); - $this->Cell(20,5,sprintf("%.3f",$cost_hops).EURO,0,0,'R',true); - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableYeasts($row) { - global $cost_yeasts; - global $svg; - global $yeastform; - global $yeastuse; - $vul = $this->w - $this->rMargin - $this->lMargin - 110; - $this->Ln(); - $this->AddCol($vul,'Gist','L'); - $this->AddCol(15,'Attn','R'); - $this->AddCol(25,'Soort','L'); - $this->AddCol(30,'Gebruik moment','L'); - $this->AddCol(20,'Hoeveel','R'); - $this->AddCol(20,'Prijs','R'); - - $cMargin=$this->cMargin; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(175, 175, 255); - - $arr = json_decode($row['json_yeasts'], true); - foreach($arr as $item) { //foreach element in $arr - $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']); - $attenuation = floatval($item['y_attenuation']); - $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 || $item['y_form'] == 6) // Dry - $amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr"; - else - $amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml"; - $this->Cell($vul,5,$laboratory.' '.$product_id.' ('.$name.')',0,0,'L',true); - $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); - $this->Cell(25,5,$yeastform[$item['y_form']],0,0,'L',true); - $this->Cell(30,5,$yeastuse[$item['y_use']],0,0,'L',true); - $this->Cell(20,5,$amount,0,0,'R',true); - $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); - $this->Ln(); - } - - $this->SetFillColor(210,245,255); - $this->Cell($vul+90,5,'',0,0,'L',false); - $this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true); - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableMiscs($row) { - global $cost_miscs; - global $misctype; - global $miscuse; - $vul = $this->w - $this->rMargin - $this->lMargin - 95; - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(); - $this->AddCol($vul,'Naam','L'); - $this->AddCol(25,'Soort','L'); - $this->AddCol(30,'Gebruik moment','L'); - $this->AddCol(20,'Hoeveel','R'); - $this->AddCol(20,'Prijs','R'); - - $cMargin=$this->cMargin; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(175, 175, 255); - - $arr = json_decode($row['json_miscs'], true); - foreach($arr as $item) { - $name = iconv('UTF-8','windows-1252',$item['m_name']); - $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']); - $aiw = $item['m_amount_is_weight']; - $cost = $amount * $costg; - $cost_miscs += $cost; - - if ($type == 4) // Water agent - $this->SetFillColor(240,140,130); - else if ($type == 3) // Fining - $this->SetFillColor(95,180,25); - 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 == 2) // Boil - $gebruik = sprintf("%s %d min",$miscuse[$use_use],$time); - else - $gebruik = $miscuse[$use_use]; - - $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); - $this->Cell($vul,5,$name,0,0,'L',true); - $this->Cell(25,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(); - } - - $this->SetFillColor(210,245,255); - $this->Cell($vul+75,5,'',0,0,'L',false); - $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true); - - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableMashs($row) { - global $cost_yeasts; - global $svg; - global $mashkg; - global $mashtype; - $vul = $this->w - $this->rMargin - $this->lMargin - 138; - if ($this->GetY() > 250) - $this->AddPage(); - else - $this->Ln(); - $this->AddCol($vul,'Maisch stap naam','L'); - $this->AddCol(25,'Stap type','L'); - $this->AddCol(16,'Start '.DEG.'C','R'); - $this->AddCol(16,'Eind '.DEG.'C','R'); - $this->AddCol(15,'Rust min','R'); - $this->AddCol(15,'Stap min','R'); - $this->AddCol(15,'L/Kg','R'); - $this->AddCol(18,'Inf/dec L','R'); - $this->AddCol(18,'Inf/dec '.DEG.'C','R'); - - $cMargin=$this->cMargin; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(175, 175, 255); - - $vol = 0; - $arr = json_decode($row['json_mashs'], true); - foreach($arr as $item) { //foreach element in $arr - - if ($item['step_type'] == 0) - $vol += $item['step_infuse_amount']; - if ($mashkg > 0) - $thick = $vol / $mashkg; - else - $thick = 0; - $this->Cell($vul,5,$item['step_name'],0,0,'L',true); - $this->Cell(25,5,$mashtype[$item['step_type']],0,0,'L',true); - $this->Cell(16,5,sprintf("%.1f",$item['step_temp']),0,0,'R',true); - $this->Cell(16,5,sprintf("%.1f",$item['end_temp']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.0f",$item['step_time']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.0f",$item['ramp_time']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.2f",$thick),0,0,'R',true); - if ($item['step_type'] == 1) { - $this->Cell(18,5,' ',0,0,'R',true); - $this->Cell(18,5,' ',0,0,'R',true); - } else { - $this->Cell(18,5,sprintf("%.1f",$item['step_infuse_amount']),0,0,'R',true); - $this->Cell(18,5,sprintf("%.1f",$item['step_infuse_temp']),0,0,'R',true); - } - $this->Ln(); - } - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableWaters($row) { - - $vul = $this->w - $this->rMargin - $this->lMargin - 137; - if ($this->GetY() > 250) - $this->AddPage(); - else - $this->Ln(); - $this->AddCol($vul,'Water bron','L'); - $this->AddCol(20,'Volume','R'); - $this->AddCol(15,'Ca','R'); - $this->AddCol(15,'Mg','R'); - $this->AddCol(15,'Na','R'); - $this->AddCol(15,'CaCO3','R'); - $this->AddCol(15,'Cl','R'); - $this->AddCol(15,'SO4','R'); - $this->AddCol(15,'pH','R'); - - $cMargin=$this->cMargin; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(120, 255, 250); - - $this->Cell($vul,5,$row['w1_name'],0,0,'L',true); - $this->Cell(20,5,sprintf("%.1f", $row['w1_amount']).' L',0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_calcium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_magnesium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_sodium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_total_alkalinity']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_chloride']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_sulfate']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w1_ph']),0,0,'R',true); - $this->Ln(); - $this->Cell($vul,5,$row['w2_name'],0,0,'L',true); - $this->Cell(20,5,sprintf("%.1f", $row['w2_amount']).' L',0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_calcium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_magnesium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_sodium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_total_alkalinity']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_chloride']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_sulfate']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['w2_ph']),0,0,'R',true); - $this->Ln(); - $this->Cell($vul,5,'Gemengd water',0,0,'L',true); - $this->Cell(20,5,sprintf("%.1f", $row['wg_amount']).' L',0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_calcium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_magnesium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_sodium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_total_alkalinity']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_chloride']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_sulfate']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wg_ph']),0,0,'R',true); - $this->Ln(); - $this->Cell($vul,5,'Behandeld water',0,0,'L',true); - $this->Cell(20,5,'',0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_calcium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_magnesium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_sodium']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_total_alkalinity']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_chloride']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_sulfate']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f", $row['wb_ph']),0,0,'R',true); - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableSummary($row) { - global $pSugar; - global $pCara; - global $svg; - global $colorw; - global $cost_fermentables; - global $cost_hops; - global $cost_miscs; - global $cost_yeasts; - global $colormethod; - global $ibumethod; - /* 2 Columns */ - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(); - $vul = $this->w - $this->rMargin - $this->lMargin - 170; - $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, 'Recept samenvatting',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $row['est_fg'] = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $row['est_og']); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Start SG',0,0,'L',true); - $this->Cell(25,5,sprintf("%.3f",$row['est_og']),0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.3f",$row['st_og_min']).' - '.sprintf("%.3f",$row['st_og_max']).')',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Eind SG',0,0,'L',true); - $this->Cell(25,5,sprintf("%.3f",$row['est_fg']),0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.3f",$row['st_fg_min']).' - '.sprintf("%.3f",$row['st_fg_max']).')',0,0,'L',true); - $this->Ln(); - - $row['est_abv'] = abvol($row['est_og'], $row['est_fg']); - $this->SetX($this->TableX); - $this->Cell(35,5,'Geschat alcohol',0,0,'L',true); - $this->Cell(25,5,sprintf("%.1f",$row['est_abv']).'%',0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.1f",$row['st_abv_min']).' - '.sprintf("%.1f",$row['st_abv_max']).'%)',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'CO2',0,0,'L',true); - $this->Cell(25,5,sprintf("%.1f",$row['est_carb']).'%',0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.1f",$row['st_carb_min']).' - '.sprintf("%.1f",$row['st_carb_max']).'%)',0,0,'L',true); - $this->Ln(); - - $row['est_color'] = kw_to_ebc($row['color_method'], $colorw); - $this->SetX($this->TableX); - $this->Cell(35,5,'Kleur ('.$colormethod[$row['color_method']].')',0,0,'L',true); - $beercolor = ebc_to_color($row['est_color']); - if ($row['est_color'] > 30) - $this->SetTextColor(250); - $this->SetFillColor($beercolor[0],$beercolor[1],$beercolor[2]); - $this->Cell(25,5,$row['est_color'].' EBC',0,0,'L',true); - $this->Cell(25,5,'('.$row['st_color_min'].' - '.$row['st_color_max'].' EBC)',0,0,'L',true); - $this->SetTextColor(0); - $this->SetFillColor(210,245,255); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Bitterheid ('.$ibumethod[$row['ibu_method']].')',0,0,'L',true); - $this->Cell(25,5,sprintf("%.0f",$row['est_ibu']).' IBU',0,0,'L',true); - $this->Cell(25,5,'('.$row['st_ibu_min'].' - '.$row['st_ibu_max'].' IBU)',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $cost_total = $cost_fermentables + $cost_hops + $cost_miscs + $cost_yeasts; - $this->Cell(35,5,'Kosten',0,0,'L',true); - $this->Cell(25,5,sprintf("%.2f",$cost_total).EURO,0,0,'L',true); - $this->Cell(25,5,sprintf("%.2f",$cost_total/$row['batch_size']).EURO.' / liter',0,0,'L',true); - - // calorieen - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } -} - - - -class PDF extends PDF_MySQL_Table { - function Header() { - global $row; - global $prdate; - $this->Image('images/logo.png',10,6,30); - // Title - $this->SetFont('Helvetica','B',18); - $this->SetX(45); - $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'); - $st_name = iconv('UTF-8','windows-1252',$row['st_name']); - $this->Cell(0,5,$st_name,0,1,'L'); - $this->Ln(7); - // Ensure table header is printed - parent::Header(); - } -} - - -/* - * Generate PDF from recipe data - */ -$pdf = new PDF(); -$pdf->AddPage(); -$pdf->TableGlobal($row); -$pdf->TableFermentables($row); -$pdf->TableHops($row); -$pdf->TableYeasts($row); -$pdf->TableMiscs($row); -$pdf->TableMashs($row); -$pdf->TableWaters($row); -$pdf->TableSummary($row); -if (strlen($row['notes'])) { - if ($pdf->GetY() > 200) - $pdf->AddPage(); - else - $pdf->Ln(10); - $pdf->SetFillColor(255,150,100); - $pdf->SetFont('Helvetica','B',9); - $pdf->Cell(0, 5, 'Recept opmerkingen',0,0,'C',true); - $pdf->Ln(); - $pdf->SetFont('Helvetica','',9); - $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. -$pdf->Output(); diff -r 45e87aa8d02c -r ac5c3e97fcf1 www/rec_toproduct.php --- a/www/rec_toproduct.php Tue Aug 02 20:35:00 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -window.close();"; -exit;