Phase 1, rebuild recipe editor to a vieuwer.

Wed, 03 Aug 2022 15:16:07 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 03 Aug 2022 15:16:07 +0200
changeset 804
ac5c3e97fcf1
parent 803
45e87aa8d02c
child 805
488613f30789

Phase 1, rebuild recipe editor to a vieuwer.

www/Makefile file | annotate | diff | comparison | revisions
www/js/rec_edit.js file | annotate | diff | comparison | revisions
www/js/rec_export.js file | annotate | diff | comparison | revisions
www/js/rec_forum.js file | annotate | diff | comparison | revisions
www/rec_beerxml.php file | annotate | diff | comparison | revisions
www/rec_duplicate.php file | annotate | diff | comparison | revisions
www/rec_edit.php file | annotate | diff | comparison | revisions
www/rec_export.php file | annotate | diff | comparison | revisions
www/rec_forum.php file | annotate | diff | comparison | revisions
www/rec_print.php file | annotate | diff | comparison | revisions
www/rec_toproduct.php file | annotate | diff | comparison | revisions
--- 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/* \
--- 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();
 });
 
--- 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 <mbroek at mbse dot eu>
- *
- * 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;
- });
-});
--- 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();
- });
-
-});
-
--- 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 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php');
-
-
-$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
-if (! $link) {
-	die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
-}
-if (! mysqli_set_charset($link, "utf8" )) {
-	echo "error";
-	return 1;
-}
-
-//setlocale ( LC_ALL, 'nl_NL.UTF-8');
-if (isset($_GET["record"]))
-	$record = $_GET["record"];
-else
-	$record = 148;
-$result = mysqli_query($link, "SELECT * FROM recipes WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-
-$recipetype = array( 'Extract', 'Partial Mash', 'All Grain' );
-$styletype = array( 'Lager', 'Ale', 'Mead', 'Wheat', 'Mixed', 'Cider' );
-$hoptype = array( 'Bittering', 'Aroma', 'Both' );
-$hopform = array( 'Pellet', 'Plug', 'Leaf', 'Leaf', 'Leaf' );
-$hopuse = array( 'Mash', 'First wort', 'Boil', 'Aroma', 'Whirlpool', 'Dry hop' );
-$fermentabletype = array( 'Grain', 'Sugar', 'Extract', 'Dry extract', 'Adjunct' );
-$graintype = array( 'Base', 'Roast', 'Crystal', 'Kilned', 'Sour malt', 'Special', 'No malt' );
-$yeasttype = array( 'Lager', 'Ale', 'Wheat', 'Wine', 'Champagne', 'Other', 'Other', 'Other', 'Other', 'Other' );
-$yeastform = array( 'Liquid', 'Dry', 'Slant', 'Culture', 'Frozen', 'Bottle', 'Dry' );
-$yeastuse = array( 'Primary', 'Secondary', 'Tertiary', 'Bottle' );
-$misctype = array( 'Spice', 'Herb', 'Flavor', 'Fining', 'Water agent', 'Yeast nutrient', 'Other' );
-$miscuse = array( 'Starter', 'Mash', 'Boil', 'Primary', 'Secondary', 'Bottling' );
-$mashsteptype = array( 'Infusion', 'Temperature', 'Decoction' );
-$colormethod = array( 'Morey', 'Mosher', 'Daniels', 'Halberstadt', 'Naudts' );
-$ibumethod = array( 'Tinseth', 'Rager', 'Daniels', 'Garetz', 'Mosher', 'Noonan' );
-
-
-function field($x, $field, $value) {
-	xmlwriter_start_element($x, $field);
-	xmlwriter_text($x, $value);
-	xmlwriter_end_element($x);
-}
-
-
-/*
- * Create beerxml output
- */
-$xw = xmlwriter_open_memory();
-xmlwriter_set_indent($xw, 1);
-$res = xmlwriter_set_indent_string($xw, ' ');
-
-xmlwriter_start_document($xw, '1.0', 'UTF-8');
-
-xmlwriter_start_element($xw, 'RECIPES');
-xmlwriter_start_element($xw, 'RECIPE');
-
-// Recipe basics
-field($xw, 'VERSION', '1');
-field($xw, 'NAME', $row['name']);
-field($xw, 'NOTES', $row['notes']);
-field($xw, 'TYPE', $recipetype[$row['type']]);
-field($xw, 'BREWER', 'Anonymous');
-field($xw, 'BATCH_SIZE', sprintf("%.4f",floatval($row['batch_size'])));
-field($xw, 'BOIL_SIZE', sprintf("%.4f",floatval($row['boil_size'])));
-field($xw, 'BOIL_TIME', sprintf("%.3f",floatval($row['boil_time'])));
-field($xw, 'EFFICIENCY', sprintf("%.4f",floatval($row['efficiency'])));
-
-if (floatval($row['est_og']) > 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);
--- 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 @@
-<?php
-require_once('config.php');
-
-$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
-if (! $link) {
-	die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
-}
-if (! mysqli_set_charset($link, "utf8" )) {
-	echo "error";
-	return 1;
-}
-
-$rescapers = array("'");
-$rreplacements = array("\\'");
-
-date_default_timezone_set('Europe/Amsterdam');
-if (isset($_GET["record"]))
-	$record = $_GET["record"];
-else
-	$record = 78;
-$result = mysqli_query($link, "SELECT * FROM recipes WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-/*
- * Make this duplicate a fresh recipe.
- */
-$sql  = "INSERT INTO `recipes` SET ";
-$sql .= "name='" . mysqli_real_escape_string($link, $row['name']) . ' [duplicate]';
-$sql .= "', uuid='" . str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
-$sql .= "', notes='" . mysqli_real_escape_string($link, $row['notes']);
-$sql .= "', locked='0";
-$sql .= "', st_name='" . mysqli_real_escape_string($link, $row['st_name']);
-$sql .= "', st_letter='" . mysqli_real_escape_string($link, $row['st_letter']);
-$sql .= "', st_guide='" . mysqli_real_escape_string($link, $row['st_guide']);
-$sql .= "', st_type='" . $row['st_type'];
-$sql .= "', st_category='" . mysqli_real_escape_string($link, $row['st_category']);
-$sql .= "', st_category_number='" . $row['st_category_number'];
-$sql .= "', st_og_min='" . $row['st_og_min'];
-$sql .= "', st_og_max='" . $row['st_og_max'];
-$sql .= "', st_fg_min='" . $row['st_fg_min'];
-$sql .= "', st_fg_max='" . $row['st_fg_max'];
-$sql .= "', st_ibu_min='" . $row['st_ibu_min'];
-$sql .= "', st_ibu_max='" . $row['st_ibu_max'];
-$sql .= "', st_color_min='" . $row['st_color_min'];
-$sql .= "', st_color_max='" . $row['st_color_max'];
-$sql .= "', st_carb_min='" . $row['st_carb_min'];
-$sql .= "', st_carb_max='" . $row['st_carb_max'];
-$sql .= "', st_abv_min='" . $row['st_abv_min'];
-$sql .= "', st_abv_max='" . $row['st_abv_max'];
-$sql .= "', type='" . $row['type'];
-$sql .= "', batch_size='" . $row['batch_size'];
-$sql .= "', boil_size='" . $row['boil_size'];
-$sql .= "', boil_time='" . $row['boil_time'];
-$sql .= "', efficiency='" . $row['efficiency'];
-$sql .= "', est_og='" . $row['est_og'];
-$sql .= "', est_fg='" . $row['est_fg'];
-$sql .= "', est_abv='" . $row['est_abv'];
-$sql .= "', est_carb='" . $row['est_carb'];
-$sql .= "', est_color='" . $row['est_color'];
-$sql .= "', color_method='" . $row['color_method'];
-$sql .= "', est_ibu='" . $row['est_ibu'];
-$sql .= "', ibu_method='" . $row['ibu_method'];
-$sql .= "', sparge_temp='" . $row['sparge_temp'];
-$sql .= "', sparge_ph='" . $row['sparge_ph'];
-$sql .= "', sparge_volume='" . $row['sparge_volume'];
-$sql .= "', sparge_source='" . $row['sparge_source'];
-$sql .= "', sparge_acid_type='" . $row['sparge_acid_type'];
-$sql .= "', sparge_acid_perc='" . $row['sparge_acid_perc'];
-$sql .= "', sparge_acid_amount='0";
-$sql .= "', mash_ph='" . $row['mash_ph'];
-$sql .= "', mash_name='" . $row['mash_name'];
-$sql .= "', calc_acid='" . $row['calc_acid'];
-$sql .= "', w1_name='" . mysqli_real_escape_string($link, $row['w1_name']);
-$sql .= "', w1_amount='" . $row['w1_amount'];
-$sql .= "', w1_calcium='" . $row['w1_calcium'];
-$sql .= "', w1_sulfate='" . $row['w1_sulfate'];
-$sql .= "', w1_chloride='" . $row['w1_chloride'];
-$sql .= "', w1_sodium='" . $row['w1_sodium'];
-$sql .= "', w1_magnesium='" . $row['w1_magnesium'];
-$sql .= "', w1_total_alkalinity='" . $row['w1_total_alkalinity'];
-$sql .= "', w1_ph='" . $row['w1_ph'];
-$sql .= "', w1_cost='" . $row['w1_cost'];
-$sql .= "', w2_name='" . mysqli_real_escape_string($link, $row['w2_name']);
-$sql .= "', w2_amount='" . $row['w2_amount'];
-$sql .= "', w2_calcium='" . $row['w2_calcium'];
-$sql .= "', w2_sulfate='" . $row['w2_sulfate'];
-$sql .= "', w2_chloride='" . $row['w2_chloride'];
-$sql .= "', w2_sodium='" . $row['w2_sodium'];
-$sql .= "', w2_magnesium='" . $row['w2_magnesium'];
-$sql .= "', w2_total_alkalinity='" . $row['w2_total_alkalinity'];
-$sql .= "', w2_ph='" . $row['w2_ph'];
-$sql .= "', w2_cost='" . $row['w2_cost'];
-$sql .= "', wa_acid_name='" . $row['wa_acid_name'];
-$sql .= "', wa_acid_perc='" . $row['wa_acid_perc'];
-$sql .= "', wa_base_name='" . $row['wa_base_name'];
-$sql .= "', json_fermentables='" . str_replace($rescapers,$rreplacements,$row['json_fermentables']);
-$sql .= "', json_hops='" . str_replace($rescapers,$rreplacements,$row['json_hops']);
-$sql .= "', json_miscs='" . str_replace($rescapers,$rreplacements,$row['json_miscs']);
-$sql .= "', json_yeasts='" . str_replace($rescapers,$rreplacements,$row['json_yeasts']);
-$sql .= "', json_mashs='" . str_replace($rescapers,$rreplacements,$row['json_mashs']);
-$sql .= "';";
-syslog(LOG_NOTICE, $sql);
-
-$result = mysqli_query($link, $sql);
-if (! $result) {
-	syslog(LOG_NOTICE, "rec_duplicate: result: ".mysqli_error($link));
-} else {
-	$lastid = mysqli_insert_id($link);
-	syslog(LOG_NOTICE, "rec_duplicate: inserted record ".$lastid);
-}
-echo "<script>window.close();</script>";
-exit;
--- 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 @@
 	</tr>
         <tr>
 	 <td style="vertical-align: top; float: right; padding: 3px;">Brouw type:</td>
-	 <td align="left" style="padding: 3px;"><div id="type"></div></td>
+	 <td align="left" style="vertical-align: top; padding: 3px;"><input readonly="1" id="type" /></td>
          <td style="vertical-align: top; float: right; padding: 3px;">Brouwzaal rendement:</td>
          <td colspan="3" style="padding: 3px;"><div id="efficiency"></div></td>
         </tr>
@@ -49,8 +49,7 @@
 	<tr>
          <td></td>
 	 <th>Bierstijl gegevens</th>
-         <td></td>
-         <td align="left" colspan="3"><div id="styleSelect">Stylenlijst</div></td>
+         <td align="left" colspan="4"></td>
         </tr>
         <tr>
          <td style="vertical-align: top; float: right; padding: 3px;">Stijlgids:</td>
@@ -78,24 +77,22 @@
 	</tr>
         <tr>
          <td style="vertical-align: top; float: right; padding: 3px;">Kleur EBC:</td>
-         <td style="padding: 3px;"><div style="float: left;" id="est_color"></div><div style="float: left; margin-left: 35px;" id="st_color_min"></div><div style="float: left; margin-left: 5px;" id="st_color_max"></div><div id="bcolor" class='ebccolor'> </div></td>
+         <td style="padding: 3px;"><div style="float: left;" id="est_color"></div><div style="float: left; margin-left: 15px;" id="st_color_min"></div><div style="float: left; margin-left: 5px;" id="st_color_max"></div><div id="bcolor" class='ebccolor'> </div></td>
          <td style="vertical-align: top; float: right; padding: 3px;">Kleur methode:</td>
-	 <td style="padding: 3px;"><div style="float: left;" id="color_method"></div></td>
+	 <td align="left" style="vertical-align: top; padding: 3px;"><input readonly="1" id="color_method" /></td>
          <td style="vertical-align: top; float: right; padding: 3px;">Koolzuur vol:</td>
          <td style="padding: 3px;"><div style="float: left;" id="est_carb"></div><div style="float: left; margin-left: 15px;" id="st_carb_min"></div><div style="float: left; margin-left: 5px;" id="st_carb_max"></div></td>
 	</tr>
         <tr>
          <td style="vertical-align: top; float: right; padding: 3px;">Bitterheid IBU:</td>
-         <td style="padding: 3px;"><div style="float: left;" id="est_ibu"></div><div style="float: left; margin-left: 35px;" id="st_ibu_min"></div><div style="float: left; margin-left: 5px;" id="st_ibu_max"></div></td>
+         <td style="padding: 3px;"><div style="float: left;" id="est_ibu"></div><div style="float: left; margin-left: 15px;" id="st_ibu_min"></div><div style="float: left; margin-left: 5px;" id="st_ibu_max"></div></td>
          <td style="vertical-align: top; float: right; padding: 3px;">Bitterheid methode:</td>
-         <td style="padding: 3px;"><div style="float: left;" id="ibu_method"></div></td>
+         <td align="left" style="vertical-align: top; padding: 3px;"><input readonly="1" id="ibu_method" /></td>
          <td style="vertical-align: top; float: right; padding: 3px;">Energie-inhoud kcal/l:</td>
          <td style="padding: 3px;"><div style="float: left;" id="kcal"></div></div></td>
         </tr>
        </table>
        <div style="float: right; margin-top: 30px; margin-bottom: 10px;">
-        <input style="margin-right: 100px;" type="button" id="Export" value="Export" />
-        <input style="margin-right: 100px;" type="button" id="Delete" value="Delete" />
         <input style="margin-right: 100px;" type="button" id="Save"   value="Save" />
         <input style="margin-right: 320px;" type="button" id="Cancel" value="Cancel" />
        </div>
--- 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 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Recept export', 'rec_export');
-?>
-
-   <div id="MainPanel">
-    <div id='export_table'>
-     <table style='width: 100%; padding: 10px;'>
-      <tr><th colspan=2>Export recept</th></tr>
-      <tr><td colspan="2">&nbsp;</td></tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Naam:</td>
-       <td align="left"><div style='margin-left: 10px;' id='name'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Maak beerxml bestand:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton1'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Dupliceer als nieuw recept:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton2'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Copieer als brouw product:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton3'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Print dit recept:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton4'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Export voor forum:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton5'></div></td>
-      </tr>
-      <tr><td colspan="2">&nbsp;</td></tr>
-      <tr>
-       <td align="right" style="vertical-align: top;"></td>
-       <td align="left"><input type="button" id="Start" value="Start" /></td>
-      </tr>
-     </table>
-    </div>
-   </div>
-
-<?php
-page_footer();
-?>
--- 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 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php');
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/constants.php');
-
-
-$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
-if (! $link) {
-	die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
-}
-if (! mysqli_set_charset($link, "utf8" )) {
-	echo "error";
-	return 1;
-}
-
-setlocale ( LC_ALL, 'nl_NL.UTF-8');
-$record = $_GET["record"];
-$result = mysqli_query($link, "SELECT * FROM recipes WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-$preboil_sg = 0;
-date_default_timezone_set('Europe/Amsterdam');
-$prdate = date(DATE_RFC2822);
-
-/*
- * Generate the output in a string.
- */
-$tabus = '[tabular]';
-$tabue = '[/tabular]';
-$heads = '[head]';
-$heade = '[/head]';
-$rows  = '[row]';
-$rowe  = '[/row]';
-$datas = '[data]';
-$datae = '[/data]';
-
-$memo  = "[u][b]BMS v".$my_version." - Datum export: ".$prdate.'[/b][/u]'.PHP_EOL;
-$memo .= PHP_EOL;
-$memo .= PHP_EOL;
-$memo .= '[u][b]Basis[/b][/u]'.PHP_EOL;
-$memo .= $tabus.PHP_EOL;
-$memo .= $heads.'Omschrijving'.$heade.$heads.'Waarde'.$heade.PHP_EOL;
-$memo .= $rows.$datas.'Bier naam'.$datae.$datas.$row['name'].$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Bier stijl'.$datae.$datas.$row['st_name'].$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Recept type'.$datae.$datas.$recipetype[$row['type']].$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Batch grootte'.$datae.$datas.$row['batch_size'].' liter'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Kooktijd'.$datae.$datas.$row['boil_time'].' minuten'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Brouwzaal rendement'.$datae.$datas.$row['efficiency'].' %'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Geschatte begin densiteit'.$datae.$datas.sprintf("%.3f",$row['est_og']).' SG/ '.sprintf("%.1f", sg_to_plato($row['est_og'])).'°P'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Geschatte eind densiteit'.$datae.$datas.sprintf("%.3f",$row['est_fg']).' SG/ '.sprintf("%.1f", sg_to_plato($row['est_fg'])).'°P'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Geschat alcohol'.$datae.$datas.sprintf("%.1f",$row['est_abv']).'% vol'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Kleur ('.$colormethod[$row['color_method']].')'.$datae.$datas.$row['est_color'].' EBC'.$datae.$rowe.PHP_EOL;
-$memo .= $rows.$datas.'Bitterheid ('.$ibumethod[$row['ibu_method']].')'.$datae.$datas.$row['est_ibu'].' IBU'.$datae.$rowe.PHP_EOL;
-if ($row['divide_parts'])
-    $memo .= $rows.$datas.'Split batch (' .$splitat[$row['divide_type']].')'.$datae.$datas.($row['divide_part'] + 1)." van ".($row['divide_parts'] + 1).$datae.$rowe.PHP_EOL;
-$memo .= $tabue.PHP_EOL;
-$memo .= PHP_EOL;
-
-$sugarsm = 0;
-$grainabsorbtion = 0;
-$mashwater = 0;
-
-$memo .= '[u][b]Vergistbare ingrediënten[/b][/u]'.PHP_EOL;
-$memo .= $tabus.PHP_EOL;
-$memo .= $heads.'Mout, granen en suikers'.$heade.$heads.'EBC'. $heade.$heads.'Gewicht kg'.$heade.$heads.'%'.$heade.$heads.'Gebruik tijdens'.$heade.PHP_EOL;
-
-$arr = json_decode($row['json_fermentables'], true);
-foreach($arr as $item) {
-	$name = $item['f_name']." (".$item['f_supplier'].")";
-	$amount   = floatval($item['f_amount']);
-	$d = $amount * (floatval($item['f_yield']) / 100) * (1 - floatval($item['f_moisture']) / 100);
-        if ($item['f_added']  == 0) {
-        	$d = floatval($row['efficiency']) / 100 * $d;
-                $sugarsm += $d;
-		$grainabsorbtion += $item['f_amount'];
-        }
-	$pct = '';
-        if ($item['f_added']  < 4)
-                $pct = sprintf("%.1f", floatval($item['f_percentage']));
-
-	$memo .= $rows.$datas.$name.$datae.$datas.sprintf("%.0f", floatval($item['f_color'])).$datae.$datas;
-        $memo .= sprintf("%.3f", $amount).$datae.$datas.$pct.$datae.$datas;
-        $memo .= $added[$item['f_added']].$datae.$rowe .PHP_EOL;
-}
-$preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size']));
-$memo .= $tabue.PHP_EOL;
-$memo .= PHP_EOL;
-
-$memo .= '[u][b]Hop[/b][/u]'.PHP_EOL;
-$memo .= $tabus.PHP_EOL;
-$memo .= $heads.'Hop'.$heade.$heads.'Vorm'.$heade.$heads.'Alpha'.$heade.$heads.'IBU'.$heade.$heads.'Gram'.$heade.$heads.'Toevoegen moment'.$heade.PHP_EOL;
-
-$arr = json_decode($row['json_hops'], true);
-foreach($arr as $item) {
-	$name   = $item['h_name']." (".$item['h_origin'].")";
-	$amount = floatval($item['h_amount']) * 1000;
-	$time   = floatval($item['h_time']);
-        $alpha  = floatval($item['h_alpha']);
-	$ibu    = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha,
-		$row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']);
-	$moment = $hopuse[$item['h_useat']];
-        if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) {    // Boil or Whirlpool
-        	$moment = $hopuse[$item['h_useat']].' '.$time." minuten";
-	} else if ($item['h_useat'] == 5) {	// Dryhop
-		$moment = $hopuse[$item['h_useat']].' '.sprintf("%.0f", $time / 1440).' dagen';
-        }
-
-	$memo .= $rows.$datas.$name.$datae.$datas.$hopform[$item['h_form']].$datae.$datas.sprintf("%.1f", $alpha).'%'.$datae.$datas;
-        $memo .= sprintf("%.1f", $ibu).$datae.$datas.sprintf("%.1f", $amount).$datae.$datas.$moment.$datae.$rowe.PHP_EOL;
-}
-$memo .= $tabue.PHP_EOL;
-$memo .= PHP_EOL;
-
-$memo .= '[u][b]Diversen[/b][/u]'.PHP_EOL;
-$memo .= $tabus.PHP_EOL;
-$memo .= $heads.'Specerij, kruid, brouwzout'.$heade.$heads.'Type grondstof'.$heade.$heads.'Gebruik tijdens'.$heade.$heads.'Hoeveel'.$heade.PHP_EOL;
-
-$arr = json_decode($row['json_miscs'], true);
-foreach($arr as $item) {
-	$use_use = $item['m_use_use'];
-	$time    = floatval($item['m_time']);
-
-	if ($use_use == 2)      // Boil
-        	$gebruik = sprintf("%s %d min",$miscuse[$use_use],$time);
-        else
-        	$gebruik = $miscuse[$use_use];
-	$hoeveel = sprintf("%.2f %s",floatval($item['m_amount']) * 1000,$item['m_amount_is_weight'] ? "gr":"ml");
-
-	$memo .= $rows.$datas.$item['m_name'].$datae.$datas.$misctype[$item['m_type']].$datae.$datas;
-        $memo .= $gebruik.$datae.$datas.$hoeveel.$datae.$rowe.PHP_EOL;
-}
-$memo .= $tabue.PHP_EOL;
-$memo .= PHP_EOL;
-
-$memo .= '[u][b]Gist[/b][/u]'.PHP_EOL;
-$memo .= $tabus.PHP_EOL;
-$memo .= $heads.'Gistlab en code'.$heade.$heads.'Omschrijving'.$heade.$heads.'Gebruik'.$heade.$heads.'Vorm'.$heade.$heads.'Hoeveel'.$heade.PHP_EOL;
-
-$arr = json_decode($row['json_yeasts'], true);
-foreach($arr as $item) {
-	$product = $item['y_laboratory']." ".$item['y_product_id'];
-
-	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";
-
-	$memo .= $rows.$datas.$product.$datae.$datas.$item['y_name'].$datae.$datas.$yeastuse[$item['y_use']].$datae.$datas;
-        $memo .= $yeastform[$item['y_form']].$datae.$datas.$amount.$datae.$rowe.PHP_EOL;
-}
-$memo .= $tabue.PHP_EOL;
-if ($row['starter_enable'] && $row['prop1_volume']) {
-	$sv = 0;
-	for ($i = 1; $i < 5; $i++) {
-		$pv = "prop".$i."_volume";
-		if (floatval($row[$pv]) && (floatval($row[$pv]) > $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');
-?>
-   <script>
-    // json_encode() seems to do the right thing.
-    var forumstr = <?= json_encode($memo) ?>;
-   </script>
-   <div id="MainPanel">
-    <div class="section">
-     <div style="overflow: hidden; margin: 25px;"><br>
-      <p>Het recept met alle gegevens staan gereed.</p>
-      <p>Zodra je de "Klembord" toets gebruikt zullen deze gegevens naar het klembord gekopieerd<br>
-      worden. In het scherm van het forum kun je deze gegevens vervolgens "plakken".</p>
-      <p>Na het drukken van de toets wordt dit scherm gesloten.</p>
-      <p><input type="button" value="Klembord" id="copytoClipboard" /></p>
-     </div>
-    </div>
-   </div>
-
-<?php
-page_footer();
-?>
--- 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 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php');
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/constants.php');
-require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php');
-
-
-$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
-if (! $link) {
-	die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
-}
-if (! mysqli_set_charset($link, "utf8" )) {
-	echo "error";
-	return 1;
-}
-
-setlocale ( LC_ALL, 'nl_NL.UTF-8');
-$record = $_GET["record"];
-$result = mysqli_query($link, "SELECT * FROM recipes WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-$total_fermentables = 0.0;
-$cost_fermentables = 0.0;
-$total_hops = 0.0;
-$cost_hops = 0.0;
-$cost_yeasts = 0.0;
-$cost_miscs = 0.0;
-$pSugar = 0;
-$pCara = 0;
-$svg = 77;
-$colorw = 0;
-$total_ibus = 0;
-$preboil_sg = 0;
-date_default_timezone_set('Europe/Amsterdam');
-$prdate = date(DATE_RFC2822);
-
-class PDF_MySQL_Table extends FPDF
-{
-	protected $ProcessingTable=false;
-	protected $aCols=array();
-	protected $TableX;
-
-	function Header() {
-		// Print the table header if necessary
-		if ($this->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();
--- 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 @@
-<?php
-require_once('config.php');
-
-
-$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
-if (! $link) {
-	die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
-}
-if (! mysqli_set_charset($link, "utf8" )) {
-	echo "error";
-	return 1;
-}
-
-$rescapers = array("'");
-$rreplacements = array("\\'");
-
-date_default_timezone_set('Europe/Amsterdam');
-if (isset($_GET["record"]))
-	$record = $_GET["record"];
-else
-	$record = 78;
-$result = mysqli_query($link, "SELECT * FROM recipes WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-
-/*
- * Copy this to a fresh product.
- */
-$sql  = "INSERT INTO `products` SET ";
-$sql .= "name='" . mysqli_real_escape_string($link, $row['name']);
-$sql .= "', uuid='" . str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
-$sql .= "', code='" . date("YmdHi");
-$sql .= "', birth='" . date("Y-m-d");
-$sql .= "', stage='1";
-$sql .= "', notes='" . mysqli_real_escape_string($link, $row['notes']);
-$sql .= "', log_brew='0', log_fermentation='0', log_ispindel='0', log_co2pressure='0', inventory_reduced='0', locked='0";
-// Equipment
-$sql .= "', eq_name='Kies zelf een installatie!";
-$sql .= "', eq_boil_size='" . $row['boil_size'];
-$sql .= "', eq_batch_size='" . $row['batch_size'];
-$sql .= "', eq_tun_volume='20', eq_tun_weight='2', eq_tun_specific_heat='0.11', eq_tun_material='0";
-$sql .= "', eq_tun_height='20', eq_top_up_water='0', eq_trub_chiller_loss='0.5', eq_evap_rate='1.8";
-$sql .= "', eq_boil_time='" . $row['boil_time'];
-$sql .= "', eq_calc_boil_volume='1', eq_top_up_kettle='0', eq_hop_utilization='100', eq_notes='";
-$sql .= "', eq_lauter_volume='20', eq_lauter_height='20', eq_lauter_deadspace='0.5', eq_kettle_volume='20";
-$sql .= "', eq_kettle_height='20', eq_mash_volume='18', eq_mash_max='6', eq_efficiency='75";
-// brewdate
-$sql .= "', brew_date_start=NULL, brew_mash_ph='0.0', brew_mash_sg='1.000";
-$sql .= "', brew_mash_efficiency='0.0', brew_sparge_ph='0.0', brew_sparge_temperature='85.0";
-$sql .= "', brew_preboil_volume='0', brew_preboil_sg='0', brew_preboil_ph='0.0', brew_preboil_efficiency='0";
-$sql .= "', brew_aboil_volume='0', brew_aboil_sg='0', brew_aboil_ph='0.0', brew_aboil_efficiency='0";
-$sql .= "', brew_cooling_method='0', brew_cooling_time='0', brew_cooling_to='20";
-$sql .= "', brew_whirlpool9='0', brew_whirlpool7='0', brew_whirlpool6='0', brew_whirlpool2='0";
-$sql .= "', brew_aeration_time='0', brew_aeration_speed='0', brew_aeration_type='0";
-$sql .= "', brew_fermenter_volume='" . floatval($row['batch_size']);
-$sql .= "', brew_fermenter_extrawater='0', brew_fermenter_tcloss='0.5', brew_fermenter_sg='0";
-$sql .= "', brew_fermenter_ibu='0', brew_fermenter_color='0', brew_date_end=NULL, og='0', fg='0";
-$sql .= "', primary_start_temp='0', primary_max_temp='0', primary_end_temp='0', primary_end_date=NULL, primary_end_sg='0";
-$sql .= "', secondary_temp='0', secondary_end_sg='0', secondary_end_date=NULL, tertiary_temp='0";
-$sql .= "', package_date=NULL, package_volume='0', package_infuse_amount='0', package_infuse_abv='0', package_infuse_notes='";
-$sql .= "', package_abv='0', package_ph='0";
-$sql .= "', bottle_amount='0', bottle_carbonation='0', bottle_priming_water='0', bottle_priming_amount='0', bottle_carbonation_temp='23";
-$sql .= "', keg_amount='0', keg_carbonation='0', keg_priming_water='0', keg_priming_amount='0', keg_carbonation_temp='23";
-$sql .= "', keg_forced_carb='0', keg_pressure='0";
-$sql .= "', taste_notes='";
-$sql .= "', taste_rate='0";
-$sql .= "', taste_date=NULL";
-$sql .=  ", taste_color='";
-$sql .= "', taste_transparency='";
-$sql .= "', taste_head='";
-$sql .= "', taste_aroma='";
-$sql .= "', taste_taste='";
-$sql .= "', taste_mouthfeel='";
-$sql .= "', taste_aftertaste='";
-// Style
-$sql .= "', st_name='" . mysqli_real_escape_string($link, $row['st_name']);
-$sql .= "', st_letter='" . mysqli_real_escape_string($link, $row['st_letter']);
-$sql .= "', st_guide='" . mysqli_real_escape_string($link, $row['st_guide']);
-$sql .= "', st_type='" . $row['st_type'];
-$sql .= "', st_category='" . mysqli_real_escape_string($link, $row['st_category']);
-$sql .= "', st_category_number='" . $row['st_category_number'];
-$sql .= "', st_og_min='" . $row['st_og_min'];
-$sql .= "', st_og_max='" . $row['st_og_max'];
-$sql .= "', st_fg_min='" . $row['st_fg_min'];
-$sql .= "', st_fg_max='" . $row['st_fg_max'];
-$sql .= "', st_ibu_min='" . $row['st_ibu_min'];
-$sql .= "', st_ibu_max='" . $row['st_ibu_max'];
-$sql .= "', st_color_min='" . $row['st_color_min'];
-$sql .= "', st_color_max='" . $row['st_color_max'];
-$sql .= "', st_carb_min='" . $row['st_carb_min'];
-$sql .= "', st_carb_max='" . $row['st_carb_max'];
-$sql .= "', st_abv_min='" . $row['st_abv_min'];
-$sql .= "', st_abv_max='" . $row['st_abv_max'];
-$sql .= "', type='" . $row['type'];
-$sql .= "', batch_size='" . $row['batch_size'];
-$sql .= "', boil_size='" . $row['boil_size'];
-$sql .= "', boil_time='" . $row['boil_time'];
-$sql .= "', efficiency='" . $row['efficiency'];
-$sql .= "', est_og='0.000";
-$sql .= "', est_og3='0.000";
-$sql .= "', est_fg='0.000";
-$sql .= "', est_abv='0.0";
-$sql .= "', est_carb='0";
-$sql .= "', est_color='0";
-$sql .= "', color_method='0";
-$sql .= "', est_ibu='0";
-$sql .= "', ibu_method='0";
-$sql .= "', sparge_temp='" . $row['sparge_temp'];
-$sql .= "', sparge_ph='" . $row['sparge_ph'];
-$sql .= "', sparge_volume='" . $row['sparge_volume'];
-$sql .= "', sparge_source='" . $row['sparge_source'];
-$sql .= "', sparge_acid_type='" . $row['sparge_acid_type'];
-$sql .= "', sparge_acid_perc='" . $row['sparge_acid_perc'];
-$sql .= "', sparge_acid_amount='0";
-$sql .= "', mash_ph='" . $row['mash_ph'];
-$sql .= "', mash_name='" . $row['mash_name'];
-$sql .= "', calc_acid='1";
-$sql .= "', w1_name='" . mysqli_real_escape_string($link, $row['w1_name']);
-$sql .= "', w1_amount='" . $row['w1_amount'];
-$sql .= "', w1_calcium='" . $row['w1_calcium'];
-$sql .= "', w1_sulfate='" . $row['w1_sulfate'];
-$sql .= "', w1_chloride='" . $row['w1_chloride'];
-$sql .= "', w1_sodium='" . $row['w1_sodium'];
-$sql .= "', w1_magnesium='" . $row['w1_magnesium'];
-$sql .= "', w1_total_alkalinity='" . $row['w1_total_alkalinity'];
-$sql .= "', w1_ph='" . $row['w1_ph'];
-$sql .= "', w1_cost='" . $row['w1_cost'];
-$sql .= "', w2_name='" . mysqli_real_escape_string($link, $row['w2_name']);
-$sql .= "', w2_amount='" . $row['w2_amount'];
-$sql .= "', w2_calcium='" . $row['w2_calcium'];
-$sql .= "', w2_sulfate='" . $row['w2_sulfate'];
-$sql .= "', w2_chloride='" . $row['w2_chloride'];
-$sql .= "', w2_sodium='" . $row['w2_sodium'];
-$sql .= "', w2_magnesium='" . $row['w2_magnesium'];
-$sql .= "', w2_total_alkalinity='" . $row['w2_total_alkalinity'];
-$sql .= "', w2_ph='" . $row['w2_ph'];
-$sql .= "', w2_cost='" . $row['w2_cost'];
-$sql .= "', wg_amount='" . $row['wg_amount'];
-$sql .= "', wg_calcium='" . $row['wg_calcium'];
-$sql .= "', wg_sulfate='" . $row['wg_sulfate'];
-$sql .= "', wg_chloride='" . $row['wg_chloride'];
-$sql .= "', wg_sodium='" . $row['wg_sodium'];
-$sql .= "', wg_magnesium='" . $row['wg_magnesium'];
-$sql .= "', wg_total_alkalinity='" . $row['wg_total_alkalinity'];
-$sql .= "', wg_ph='" . $row['wg_ph'];
-$sql .= "', wb_calcium='" . $row['wb_calcium'];
-$sql .= "', wb_sulfate='" . $row['wb_sulfate'];
-$sql .= "', wb_chloride='" . $row['wb_chloride'];
-$sql .= "', wb_sodium='" . $row['wb_sodium'];
-$sql .= "', wb_magnesium='" . $row['wb_magnesium'];
-$sql .= "', wb_total_alkalinity='" . $row['wb_total_alkalinity'];
-$sql .= "', wb_ph='" . $row['wb_ph'];
-$sql .= "', wa_acid_name='" . $row['wa_acid_name'];
-$sql .= "', wa_acid_perc='" . $row['wa_acid_perc'];
-$sql .= "', wa_base_name='" . $row['wa_base_name'];
-$sql .= "', starter_enable='0', starter_type='0', starter_sg='1.037', starter_viability='97";
-$sql .= "', prop1_type='0', prop1_volume='0', prop2_type='0', prop2_volume='0";
-$sql .= "', prop3_type='0', prop3_volume='0', prop4_type='0', prop4_volume='0";
-$sql .= "', divide_type='0', divide_parts='0', divide_part='0', divide_size='0', divide_factor='1.0";
-$sql .= "', json_fermentables='" . str_replace($rescapers,$rreplacements,$row['json_fermentables']);
-$sql .= "', json_hops='" . str_replace($rescapers,$rreplacements,$row['json_hops']);
-$sql .= "', json_miscs='" . str_replace($rescapers,$rreplacements,$row['json_miscs']);
-$sql .= "', json_yeasts='" . str_replace($rescapers,$rreplacements,$row['json_yeasts']);
-$sql .= "', json_mashs='" . str_replace($rescapers,$rreplacements,$row['json_mashs']);
-$sql .= "';";
-syslog(LOG_NOTICE, $sql);
-
-$result = mysqli_query($link, $sql);
-if (! $result) {
-	syslog(LOG_NOTICE, "rec_toproduct: result: ".mysqli_error($link));
-} else {
-	$lastid = mysqli_insert_id($link);
-	syslog(LOG_NOTICE, "rec_toproduct: inserted record ".$lastid);
-}
-echo "<script>window.close();</script>";
-exit;

mercurial