Removed product export functions

Fri, 05 Aug 2022 12:12:53 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 05 Aug 2022 12:12:53 +0200
changeset 817
6ee186182c70
parent 816
d76f623d487c
child 818
f9c071906643

Removed product export functions

www/Makefile file | annotate | diff | comparison | revisions
www/js/prod_divide.js file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/js/prod_export.js file | annotate | diff | comparison | revisions
www/js/prod_forum.js file | annotate | diff | comparison | revisions
www/js/prod_impbrew.js file | annotate | diff | comparison | revisions
www/prod_beerxml.php file | annotate | diff | comparison | revisions
www/prod_checklist.php file | annotate | diff | comparison | revisions
www/prod_divide.php file | annotate | diff | comparison | revisions
www/prod_duplicate.php file | annotate | diff | comparison | revisions
www/prod_edit.php file | annotate | diff | comparison | revisions
www/prod_export.php file | annotate | diff | comparison | revisions
www/prod_forum.php file | annotate | diff | comparison | revisions
www/prod_impbrew.php file | annotate | diff | comparison | revisions
www/prod_print.php file | annotate | diff | comparison | revisions
www/prod_torecipe.php file | annotate | diff | comparison | revisions
--- a/www/Makefile	Fri Aug 05 11:02:01 2022 +0200
+++ b/www/Makefile	Fri Aug 05 12:12:53 2022 +0200
@@ -10,9 +10,7 @@
 		  import_ingredients.php index.php \
 		  log_co2pressure.php log_fermentation.php log_ispindel.php \
 		  mon_brewer.php mon_co2meter.php mon_fermenter.php mon_ispindel.php mon_node.php \
-		  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_print.php prod_torecipe.php \
+		  prod_edit.php prod_inprod.php \
 		  rec_view.php rec_main.php \
 		  upl_fermentables.php upl_hops.php upl_miscs.php upl_styles.php upl_yeasts.php version.php
 SUB		= version.php.in images/* css/* jqwidgets/* jqwidgets/styles/* \
--- a/www/js/prod_divide.js	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,517 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019-2020
- *
- * 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() {
-
- $('#divide_type').jqxDropDownList({
-  theme: theme,
-  source: SplitAdapter,
-  valueMember: 'id',
-  displayMember: 'nl',
-  width: 180,
-  height: 23,
-  autoDropDownHeight: true
- });
-
- // Calculate the volume in the main batch.
- function calcLeftover() {
-    rows = $('#splitGrid').jqxGrid('getrows');
-    leftover = Round(available, 1);
-    for (i = 0; i < rows.length; i++) {
-     row = rows[i];
-     leftover = Round(leftover - row.split_size, 1);
-     console.log('i:' + i + ' split_size:' + row.split_size);
-    }
-    $('#leftover').val(leftover);
-    console.log('calcLeftover():' + leftover);
- }
-
- // Calculate available volume but ignore the current row.
- function calcRoom(r) {
-  var rows, row, i, vol = 0;
-
-  rows = $('#splitGrid').jqxGrid('getrows');
-  for (i = 0; i < rows.length; i++) {
-   row = rows[i];
-   if (i != r)
-    vol += row.split_size;
-  }
-  maxvolume = Round(available - minvolume - vol, 1);
-  console.log('calcRoom(' + r + '):' + vol + ' room:' + maxvolume);
- }
-
- var dataRecord = {},
- i,
- available = 0,
- leftover = 0,
- minvolume = 0,
- maxvolume = 0,
- url = 'includes/db_product.php',
-
- // Prepare the data
- source = {
-  datatype: 'json',
-  cache: false,
-  datafields: [
-   // From prod_main
-   { name: 'record', type: 'number' },
-   { name: 'uuid', type: 'string' },
-   { name: 'name', type: 'string' },
-   { name: 'code', type: 'string' },
-   { name: 'birth', type: 'string' },
-   { name: 'stage', type: 'int' },
-   { name: 'notes', type: 'string' },
-   { name: 'log_brew', type: 'int' },
-   { name: 'log_fermentation', type: 'int' },
-   { name: 'log_ispindel', type: 'int' },
-   { name: 'log_co2pressure', type: 'int' },
-   { name: 'inventory_reduced', type: 'int' },
-   { name: 'locked', type: 'int' },
-   { name: 'eq_name', type: 'string' },
-   { name: 'eq_boil_size', type: 'float' },
-   { name: 'eq_batch_size', type: 'float' },
-   { name: 'eq_tun_volume', type: 'float' },
-   { name: 'eq_tun_weight', type: 'float' },
-   { name: 'eq_tun_specific_heat', type: 'float' },
-   { name: 'eq_tun_material', type: 'int' },
-   { name: 'eq_tun_height', type: 'float' },
-   { name: 'eq_top_up_water', type: 'float' },
-   { name: 'eq_trub_chiller_loss', type: 'float' },
-   { name: 'eq_evap_rate', type: 'float' },
-   { name: 'eq_boil_time', type: 'float' },
-   { name: 'eq_calc_boil_volume', type: 'int' },
-   { name: 'eq_top_up_kettle', type: 'float' },
-   { name: 'eq_hop_utilization', type: 'float' },
-   { name: 'eq_notes', type: 'string' },
-   { name: 'eq_lauter_volume', type: 'float' },
-   { name: 'eq_lauter_height', type: 'float' },
-   { name: 'eq_lauter_deadspace', type: 'float' },
-   { name: 'eq_kettle_volume', type: 'float' },
-   { name: 'eq_kettle_height', type: 'float' },
-   { name: 'eq_mash_volume', type: 'float' },
-   { name: 'eq_mash_max', type: 'float' },
-   { name: 'eq_efficiency', type: 'float' },
-   { name: 'brew_date_start', type: 'string' },
-   { name: 'brew_mash_ph', type: 'float' },
-   { name: 'brew_mash_sg', type: 'float' },
-   { name: 'brew_mash_efficiency', type: 'float' },
-   { name: 'brew_sparge_est', type: 'float' },
-   { name: 'brew_sparge_ph', type: 'float' },
-   { name: 'brew_preboil_volume', type: 'float' },
-   { name: 'brew_preboil_sg', type: 'float' },
-   { name: 'brew_preboil_ph', type: 'float' },
-   { name: 'brew_preboil_efficiency', type: 'float' },
-   { name: 'brew_aboil_volume', type: 'float' },
-   { name: 'brew_aboil_sg', type: 'float' },
-   { name: 'brew_aboil_ph', type: 'float' },
-   { name: 'brew_aboil_efficiency', type: 'float' },
-   { name: 'brew_cooling_method', type: 'int' },
-   { name: 'brew_cooling_time', type: 'float' },
-   { name: 'brew_cooling_to', type: 'float' },
-   { name: 'brew_whirlpool9', type: 'float' },
-   { name: 'brew_whirlpool7', type: 'float' },
-   { name: 'brew_whirlpool6', type: 'float' },
-   { name: 'brew_whirlpool2', type: 'float' },
-   { name: 'brew_fermenter_volume', type: 'float' },
-   { name: 'brew_fermenter_extrawater', type: 'float' },
-   { name: 'brew_fermenter_tcloss', type: 'float' },
-   { name: 'brew_aeration_time', type: 'float' },
-   { name: 'brew_aeration_speed', type: 'float' },
-   { name: 'brew_aeration_type', type: 'int' },
-   { name: 'brew_fermenter_sg', type: 'float' },
-   { name: 'brew_fermenter_ibu', type: 'float' },
-   { name: 'brew_fermenter_color', type: 'float' },
-   { name: 'brew_date_end', type: 'string' },
-   { name: 'og', type: 'float' },
-   { name: 'fg', type: 'float' },
-   { name: 'primary_start_temp', type: 'float' },
-   { name: 'primary_max_temp', type: 'float' },
-   { name: 'primary_end_temp', type: 'float' },
-   { name: 'primary_end_sg', type: 'float' },
-   { name: 'primary_end_date', type: 'string' },
-   { name: 'secondary_temp', type: 'float' },
-   { name: 'secondary_end_sg', type: 'float' },
-   { name: 'secondary_end_date', type: 'string' },
-   { name: 'tertiary_temp', type: 'float' },
-   { name: 'package_date', type: 'string' },
-   { name: 'package_volume', type: 'float' },
-   { name: 'package_infuse_amount', type: 'float' },
-   { name: 'package_infuse_abv', type: 'float' },
-   { name: 'package_infuse_notes', type: 'string' },
-   { name: 'package_abv', type: 'float' },
-   { name: 'package_ph', type: 'float' },
-   { name: 'bottle_amount', type: 'float' },
-   { name: 'bottle_carbonation', type: 'float' },
-   { name: 'bottle_priming_water', type: 'float' },
-   { name: 'bottle_priming_amount', type: 'float' },
-   { name: 'bottle_carbonation_temp', type: 'float' },
-   { name: 'keg_amount', type: 'float' },
-   { name: 'keg_carbonation', type: 'float' },
-   { name: 'keg_priming_water', type: 'float' },
-   { name: 'keg_priming_amount', type: 'float' },
-   { name: 'keg_carbonation_temp', type: 'float' },
-   { name: 'keg_forced_carb', type: 'int' },
-   { name: 'keg_pressure', type: 'float' },
-   { name: 'taste_notes', type: 'string' },
-   { name: 'taste_rate', type: 'float' },
-   { name: 'taste_date', type: 'string' },
-   { name: 'taste_color', type: 'string' },
-   { name: 'taste_transparency', type: 'string' },
-   { name: 'taste_head', type: 'string' },
-   { name: 'taste_aroma', type: 'string' },
-   { name: 'taste_taste', type: 'string' },
-   { name: 'taste_mouthfeel', type: 'string' },
-   { name: 'taste_aftertaste', type: 'string' },
-   { name: 'st_name', type: 'string' },
-   { name: 'st_letter', type: 'string' },
-   { name: 'st_guide', type: 'string' },
-   { name: 'st_category', type: 'string' },
-   { name: 'st_category_number', type: 'int' },
-   { name: 'st_type', type: 'int' },
-   { name: 'st_og_min', type: 'float' },
-   { name: 'st_og_max', type: 'float' },
-   { name: 'st_fg_min', type: 'float' },
-   { name: 'st_fg_max', type: 'float' },
-   { name: 'st_ibu_min', type: 'float' },
-   { name: 'st_ibu_max', type: 'float' },
-   { name: 'st_color_min', type: 'float' },
-   { name: 'st_color_max', type: 'float' },
-   { name: 'st_carb_min', type: 'float' },
-   { name: 'st_carb_max', type: 'float' },
-   { name: 'st_abv_min', type: 'float' },
-   { name: 'st_abv_max', type: 'float' },
-   { name: 'type', type: 'int' },
-   { name: 'batch_size', type: 'float' },
-   { name: 'boil_size', type: 'float' },
-   { name: 'boil_time', type: 'float' },
-   { name: 'efficiency', type: 'float' },
-   { name: 'est_og', type: 'float' },
-   { name: 'est_fg', type: 'float' },
-   { name: 'est_abv', type: 'float' },
-   { name: 'est_color', type: 'float' },
-   { name: 'color_method', type: 'int' },
-   { name: 'est_ibu', type: 'float' },
-   { name: 'ibu_method', type: 'int' },
-   { name: 'est_carb', type: 'float' },
-   { name: 'sparge_temp', type: 'float' },
-   { name: 'sparge_ph', type: 'float' },
-   { name: 'sparge_volume', type: 'float' },
-   { name: 'sparge_source', type: 'int' },
-   { name: 'sparge_acid_type', type: 'int' },
-   { name: 'sparge_acid_perc', type: 'float' },
-   { name: 'sparge_acid_amount', type: 'float' },
-   { name: 'mash_ph', type: 'float' },
-   { name: 'mash_name', type: 'string' },
-   { name: 'calc_acid', type: 'int' },
-   { name: 'w1_name', type: 'string' },
-   { name: 'w1_amount', type: 'float' },
-   { name: 'w1_calcium', type: 'float' },
-   { name: 'w1_sulfate', type: 'float' },
-   { name: 'w1_chloride', type: 'float' },
-   { name: 'w1_sodium', type: 'float' },
-   { name: 'w1_magnesium', type: 'float' },
-   { name: 'w1_total_alkalinity', type: 'float' },
-   { name: 'w1_ph', type: 'float' },
-   { name: 'w1_cost', type: 'float' },
-   { name: 'w2_name', type: 'string' },
-   { name: 'w2_amount', type: 'float' },
-   { name: 'w2_calcium', type: 'float' },
-   { name: 'w2_sulfate', type: 'float' },
-   { name: 'w2_chloride', type: 'float' },
-   { name: 'w2_sodium', type: 'float' },
-   { name: 'w2_magnesium', type: 'float' },
-   { name: 'w2_total_alkalinity', type: 'float' },
-   { name: 'w2_ph', type: 'float' },
-   { name: 'w2_cost', type: 'float' },
-   { name: 'wg_amount', type: 'float' },
-   { name: 'wg_calcium', type: 'float' },
-   { name: 'wg_sulfate', type: 'float' },
-   { name: 'wg_chloride', type: 'float' },
-   { name: 'wg_sodium', type: 'float' },
-   { name: 'wg_magnesium', type: 'float' },
-   { name: 'wg_total_alkalinity', type: 'float' },
-   { name: 'wg_ph', type: 'float' },
-   { name: 'wb_calcium', type: 'float' },
-   { name: 'wb_sulfate', type: 'float' },
-   { name: 'wb_chloride', type: 'float' },
-   { name: 'wb_sodium', type: 'float' },
-   { name: 'wb_magnesium', type: 'float' },
-   { name: 'wb_total_alkalinity', type: 'float' },
-   { name: 'wb_ph', type: 'float' },
-   { name: 'wa_acid_name', type: 'int' },
-   { name: 'wa_acid_perc', type: 'int' },
-   { name: 'wa_base_name', type: 'int' },
-   { name: 'starter_enable', type: 'int' },
-   { name: 'starter_type', type: 'int' },
-   { name: 'starter_sg', type: 'float' },
-   { name: 'starter_viability', type: 'int' },
-   { name: 'starter_viability', type: 'int' },
-   { name: 'prop1_type', type: 'int' },
-   { name: 'prop1_volume', type: 'float' },
-   { name: 'prop2_type', type: 'int' },
-   { name: 'prop2_volume', type: 'float' },
-   { name: 'prop3_type', type: 'int' },
-   { name: 'prop3_volume', type: 'float' },
-   { name: 'prop4_type', type: 'int' },
-   { name: 'prop4_volume', type: 'float' },
-   { name: 'divide_type', type: 'int' },
-   { name: 'divide_size', type: 'float' },
-   { name: 'divide_parts', type: 'int' },
-   { name: 'fermentables', type: 'string' },
-   { name: 'hops', type: 'string' },
-   { name: 'miscs', type: 'string' },
-   { name: 'yeasts', type: 'string' },
-   { name: 'mashs', type: 'string' }
-  ],
-  id: 'record',
-  url: url + '?record=' + my_record
- },
-
- // Load data and select one record.
- dataAdapter = new $.jqx.dataAdapter(source, {
-  loadComplete: function() {
-   var records = dataAdapter.records;
-   dataRecord = records[0];
-   // Hidden record uuid
-   $('#name').val(dataRecord.name);
-   $('#code').val(dataRecord.code);
-   $('#stage').val(StageData[dataRecord.stage].nl);
-   // Disable stages that are already done.
-   for (i = 0; i < SplitData.length; i++) {
-    if (SplitData[i].ok < dataRecord.stage)
-     $('#divide_type').jqxDropDownList('disableAt', i);
-   }
-  },
-   loadError: function(jqXHR, status, error) {
-  },
-  beforeLoadComplete: function(records) {
-   $('#jqxLoader').jqxLoader('open');
-  }
- });
-
- var editSplit = function(data) {
-  var splitSource = {
-   datatype: 'local',
-   cache: false,
-   async: false,
-   datafields: [
-    { name: 'split_code', type: 'string' },
-    { name: 'split_name', type: 'string' },
-    { name: 'split_size', type: 'float' }
-   ],
-   addrow: function(rowid, rowdata, position, commit) {
-    console.log('split addrow ' + rowid);
-    commit(true);
-   },
-   deleterow: function(rowid, commit) {
-    console.log('split deleterow ' + rowid);
-    commit(true);
-   }
-  },
-  splitAdapter = new $.jqx.dataAdapter(splitSource, {});
-  $('#splitGrid').jqxGrid({
-   width: 1240,
-   height: 375,
-   source: splitAdapter,
-   editable: true,
-   enabletooltips: true,
-   selectionmode: 'singlecell',
-   editmode: 'click',
-   theme: theme,
-   showtoolbar: true,
-   rendertoolbar: function(toolbar) {
-    var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
-    toolbar.append(container);
-    container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe splitsing" />');
-    container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder splitsing" />');
-    $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, disabled: true, height: 27, width: 150 });
-    $('#saddrowbutton').on('click', function() {
-     var row = {}, rowscount = $('#splitGrid').jqxGrid('getdatainformation').rowscount;
-     row['split_code'] = dataRecord.code + '-' + (rowscount + 1);
-     row['split_name'] = dataRecord.name + ' ' + (rowscount + 1);
-     row['split_size'] = 0;
-     $('#splitGrid').jqxGrid('addrow', null, row);
-     $('#sdeleterowbutton').jqxButton({ disabled: false }); // Enable delete
-     $('#divide_type').jqxDropDownList({ disabled: true }); // Disable dropdown
-    });
-    // Delete last added split
-    $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, disabled: true, height: 27, width: 150 });
-    $('#sdeleterowbutton').on('click', function() {
-     var rowscount, id, row;
-     rowscount = $('#splitGrid').jqxGrid('getdatainformation').rowscount;
-     id = $('#splitGrid').jqxGrid('getrowid', rowscount - 1);
-     // First, give back this batch volume.
-     row = $('#splitGrid').jqxGrid('getrowdata', id);
-     leftover = Round(leftover + row.split_size, 1);
-     if (leftover > available)
-      leftover = available;
-     $('#leftover').val(leftover);
-     // Then delete the row.
-     $('#splitGrid').jqxGrid('deleterow', id);
-     if (rowscount == 1) {
-      $('#sdeleterowbutton').jqxButton({ disabled: true }); // No more rows
-      $('#divide_type').jqxDropDownList({ disabled: false });
-     }
-    });
-   },
-   columns: [
-    { text: 'Splits code', datafield: 'split_code', width: 120, editable: false },
-    { text: 'Splits naam', datafield: 'split_name' },
-    { text: 'Splits volume', datafield: 'split_size', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', columntype: 'numberinput',
-      validation: function(cell, value) {
-       if (value < 0 || value > maxvolume) {
-         return { result: false, message: 'Volume should be between 0 and ' + maxvolume + ' liter' };
-       }
-       return true;
-      },
-      createeditor: function(row, cellvalue, editor) {
-       editor.jqxNumberInput({ decimalDigits: 1, digits: 3 });
-      }
-    }
-   ]
-  });
-  $('#splitGrid').on('cellbeginedit', function(event) {
-    var args = event.args;
-    calcRoom(args.rowindex); // Make maxvolume available.
-  });
-  $('#splitGrid').on('cellvaluechanged', function(event) {
-    var args = event.args;
-    //console.log("cellvaluechanged, Column: " + args.datafield + ", Row: " + (1 + args.rowindex) + ", Value: " + args.value);
-    calcLeftover();
-  });
- };
-
- dataAdapter.dataBind();
- editSplit(dataRecord);
-
- // initialize the input fields.
- $('#name').jqxTooltip({ content: 'De naam voor dit product.' });
- $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
- $('#code').jqxTooltip({ content: 'Product code nummer.' });
- $('#code').jqxInput({ theme: theme, width: 100, height: 23 });
- $('#stage').jqxTooltip({ content: 'De productie fase van dit product.' });
- $('#stage').jqxInput({ theme: theme, width: 100, height: 23 });
- $('#available').jqxNumberInput(Show1dec);
- $('#leftover').jqxNumberInput(Show1dec);
- $('#divide_type').val(0);
- $('#divide_type').on('select', function(event) {
-  var index = event.args.index;
-  dataRecord.divide_type = index;
-  switch (index) {
-   case 0:
-    available = 0;
-    break;
-   case 1:
-    available = dataRecord.boil_size;
-    break;
-   case 2:
-    available = dataRecord.batch_size;
-    break;
-   case 3:
-    available = dataRecord.brew_fermenter_volume;
-    break;
-   case 4:
-   case 5:
-    available = Round(dataRecord.brew_fermenter_volume * 0.92, 1); // Estimate volume without yeast trub
-    break;
-   case 6:
-    available = dataRecord.package_volume;
-    break;
-  }
-  leftover = available;
-  console.log('divide_type:' + index + ' available:' + available);
-  $('#available').val(available);
-  $('#leftover').val(leftover);
-  if (index != 0) {
-    $('#saddrowbutton').jqxButton({ disabled: false });
-  } else {
-    $('#saddrowbutton').jqxButton({ disabled: true });
-  }
- });
-
- $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
- $('#Cancel').bind('click', function() {
-  window.location.href = my_return;
- });
-
- $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
- $('#Save').bind('click', function() {
-  var rows, row, i, div, data;
-  if (! leftover) {
-   console.log('Save and no volume left');
-   alert('Fout, er is geen volume over in de hoofd batch.');
-  } else if (leftover != available) {
-   console.log('Save and there are splits');
-
-   // Send all the info to the database. The server handles the splitting.
-   var divide_data = new Array();
-   row = {};
-   row.name = dataRecord.name;
-   row.code = dataRecord.code;
-   row.size = Round(leftover, 4);
-   row.factor = Round((leftover / available), 4);
-   row.part = 0;
-   divide_data.push(row);
-
-   rows = $('#splitGrid').jqxGrid('getrows');
-   for (i = 0; i < rows.length; i++) {
-    row = rows[i];
-    console.log('split ' + i);
-    div = {};
-    div.size = Round(row.split_size, 4);
-    div.factor = Round((row.split_size / available), 4);
-    div.part = i + 1;
-    div.name = row.split_name;
-    div.code = row.split_code;
-    divide_data.push(div);
-   }
-
-   // Send the data to the server
-   div = {};
-   div.record = dataRecord.record;
-   div.divide_type = dataRecord.divide_type;
-   div.divide_parts = i;
-   div.divide_data = divide_data;
-   data = $.param(div);
-   $.ajax({
-     dataType: 'json',
-     url: 'includes/db_divides.php',
-     cache: false,
-     data: data,
-     type: 'POST',
-     success: function(data) {
-      if (data.error) {
-       console.log('insert divides: error ' + data.msg);
-       alert('Fout: ' + data.msg);
-      } else {
-       console.log('insert divides: success');
-      }
-      window.location.href = my_return;
-     },
-     error: function(jqXHR, textStatus, errorThrown) {
-      console.log('insert divides: ' + textStatus);
-     }
-   });
-  } // if (leftover != available)
- });
-});
--- a/www/js/prod_edit.js	Fri Aug 05 11:02:01 2022 +0200
+++ b/www/js/prod_edit.js	Fri Aug 05 12:12:53 2022 +0200
@@ -6413,11 +6413,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.
--- a/www/js/prod_export.js	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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);
- $('#code').html(my_code);
- $('#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 });
- $('#jqxRadioButton6').jqxRadioButton({ theme: theme, width: 250, height: 23 });
- $('#jqxRadioButton7').jqxRadioButton({ theme: theme, width: 250, height: 23 });
- if ((my_split != 0) || (my_stage >= 6)) {
-  $('#jqxRadioButton3').jqxRadioButton({ disabled: true });
-  document.getElementById('pmpt3').style.color = 'red';
- }
-
- $('#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;
- });
- $('#jqxRadioButton6').on('checked', function(event) {
-  $('#Start').jqxButton({ disabled: false });
-  choice = 6;
- });
- $('#jqxRadioButton7').on('checked', function(event) {
-  $('#Start').jqxButton({ disabled: false });
-  choice = 7;
- });
-
- $('#Start').jqxButton({ template: 'success', width: '100px', theme: theme, disabled: true });
- $('#Start').click(function() {
-  if (choice == 1) {
-   window.open('prod_beerxml.php?record=' + my_record);
-  } else if (choice == 2) {
-   window.open('prod_duplicate.php?record=' + my_record);
-  } else if (choice == 3) {
-   window.location.href = 'prod_divide.php?record=' + my_record + '&return=' + my_return;
-  } else if (choice == 4) {
-   window.open('prod_torecipe.php?record=' + my_record);
-  } else if (choice == 5) {
-   window.open('prod_print.php?record=' + my_record);
-  } else if (choice == 6) {
-   window.open('prod_checklist.php?record=' + my_record);
-  } else if (choice == 7) {
-   window.open('prod_forum.php?record=' + my_record);
-  }
-  // Return to the original product
-  if (choice != 3)
-   window.location.href = 'prod_edit.php?record=' + my_record + '&return=' + my_return;
- });
-
-});
--- a/www/js/prod_forum.js	Fri Aug 05 11:02:01 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/js/prod_impbrew.js	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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() {
-
- $('#jqxFileUpload').jqxFileUpload({
-  width: 300,
-  browseTemplate: 'success',
-  cancelTemplate: 'inverse',
-  uploadTemplate: 'primary',
-  theme: theme,
-  multipleFilesUpload: false,
-  accept: 'application/json',
-  uploadUrl: 'upl_brew.php',
-  fileInputName: 'fileToUpload'
- });
- $('#eventsPanel').jqxPanel({
-  width: 800,
-  height: 200,
-  theme: theme
- });
- $('#jqxFileUpload').on('select', function(event) {
-  var fileName, fileSize, args = event.args;
-  fileName = args.file;
-  fileSize = args.size;
-  $('#eventsPanel').jqxPanel('clearcontent');
-  $('#eventsPanel').jqxPanel('append', '<strong>' + event.type + ':</strong> ' + fileName + '  size: ' + fileSize + '<br />');
- });
- $('#jqxFileUpload').on('uploadEnd', function(event) {
-  var fileName, serverResponce, args = event.args;
-  fileName = args.file;
-  serverResponce = args.response;
-  $('#eventsPanel').jqxPanel('append', '<strong>' + event.type + ':</strong> ontvangen ' + fileName + '<br />' + serverResponce + '<br />');
- });
-
-});
--- a/www/prod_beerxml.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,324 +0,0 @@
-<?php
-require_once('config.php');
-require_once('includes/formulas.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 = 71;
-$result = mysqli_query($link, "SELECT * FROM products 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'])));
-field($xw, 'OG', sprintf("%.3f",floatval($row['og'])));
-field($xw, 'FG', sprintf("%.3f",floatval($row['fg'])));
-
-
-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']]);
-}
-
-/* If product is packaged and carbonated, add fermentation data. */
-if ($row['stage'] >= 8) {
-	$d1 = new DateTime($row['brew_date_end']);
-        $d2 = new DateTime($row['primary_end_date']);
-        $d3 = new DateTime($row['secondary_end_date']);
-        $d4 = new DateTime($row['package_date']);
-	$diff = $d2->diff($d1);
-        $primary_days = $diff->days;
-        $diff = $d3->diff($d2);
-        $secondary_days = $diff->days;
-        $diff = $d4->diff($d3);
-        $tertiary_days = $diff->days;
-	field($xw, 'FERMENTATION_STAGES', '3');
-	field($xw, 'PRIMARY_AGE', sprintf("%.1f", $primary_days));
-	field($xw, 'PRIMARY_TEMP', sprintf("%.1f", $row['primary_max_temp']));
-	field($xw, 'SECONDARY_AGE', sprintf("%.1f", $secondary_days));
-	field($xw, 'SECONDARY_TEMP', sprintf("%.1f", $row['secondary_temp']));
-	field($xw, 'TERTIARY_AGE', sprintf("%.1f", $tertiary_days));
-	field($xw, 'TERTIARY_TEMP', sprintf("%.1f", $row['tertiary_temp']));
-	field($xw, 'CARBONATION', sprintf("%.1f", $row['bottle_carbonation']));
-	field($xw, 'FORCED_CARBONATION', 'FALSE');
-	field($xw, 'CARBONATION_TEMP', sprintf("%.1f", $row['bottle_carbonation_temp']));
-}
-
-if ($row['brew_cooling_to'] > 0)
-	field($xw, 'BMS_COOLING_TO', sprintf("%.1f",floatval($row['brew_cooling_to'])));
-
-if ($row['brew_whirlpool9'] > 0)
-	field($xw, 'BMS_WHIRLPOOL9', sprintf("%.0f",floatval($row['brew_whirlpool9'])));
-if ($row['brew_whirlpool7'] > 0)
-	field($xw, 'BMS_WHIRLPOOL7', sprintf("%.0f",floatval($row['brew_whirlpool7'])));
-if ($row['brew_whirlpool6'] > 0)
-	field($xw, 'BMS_WHIRLPOOL6', sprintf("%.0f",floatval($row['brew_whirlpool6'])));
-if ($row['brew_whirlpool2'] > 0)
-	field($xw, 'BMS_WHIRLPOOL2', sprintf("%.0f",floatval($row['brew_whirlpool2'])));
-
-
-// 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', $row['eq_name']);
-field($xw, 'NOTES', $row['eq_notes']);
-field($xw, 'BATCH_SIZE', sprintf("%.2f",floatval($row['eq_batch_size'])));
-field($xw, 'BOIL_SIZE', sprintf("%.2f",floatval($row['eq_boil_size'])));
-field($xw, 'BOIL_TIME', sprintf("%.0f",floatval($row['eq_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['code'] . ' ' . $row['name'] . '.xml"');
-header('Content-Transfer-Encoding: binary');
-header('Expires: 0');
-header('Pragma: no-cache');
-header('Content-Length: '.strlen($beerxml));
-exit($beerxml);
--- a/www/prod_checklist.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,682 +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 products WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-date_default_timezone_set('Europe/Amsterdam');
-$prdate = date(DATE_RFC2822);
-
-
-class PDF_MySQL_Table extends FPDF
-{
-	function Checkheader($text) {
-		$this->SetFont('Arial','B',10);
-		$this->Cell(0, 4,$text,0,0,'L',true);
-		$this->SetFont('Arial','',10);
-		$this->Ln(6);
-	}
-
-	function Checkline($text) {
-		$this->Cell(2, 4,' ',0,0,'L',true);
-		$this->Cell(4, 4,' ',1,0,'L',true);
-		$this->Cell(0, 4,' '.$text,0,1,'L',true);
-		$this->Ln(1);
-	}
-
-	function CheckInput($text, $prompt) {
-		if (strlen($text)) {
-			$this->Cell(2, 4,' ',0,0,'L',true);
-			$this->Cell(4, 4,' ',1,0,'L',true);
-			$this->Cell(130, 4,' '.$text,0,0,'L',true);
-		} else {
-			$this->Cell(136, 4,' ',0,0,'L',true);
-		}
-		$this->Cell(0, 4, 'Gemeten: _________ '.$prompt,0,1,'L',true);
-		$this->Ln(1);
-	}
-
-	function Checksplit($moment, $row) {
-		global $splitat;
-		if ($row['divide_type'] && $row['divide_type'] == $moment) {
-			$this->Ln(2);
-			$this->SetFont('Helvetica','B',14);
-               		$this->Cell(0, 4,$splitat[$row['divide_type']]." splits de batch hier!",0,0,'C',true);
-               		$this->SetFont('Arial','',10);
-			$this->AddPage();
-			return true;
-		}
-		return false;
-	}
-
-	function Checklist($row) {
-
-		global $my_grain_absorbtion;
-		global $my_brix_correction;
-		global $acidtype;
-		$mashwater = 0;
-		$numsalts = 0;
-		$factor = 1 / $row['divide_factor'];
-
-		$this->AddPage();
-		$this->SetFillColor(255,255,255);
-
-		$ferms = json_decode($row['json_fermentables'], true);
-		$hops = json_decode($row['json_hops'], true);
-		$miscs = json_decode($row['json_miscs'], true);
-		$yeasts = json_decode($row['json_yeasts'], true);
-
-		if ($row['starter_enable'] && $row['prop1_volume']) {
-			$this->Checkheader('Giststarter maken');
-			$days = 0;
-			$last = 0;
-			for ($i = 1; $i < 5; $i++) {
-				$pt = "prop".$i."_type";
-				$pv = "prop".$i."_volume";
-				if (floatval($row[$pv])) {
-					$last = $i;
-					if ($row[$pt] == 0)
-						$days += 2;
-					else if ($row[$pt] == 1)
-						$days += 4;
-					else
-						$days += 6;
-				}
-			}
-			$this->Checkline("begin ongeveer ".$days." dagen voor de brouwdag met de giststarter");
-			for ($i = 1; $i < 5; $i++) {
-				$pt = "prop".$i."_type";
-				$pv = "prop".$i."_volume";
-				if (floatval($row[$pv])) {
-					$s  = "Starter stap ".$i.", van ".sprintf("%.3f",floatval($row[$pv]));
-					$s .= " liter maken met SG ".sprintf("%.3f",floatval($row['starter_sg']));
-					$this->Checkline($s);
-					if ($row[$pt] == 0) {
-						$s = "ongeveer 24 uur op een magneetroerder";
-					} else if ($row[$pt] == 1) {
-						$s = "enkele dagen regelmatig schudden";
-					} else {
-						$s = "bijna een week rustig laten staan";
-					}
-					$s .= " tot er voldoende gist is";
-					$this->Checkline($s);
-					if ($i < $last) {
-						$this->Checkline("starter minstens 24 uur in de koeling laten uitzakken");
-						$this->Checkline("starter uit de koelkast halen en afgieten");
-					} else {
-						$this->Checkline("starter in de koeling zetten tot de brouwdag");
-						$this->Checkline("starter op de brouwdag uit de koelkast halen en afgieten");
-					}
-				}
-			}
-			$this->Ln(5);
-		}
-
-		$this->Checkheader('Water en -behandeling');
-		if ($row['w1_name']) {
-			$this->Checkline(sprintf("%.1f",floatval($row['w1_amount'] * $factor)).' liter water '.$row['w1_name']);
-			$mashwater += floatval($row['w1_amount'] * $factor);
-		}
-		if ($row['w2_name'] && floatval($row['w2_amount'])) {
-			$this->Checkline(sprintf("%.1f",floatval($row['w2_amount'] * $factor)).' liter water '.$row['w2_name']);
-			$mashwater += floatval($row['w2_amount'] * $factor);
-		}
-		foreach($miscs as $item) {
-			if ($item['m_type'] == 4) {	// Only the water agents
-				$unit = ($item['m_amount_is_weight']) ? " gr ":" ml ";
-				$this->Checkline(sprintf("%.2f",floatval($item['m_amount'] * 1000 * $factor)).$unit.$item['m_name']);
-				$numsalts++;
-			}
-		}
-		$this->Ln(5);
-
-		$this->Checkheader('Mout afwegen en schroten');
-		foreach($ferms as $item) {
-			if ($item['f_added'] == 0) {	// to mash
-				$s = sprintf("%.3f",floatval($item['f_amount'] * $factor)).' kg `';
-				$s .= iconv('UTF-8','windows-1252',$item['f_name']);
-				$s .= '` ('.iconv('UTF-8','windows-1252',$item['f_supplier']).')';
-				$this->Checkline($s);
-			}
-		}
-		$this->Checkline('mout schroten');
-		$this->Ln(5);
-
-		$this->Checkheader('Maischen');
-		$mvol = 0;
-		$msugars = 0;	// mash sugars
-		$grainabsorbtion = 0;
-		$arr = json_decode($row['json_mashs'], true);
-		if (count($arr) > 0) {
-			$loop = 0;
-			foreach($arr as $item) {
-				if ($item['step_type'] == 0)
-					$mvol += $item['step_infuse_amount'] * $factor;	// We need this later.
-				if ($loop == 0) {
-					if ($item['step_type'] == 0)
-						$l = $item['step_infuse_amount'] * $factor;
-					else
-						$l = $mashwater;
-					$s = sprintf("%.1f",$l).' liter water opwarmen tot ';
-					$s .= sprintf("%.1f",$item['step_infuse_temp']).DEG.'C (';
-					$s .= sprintf("%.1f",kettle_cm($l,$row['eq_tun_volume'],$row['eq_tun_height']));
-					$s .= ' cm onder de rand)';
-					$this->Checkline($s);
-					if ($numsalts > 0)
-						$this->Checkline('brouwzouten en -zuren toevoegen');
-					$this->Checkline('mout storten en inmaischen');
-					foreach($hops as $item2) {
-						if ($item2['h_useat'] == 0) {
-							$s = sprintf("%.1f",$item2['h_amount']*1000 * $factor).' gr `';
-							$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen';
-							$this->Checkline($s);
-						}
-					}
-					foreach($miscs as $item3) {
-						if ($item3['m_use_use'] == 1 && $item3['m_type'] != 4) {	// Only if not a water agent
-							$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-							$s = sprintf("%.2f",$item3['m_amount']*1000 * $factor).$unit.'`';
-							$s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` toevoegen';
-							$this->Checkline($s);
-						}
-					}
-					if ($item['step_temp'] != $item['end_temp']) {
-						$this->CheckInput($item['step_time'].' minuten bij '.$item['step_temp'].DEG.'C'.' tot '.$item['end_temp'].DEG.'C', 'Brix');
-					} else {
-						$this->CheckInput($item['step_time'].' minuten bij '.$item['step_temp'].DEG.'C', 'Brix');
-					}
-					$this->CheckInput('pH meten en bijstellen (doel pH beslag: '.sprintf("%.1f",$row['mash_ph']).' pH)', 'pH');
-				} else {
-					if ($item['step_type'] == 0) {	// Infusion
-						$s = 'toevoegen '.sprintf("%.1f",$item['step_infuse_amount'] * $factor).' liter water van ';
-						$s .= $item['step_infuse_temp'].DEG.'C';
-					} else if ($item['step_type'] == 1) {	// Direct heat
-						$s = 'opwarmen tot '.$item['step_temp'].DEG.'C';
-					} else {	// Decoction
-						$s = 'uitnemen, opwarmen, koken en terugstorten van '.sprintf("%.1f",$item['step_infuse_amount']*$factor);
-						$s .= ' liter deelbeslag';
-					}
-					$this->Checkline($s);
-					if ($item['step_temp'] != $item['end_temp']) {
-						$this->CheckInput($item['step_time'].' minuten bij '.$item['step_temp'].DEG.'C'.' tot '.$item['end_temp'].DEG.'C', 'Brix');
-					} else {
-						$this->CheckInput($item['step_time'].' minuten bij '.$item['step_temp'].DEG.'C', 'Brix');
-					}
-				}
-				$loop++;
-			}
-			$est_mash_sg = 0;
-			foreach($ferms as $item) {
-				if ($item['f_added'] == 0) {
-					$d = $item['f_amount'] * $factor * ($item['f_yield'] / 100) * (1 - $item['f_moisture'] / 100);
-					$mvol += $item['f_amount'] * $factor * $item['f_moisture'] / 100;
-					$grainabsorbtion += $my_grain_absorbtion * $item['f_amount'] * $factor;
-					$msugars += $d;
-				}
-			}
-			$sugardensity = 1.611;
-			$v = $msugars / $sugardensity + $mvol;
-			$plato = 1000 * $msugars / ($v * 10);	// deg. Plato
-			$mash_sg = plato_to_sg($plato);
-			$this->CheckInput('doel SG eind maischen: '.density_str($mash_sg), 'SG');
-		}
-		if ($this->GetY() > 200)
-			$this->AddPage();
-		else
-			$this->Ln(5);
-
-		$this->Checkheader('Filteren en spoelen');
-		$s = sprintf("%.1f",$row['sparge_volume'] * $factor).' liter spoelwater opwarmen tot '.sprintf("%.1f",$row['sparge_temp']).DEG.'C';
-		$this->Checkline($s);
-		$s = 'spoelwater aanzuren tot pH <= '.sprintf("%.1f",$row['sparge_ph']).' met ';
-		$s .= sprintf("%.2f",$row['sparge_acid_amount']*1000*$factor).' ml. '.$acidtype[$row['sparge_acid_type']];
-		$this->CheckInput($s, 'pH');
-		$spoelw = (($row['boil_size']*$factor) - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03;	// A small heat correction
-		$this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater');
-		$s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * $factor * 1.04).' liter (';
-		$s .= sprintf("%.1f",kettle_cm($row['boil_size'] * $factor * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)';
-		$this->CheckInput($s, 'cm');
-		$pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size'] * $factor));
-		$this->CheckInput('doel SG in kookketel: '.density_str($pre_sg), 'SG');
-		$this->CheckInput('', 'pH');
-		foreach($hops as $item2) {
-			if ($item2['h_useat'] == 1) {
-				$s = sprintf("%.1f",$item2['h_amount']*1000*$factor).' gr `';
-				$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen na het spoelen';
-				$this->Checkline($s);
-			}
-		}
-		if ($this->Checksplit(1, $row))
-			$factor = 1;
-		if ($this->GetY() > 200 && $row['boil_time'] > 0)
-			$this->AddPage();
-		else if ($this->GetY() > 270 && $row['boil_time'] == 0)
-			$this->AddPage();
-		else
-			$this->Ln(5);
-
-		$this->Checkheader('Koken');
-		if ($row['boil_time'] > 0) {
-			$this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
-			for ($i = $row['boil_time']; $i >= 0; $i--) {
-				if ($i == 10) {
-					foreach($ferms as $item1) {
-						if ($item1['f_added'] == 1) {
-							$s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
-							$s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij 10 minuten voor einde koken';
-							$this->Checkline($s);
-						}
-					}
-					if ($row['brew_cooling_method'] == 1)
-						$this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
-				}
-				foreach($hops as $item2) {
-					if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
-						$s = sprintf("%.2f",$item2['h_amount']*1000*$factor).' gr `';
-						$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
-						if ($i > 0)
-							$s .= $i.' minuten voor einde koken';
-						else
-							$s .= 'vlamuit';
-						$this->Checkline($s);
-					}
-				}
-				foreach($miscs as $item3) {
-					if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
-						$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-						$s = sprintf("%.2f",$item3['m_amount']*1000*$factor).$unit.'`';
-						$s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
-						if ($i > 0)
-							$s .= $i.' minuten voor einde koken';
-						else
-							$s .= 'vlamuit';
-						$this->Checkline($s);
-					}
-				}
-
-			}
-			$s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*$factor*1.04).' liter (';
-			$s .= sprintf("%.1f",kettle_cm($row['batch_size']*$factor*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
-			$s .= ' cm onder de rand)';
-			$this->CheckInput($s, 'cm');
-			$this->CheckInput('doel SG einde koken: '.density_str($row['est_og3']), 'SG');
-			$this->CheckInput('', 'pH');
-			if ($this->Checksplit(2, $row))
-				$factor = 1;
-		} else {
-			$this->Checkline('Dit is een `no-boil\' recept');
-		}
-		if ($this->GetY() > 200)
-			$this->AddPage();
-		else
-			$this->Ln(5);
-
-		if (($row['brew_whirlpool9'] + $row['brew_whirlpool7'] + $row['brew_whirlpool6'] + $row['brew_whirlpool2']) > 0) {
-			$this->Checkheader('Whirlpool en koelen');
-			if ($row['brew_whirlpool9'] > 0) {
-				$s = 'Whirlpool voor '.$row['brew_whirlpool9'].' min. Temperatuur boven 85'.DEG.'C houden';
-				$this->Checkline($s);
-			}
-			if ($row['brew_whirlpool7'] > 0) {
-				$this->Checkline('koelen tot 79'.DEG.'C');
-				$s = 'Whirlpool voor '.$row['brew_whirlpool7'].' min. Temperatuur tussen 72 en 79'.DEG.'C houden';
-				$this->Checkline($s);
-			}
-			if ($row['brew_whirlpool6'] > 0) {
-				$this->Checkline('koelen tot 66'.DEG.'C');
-				$s = 'Whirlpool voor '.$row['brew_whirlpool6'].' min. Temperatuur tussen 60 en 66'.DEG.'C houden';
-				$this->Checkline($s);
-			}
-			foreach($hops as $item2) {
-				if ($item2['h_useat'] == 4) {
-					$s = sprintf("%.1f",$item2['h_amount']*1000*$factor).' gr `';
-					$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor ';
-					$s .= $item2['h_time'].' minuten in de whirlpool';
-					$this->Checkline($s);
-				}
-			}
-			$this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).DEG.'C');
-			if ($row['brew_whirlpool2'] > 0) {
-				$s = 'Whirlpool voor '.$row['brew_whirlpool2'].' min.';
-				$this->Checkline($s);
-			}
-		} else {
-			$this->Checkheader('Koelen');
-			$this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).DEG.'C');
-		}
-		$this->Checkline('gistvat ontsmetten en evt. pomp en slangen ontsmetten');
-		$this->CheckInput('wort naar gistvat overbrengen', 'Liter');
-		if ($this->Checksplit(3, $row))
-			$factor = 1;
-		if ($this->GetY() > 240)
-			$this->AddPage();
-		else
-			$this->Ln(5);
-
-		$climate = $row['brew_cooling_to'];
-		$this->Checkheader('Gist enten');
-		$dry = 0;
-		foreach ($yeasts as $item) {
-			$name       = iconv('UTF-8','windows-1252',$item['y_name']);
-                        $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']);
-			if ($item['y_use'] == 0) { // primary
-				if ($item['y_form'] == 0) { // Liquid
-					$this->Checkline(($item['y_amount']*$factor).' pak '.$product_id.', '.$name.' gist');
-				} else if ($item['y_form'] == 1 || $item['y_form'] == 6) { // Dry or dried Kveik
-					$s = sprintf("%.1f",$item['y_amount']*$factor*1000).' gram '.$product_id.', '.$name;
-					$s .= ' gist';
-					if ($item['y_form'] == 1)
-						$dry += $item['y_amount']*$factor*10000;
-					$this->Checkline($s);
-				} else { // Slant/Culture/Frozen/Bottle
-					$s = sprintf("%.0f",$item['y_amount']*$factor*1000).' ml '.$product_id.', '.$name.' gist';
-					$this->Checkline($s);
-				}
-				if ($item['y_type'] == 6 && floatval($item['y_pitch_temperature']) > 0) {
-					$s = 'Gist enten bij ' . sprintf("%.1f",floatval($item['y_pitch_temperature'])).DEG.'C';
-					$this->Checkline($s);
-					$climate = $item['y_pitch_temperature'];
-				}
-			}
-		}
-		if ($dry > 0) {
-			$this->Checkline('Gist rechtstreeks over het wort strooien');
-		} else {
-			if ($row['starter_enable'] && $row['prop1_volume'])
-				$this->Checkline('giststarter toevoegen');
-			else
-				$this->Checkline('gist toevoegen');
-		}
-		if ($row['brew_fermenter_extrawater'] > 0)
-			$this->Checkline(sprintf("%.1f", $row['brew_fermenter_extrawater']*$factor).' liter water toevoegen in gistvat');
-		if ($row['brew_aeration_type'] > 0) {
-			$s = 'wort '.$row['brew_aeration_time'].' minuten beluchten met ';
-			$s .= ($row['brew_aeration_type'] == 1) ? "lucht":"zuurstof";
-			$this->Checkline($s);
-		}
-		if ($this->GetY() > 200)
-			$this->AddPage();
-		else
-			$this->Ln(5);
-
-		$this->Checkheader('Vergisting starten');
-		$this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$climate).DEG.'C');
-
-		/*
-		 * During primary fermentation: fermentables, misc
-		 */
-		$lines = 0;
-                foreach($ferms as $item1) {
-                        if ($item1['f_added'] == 2)
-				$lines++;
-		}
-                foreach($miscs as $item3) {
-                	if ($item3['m_use_use'] == 3)
-				$lines++;
-		}
-		if ($lines) {
-			if ($this->GetY() > (270 - (5 * $lines)))
-                        	$this->AddPage();
-                	else
-                        	$this->Ln(5);
-			$this->Checkheader('Hoofdgisting');
-		}
-		foreach($ferms as $item1) {
-                        if ($item1['f_added'] == 2) {
-				$s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
-                                $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` op dag 3 of 4 toevoegen';
-                                $this->Checkline($s);
-			}
-                }
-                foreach($miscs as $item3) {
-                        if ($item3['m_use_use'] == 3) {
-				$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-				$s = sprintf("%.1f",$item3['m_amount']*$factor*1000).$unit.'`';
-                                $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` op dag 3 of 4 toevoegen';
-                                $this->Checkline($s);
-			}
-                }
-		if ($this->Checksplit(4, $row))
-			$factor = 1;
-
-		/*
-		 * During secondary fermentation: yeast
-		 */
-		$lines = 0;
-                foreach ($yeasts as $item4) {
-                        if ($item4['y_use'] == 1)
-				$lines++;
-			if ($item4['y_harvest_time'] > 0)
-				$lines++;
-		}
-		if ($lines) {
-			if ($this->GetY() > (270 - (5 * $lines)))
-                        	$this->AddPage();
-                	else
-                        	$this->Ln(5);
-                        $this->Checkheader('Nagisting');
-                }
-		foreach ($yeasts as $item4) {
-                        if ($item4['y_use'] == 1) {
-				$name       = iconv('UTF-8','windows-1252',$item4['y_name']);
-                                $product_id = iconv('UTF-8','windows-1252',$item4['y_product_id']);
-				if ($item4['y_form'] == 0) { // Liquid
-                                        $this->Checkline(($item4['y_amount']*$factor).' pak '.$product_id.', '.$name.' gist (eventueel met starter)');
-                                } else if ($item['y_form'] == 1) { // Dry
-                                        $s = sprintf("%.1f",$item4['y_amount']*$factor*1000).' gram '.$product_id.', '.$name;
-                                        $s .= ' gist';
-                                        $this->Checkline($s);
-                                } else { // Slant/Culture/Frozen/Bottle
-                                        $s = sprintf("%.0f",$item4['y_amount']*$factor*1000).' ml '.$product_id.', '.$name.' gist (eventueel met starter)';
-                                        $this->Checkline($s);
-                                }
-			}
-			if ($item4['y_harvest_time'] > 0) {
-				$s = 'Na ' . $item4['y_harvest_time'] . ' uur gist oogsten vanaf de ';
-				if ($item4['y_harvest_top'] > 0)
-					$s .= 'bovenzijde';
-				else
-					$s .= 'bodem';
-				$this->Checkline($s);
-			}
-                }
-		if ($this->Checksplit(5, $row))
-			$factor = 1;
-
-		/*
-		 * During tertiary fermentation: fermentables, hop, yeast, misc
-		 */
-		$lines = 0;
-		foreach($ferms as $item1) {
-                        if ($item1['f_added'] == 3)
-                                $lines++;
-                }
-                foreach($hops as $item2) {
-                        if ($item2['h_useat'] == 5)
-				$lines++;
-		}
-                foreach ($yeasts as $item4) {
-                        if ($item4['y_use'] == 2)
-                                $lines++;
-                }
-                foreach($miscs as $item3) {
-                        if ($item3['m_use_use'] == 4)
-                                $lines++;
-                }
-		if ($lines) {
-			if ($this->GetY() > (270 - (5 * $lines)))
-                                $this->AddPage();
-                        else
-                                $this->Ln(5);
-                        $this->Checkheader('Lagering');
-                }
-		foreach($ferms as $item1) {
-                        if ($item1['f_added'] == 3) {
-                                $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
-                                $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` toevoegen';
-                                $this->Checkline($s);
-                        }
-                }
-		foreach($hops as $item2) {
-                        if ($item2['h_useat'] == 5) {
-                                $s = sprintf("%.1f",$item2['h_amount']*$factor*1000).' gr `';
-                                $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor ';
-				$s .= sprintf("%.0f",$item2['h_time']/1440).' dagen toevoegen';
-                                $this->Checkline($s);
-                        }
-                }
-		foreach ($yeasts as $item4) {
-                        if ($item4['y_use'] == 2) {
-				$name       = iconv('UTF-8','windows-1252',$item4['y_name']);
-                                $product_id = iconv('UTF-8','windows-1252',$item4['y_product_id']);
-                                if ($item4['y_form'] == 0) { // Liquid
-                                        $s = ($item4['y_amount']*$factor).' pak '.$product_id.', '.$name.' gist (eventueel met starter)';
-                                } else if ($item4['y_form'] == 1) { // Dry
-                                        $s = sprintf("%.1f",$item4['y_amount']*$factor*1000).' gram '.$product_id.', '.$name;
-                                        $s .= ' gist';
-                                } else { // Slant/Culture/Frozen/Bottle
-                                        $s = sprintf("%.0f",$item4['y_amount']*$factor*1000).' ml '.$product_id.', '.$name;
-					$s .= ' gist (eventueel met starter)';
-                                }
-				$this->Checkline($s);
-                        }
-                }
-		foreach($miscs as $item3) {
-                        if ($item3['m_use_use'] == 4) {
-				$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-                                $s = sprintf("%.1f",$item3['m_amount']*$factor*1000).$unit.'`';
-                                $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` voor ';
-				$s .= sprintf("%.0f",$item3['m_time']/1440).' dagen toevoegen';
-                                $this->Checkline($s);
-                        }
-                }
-		if ($this->Checksplit(6, $row))
-			$factor = 1;
-
-		/*
-		 * During packaging: fermentables, yeast, misc
-		 */
-		$lines = 0;
-		foreach($ferms as $item1) {
-                        if ($item1['f_added'] >= 4)
-                                $lines++;
-                }
-		$yeasts = json_decode($row['json_yeasts'], true);
-                foreach ($yeasts as $item4) {
-                        if ($item4['y_use'] == 3)
-                                $lines++;
-                }
-		$miscs = json_decode($row['json_miscs'], true);
-                foreach($miscs as $item3) {
-                        if ($item3['m_use_use'] == 5)
-                                $lines++;
-                }
-		if ($lines) {
-			if ($this->GetY() > (270 - (5 * $lines)))
-                                $this->AddPage();
-                        else
-                                $this->Ln(5);
-                        $this->Checkheader('Verpakken');
-                }
-		foreach($ferms as $item1) {
-                        if ($item1['f_added'] == 4) {
-                                $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
-                                $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`';
-				if ($row['bottle_priming_water'] > 0)
-					$s .= ' met '.sprintf("%.3f",$row['bottle_priming_water']*$factor).' liter water';
-				$s .= ' bij bottelen';
-                                $this->Checkline($s);
-                        }
-			if ($item1['f_added'] == 5) {
-                                $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
-                                $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`';
-				if ($row['keg_priming_water'] > 0)
-					$s .= ' met '.sprintf("%.3f",$row['keg_priming_water']*$factor).' liter water';
-				$s .= ' bij op fust zetten';
-                                $this->Checkline($s);
-                        }
-                }
-		foreach ($yeasts as $item4) {
-                        if ($item4['y_use'] == 3) {
-				$name       = iconv('UTF-8','windows-1252',$item4['y_name']);
-                        	$product_id = iconv('UTF-8','windows-1252',$item4['y_product_id']);
-                                if ($item4['y_form'] == 0) { // Liquid
-                                        $s = '`'.$product_id.', '.$name;
-                                } else if ($item4['y_form'] == 1) { // Dry
-                                        $s = sprintf("%.1f",$item4['y_amount']*$factor*1000).' gram `'.$product_id.', '.$name;
-                                } else { // Slant/Culture/Frozen/Bottle
-                                        $s = sprintf("%.0f",$item4['y_amount']*$factor*1000).' ml `'.$product_id.', '.$name;
-                                }
-				$s .= '` als bottelgist';
-				$this->Checkline($s);
-                        }
-                }
-		foreach($miscs as $item3) {
-                        if ($item3['m_use_use'] == 5) {
-				$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-                                $s = sprintf("%.1f",$item3['m_amount']*$factor*1000).$unit.'`';
-                                $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij bottelen toevoegen';
-                                $this->Checkline($s);
-                        }
-                }
-	}
-}
-
-
-
-class PDF extends PDF_MySQL_Table {
-	function Header() {
-		global $row;
-		global $prdate;
-		global $stage;
-		$this->Image('images/logo.png',10,10,30);
-		// Title
-		$this->SetFont('Helvetica','B',18);
-		$this->SetX(45);
-		$this->Cell(0,8,$row['code'].' '.$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->SetX(45);
-		$this->Cell(17,5,'Fase:',0,0,'L');
-		$this->Cell(0,5,$stage[$row['stage']],0,1,'L');
-		$this->SetX(45);
-                $this->Cell(17,5,'Batch:',0,0,'L');
-                if ($row['divide_parts'] == 0)
-                        $this->Cell(0,5,"Niet gespitst",0,1,'L');
-                else
-                        $this->Cell(0,5,"Split batch ".($row['divide_part'] + 1)." van ".($row['divide_parts'] + 1),0,1,'L');
-                $this->Ln(2);
-		// Ensure table header is printed
-		parent::Header();
-	}
-}
-
-
-/*
- * Generate checklist PDF from recipe data
- */
-$pdf = new PDF();
-$pdf->Checklist($row);
-$pdf->Output();
--- a/www/prod_divide.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Product splitsen', 'prod_divide');
-?>
-
-   <div id="MainPanel">
-    <div style="overflow: hidden;" id='divide_table'>
-     <table style='width: 100%; padding: 10px;'>
-      <tr><th colspan="4">Splits product</th></tr>
-      <tr><td colspan="4">&nbsp;</td></tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Product naam:</td>
-       <td align="left" style="vertical-align: top; padding: 3px;"><input id="name" readonly /></td>
-       <td align="right" style="vertical-align: top;">Huidige brouw fase:</td>
-       <td align="left" style="vertical-align: top; padding: 3px;"><input id="stage" readonly /></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Product code:</td>
-       <td align="left" style="vertical-align: top; padding: 3px;"><input id="code" readonly /></td>
-       <td align="right" style="vertical-align: top;">Splits moment:</td>
-       <td align="left" style="vertical-align: top; padding: 3px;"><div id='divide_type'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Beschikbaar L:</td>
-       <td align="left" style="vertical-align: top; padding: 3px;"><div id="available"></div></td>
-       <td align="right" style="vertical-align: top;">Blijft over L:</td>
-       <td align="left" style="vertical-align: top; padding: 3px;"><div id='leftover'></div></td>
-      </tr>
-      <tr><td colspan="4">&nbsp;</td></tr>
-      <tr>
-       <td align="center" colspan="4"><div id="splitGrid"></div></td>
-      </tr>
-     </table>
-     <div style="float: right; margin-top: 10px; margin-bottom: 5px;">
-      <input style="margin-right: 100px;" type="button" id="Save"   value="Save" />
-      <input style="margin-right: 520px;" type="button" id="Cancel" value="Cancel" />
-     </div>
-    </div>
-   </div>
-
-<?php
-page_footer();
-?>
--- a/www/prod_duplicate.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,227 +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 products WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-/*
- * Make this duplicate a fresh product.
- */
-$sql  = "INSERT INTO `products` 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 .= "', code='" . mysqli_real_escape_string($link, $row['code']) . '-DuP';
-$sql .= "', birth='" . date("Y-m-d");
-$sql .= "', stage='1";
-$sql .= "', notes='" . mysqli_real_escape_string($link, $row['notes']);
-$sql .= "', log_brew='0";
-$sql .= "', log_fermentation='0";
-$sql .= "', log_ispindel='0";
-$sql .= "', log_co2pressure='0";
-$sql .= "', inventory_reduced='0";
-$sql .= "', locked='0";
-// Equipment
-$sql .= "', eq_name='" . mysqli_real_escape_string($link, $row['eq_name']);
-$sql .= "', eq_boil_size='" . $row['eq_boil_size'];
-$sql .= "', eq_batch_size='" . $row['eq_batch_size'];
-$sql .= "', eq_tun_volume='" . $row['eq_tun_volume'];
-$sql .= "', eq_tun_weight='" . $row['eq_tun_weight'];
-$sql .= "', eq_tun_specific_heat='" . $row['eq_tun_specific_heat'];
-$sql .= "', eq_tun_material='" . $row['eq_tun_material'];
-$sql .= "', eq_tun_height='" . $row['eq_tun_height'];
-$sql .= "', eq_top_up_water='" . $row['eq_top_up_water'];
-$sql .= "', eq_trub_chiller_loss='" . $row['eq_trub_chiller_loss'];
-$sql .= "', eq_evap_rate='" . $row['eq_evap_rate'];
-$sql .= "', eq_boil_time='" . $row['eq_boil_time'];
-$sql .= "', eq_calc_boil_volume='" . $row['eq_calc_boil_volume'];
-$sql .= "', eq_top_up_kettle='" . $row['eq_top_up_kettle'];
-$sql .= "', eq_hop_utilization='" . $row['eq_hop_utilization'];
-$sql .= "', eq_notes='" . mysqli_real_escape_string($link, $row['eq_notes']);
-$sql .= "', eq_lauter_volume='" . $row['eq_lauter_volume'];
-$sql .= "', eq_lauter_height='" . $row['eq_lauter_height'];
-$sql .= "', eq_lauter_deadspace='" . $row['eq_lauter_deadspace'];
-$sql .= "', eq_kettle_volume='" . $row['eq_kettle_volume'];
-$sql .= "', eq_kettle_height='" . $row['eq_kettle_height'];
-$sql .= "', eq_mash_volume='" . $row['eq_mash_volume'];
-$sql .= "', eq_mash_max='" . $row['eq_mash_max'];
-$sql .= "', eq_efficiency='" . $row['eq_efficiency'];
-// brewdate
-$sql .= "', brew_date_start=NULL";
-$sql .=  ", brew_mash_ph='0.0";
-$sql .= "', brew_mash_sg='1.000";
-$sql .= "', brew_sparge_ph='" . $row['brew_sparge_ph'];
-$sql .= "', brew_preboil_volume='0";
-$sql .= "', brew_preboil_sg='0";
-$sql .= "', brew_preboil_ph='0.0";
-$sql .= "', brew_aboil_volume='0";
-$sql .= "', brew_aboil_sg='0";
-$sql .= "', brew_aboil_ph='0.0";
-$sql .= "', brew_aboil_efficiency='0";
-$sql .= "', brew_cooling_method='" . $row['brew_cooling_method'];
-$sql .= "', brew_cooling_time='0";
-$sql .= "', brew_cooling_to='" . $row['brew_cooling_to'];
-$sql .= "', brew_whirlpool9='" . $row['brew_whirlpool9'];
-$sql .= "', brew_whirlpool7='" . $row['brew_whirlpool7'];
-$sql .= "', brew_whirlpool6='" . $row['brew_whirlpool6'];
-$sql .= "', brew_whirlpool2='" . $row['brew_whirlpool2'];
-$sql .= "', brew_aeration_time='" . $row['brew_aeration_time'];
-$sql .= "', brew_aeration_speed='" . $row['brew_aeration_speed'];
-$sql .= "', brew_aeration_type='" . $row['brew_aeration_type'];
-$sql .= "', brew_fermenter_volume='" . $row['brew_fermenter_volume'];
-$sql .= "', brew_fermenter_extrawater='" . $row['brew_fermenter_extrawater'];
-$sql .= "', brew_fermenter_tcloss='" . $row['brew_fermenter_tcloss'];
-$sql .= "', brew_fermenter_sg='0";
-$sql .= "', brew_fermenter_ibu='0";
-$sql .= "', brew_fermenter_color='0";
-$sql .= "', brew_date_end=NULL";
-$sql .=  ", og='0";
-$sql .= "', fg='0";
-$sql .= "', primary_start_temp='0";
-$sql .= "', primary_max_temp='0";
-$sql .= "', primary_end_temp='0";
-$sql .= "', primary_end_date=NULL";
-$sql .=  ", primary_end_sg='0";
-$sql .= "', secondary_temp='0";
-$sql .= "', secondary_end_sg='0";
-$sql .= "', secondary_end_date=NULL";
-$sql .=  ", tertiary_temp='0";
-$sql .= "', package_date=NULL";
-$sql .=  ", package_volume='" . $row['package_volume'];
-$sql .= "', package_infuse_amount='" . $row['package_infuse_amount'];
-$sql .= "', package_infuse_abv='" . $row['package_infuse_abv'];
-$sql .= "', package_infuse_notes='" . mysqli_real_escape_string($link, $row['package_infuse_notes']);
-$sql .= "', package_abv='0";
-$sql .= "', package_ph='0";
-$sql .= "', bottle_amount='0";
-$sql .= "', bottle_carbonation='" . $row['bottle_carbonation'];
-$sql .= "', bottle_priming_water='" . $row['bottle_priming_water'];
-$sql .= "', bottle_priming_amount='0";
-$sql .= "', bottle_carbonation_temp='" . $row['bottle_carbonation_temp'];
-$sql .= "', keg_amount='0";
-$sql .= "', keg_carbonation='" . $row['keg_carbonation'];
-$sql .= "', keg_priming_water='" . $row['keg_priming_water'];
-$sql .= "', keg_priming_amount='0";
-$sql .= "', keg_carbonation_temp='" . $row['keg_carbonation_temp'];
-$sql .= "', keg_forced_carb='" . $row['keg_forced_carb'];
-$sql .= "', keg_pressure='" . $row['keg_pressure'];
-$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_fg='0.000";
-$sql .= "', est_abv='0.0";
-$sql .= "', est_carb='0";
-$sql .= "', est_color='0";
-$sql .= "', color_method='" . $row['color_method'];
-$sql .= "', est_ibu='0";
-$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 .= "', starter_enable='" . $row['starter_enable'];
-$sql .= "', starter_type='" . $row['starter_type'];
-$sql .= "', starter_sg='" . $row['starter_sg'];
-$sql .= "', starter_viability='97";
-$sql .= "', prop1_type='" . $row['prop1_type'];
-$sql .= "', prop1_volume='" . $row['prop1_volume'];
-$sql .= "', prop2_type='" . $row['prop2_type'];
-$sql .= "', prop2_volume='" . $row['prop2_volume'];
-$sql .= "', prop3_type='" . $row['prop3_type'];
-$sql .= "', prop3_volume='" . $row['prop3_volume'];
-$sql .= "', prop4_type='" . $row['prop4_type'];
-$sql .= "', prop4_volume='" . $row['prop4_volume'];
-$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 .= "';";
-
-$result = mysqli_query($link, $sql);
-if (! $result) {
-	syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($link));
-	syslog(LOG_NOTICE, $sql);
-} else {
-	$lastid = mysqli_insert_id($link);
-	syslog(LOG_NOTICE, "db_product: inserted record ".$lastid);
-}
-echo "<script>window.close();</script>";
-exit;
--- a/www/prod_edit.php	Fri Aug 05 11:02:01 2022 +0200
+++ b/www/prod_edit.php	Fri Aug 05 12:12:53 2022 +0200
@@ -115,7 +115,6 @@
        </tr>
       </table>
       <div style="float: right; margin-top: 20px; margin-bottom: 5px;">
-       <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" />
--- a/www/prod_export.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Product export', 'prod_export');
-?>
-
-   <div id="MainPanel">
-    <div id='export_table'>
-     <table style='width: 100%; padding: 10px;'>
-      <tr><th colspan=2>Export product</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;">Code:</td>
-       <td align="left"><div style='margin-left: 10px;' id='code'></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 product:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton2'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;"><div id='pmpt3'>Splits dit product:</div></td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton3'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Copieer als recept:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton4'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Print dit recept:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton5'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Checklist van recept:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton6'></div></td>
-      </tr>
-      <tr>
-       <td align="right" style="vertical-align: top;">Export voor forum:</td>
-       <td align="left"><div style='margin-left: 10px;' id='jqxRadioButton7'></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/prod_forum.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +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 products 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['code'].' '.$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) {
-	if ($item['m_use_use'] == 2)      // Boil
-        	$gebruik = sprintf("%s %d min",$miscuse[$item['m_use_use']],floatval($item['m_time']));
-        else
-        	$gebruik = $miscuse[$item['m_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;
-$memo .= $rows.$datas.'Spoelwater geschat'.$datae.$datas.sprintf("%.1f",$row['brew_sparge_est'])." 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('Product naar forum', 'prod_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 product 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/prod_impbrew.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Product brouwlog import', 'prod_impbrew');
-?>
-
-   <div id="MainPanel">
-    <div style="float: left; margin-left: 240px; margin-top: 50px;">
-     <div align="center">Brouw log bestanden upload.</div><br>
-     <div id="eventsPanel"> </div>
-     <div style="float: left; margin-top: 10px;" id="jqxFileUpload"> </div>
-    </div>
-   </div>
-
-<?php
-page_footer();
-?>
--- a/www/prod_print.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1293 +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 products 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;
-$mashkg = 0;
-date_default_timezone_set('Europe/Amsterdam');
-$prdate = date(DATE_RFC2822);
-$bottle_sugar = '';
-$keg_sugar = '';
-$bottle_sugar_amount = 0;
-$keg_sugar_amount = 0;
-$est_mash_sg = 0;
-
-$divide_parts = $row['divide_parts'];
-$divide_part = $row['divide_part'];
-$divide_factor = floatval($row['divide_factor']);
-
-
-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) {
-		global $recipetype;
-                global $divide_parts;
-                global $divide_part;
-		global $divide_factor;
-		global $splitat;
-		/* 2 Columns */
-		$vul = $this->w - $this->rMargin - $this->lMargin - 160;
-		$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,'Brouw type',0,0,'L',true);
-		$this->Cell(45,5,$recipetype[$row['type']],0,0,'L',true);
-		$this->Cell($vul,5,'',0,0,'L',false);
-		$this->Cell(35,5,'Batch grootte',0,0,'L',true);
-		if ($divide_parts == 0)
-			$this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true);
-		else
-			$this->Cell(45,5,$row['batch_size'].' van '.sprintf("%.2f", ($row['batch_size'] * (1 / $divide_factor))).' liter',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell(35,5,'Kooktijd',0,0,'L',true);
-		$this->Cell(45,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(45,5,$row['efficiency'].' %',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell(35,5,'Bierstijl',0,0,'L',true);
-		$st_name = iconv('UTF-8','windows-1252',$row['st_name']);
-		$this->Cell(45,5,$st_name,0,0,'L',true);
-		$this->Cell($vul,5,'',0,0,'L',false);
-		$this->Cell(35,5,'Installatie',0,0,'L',true);
-		$this->Cell(45,5,$row['eq_name'],0,0,'L',true);
-		$this->Ln();
-
-		if ($divide_parts) {
-                	$this->SetX($this->TableX);
-                	$this->Cell(35,5,'Batch splits moment',0,0,'L',true);
-                	$this->Cell(45,5,$splitat[$row['divide_type']],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 $mashkg;
-		global $bottle_sugar;
-		global $bottle_sugar_amount;
-		global $keg_sugar;
-		global $keg_sugar_amount;
-		global $added;
-		global $fermentabletype;
-		global $graintype;
-		global $est_mash_sg;
-		$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;
-		$mashkg = 0;
-		$s = 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']]);
-
-			if ($item['f_added'] == 4) {
-				$bottle_sugar = $name;
-				$bottle_sugar_amount = $amount;
-			}
-			if ($item['f_added'] == 5) {
-				$keg_sugar = $name;
-				$keg_sugar_amount = $amount;
-			}
-
-			$cost = $amount * $costkg;
-			$cost_fermentables += $cost;
-			$total_fermentables += $amount;
-			/* Calculate the amount of sugars */
-			$d = $amount * ($yield / 100) * (1 - $moisture / 100);
-			if ($item['f_added']  == 0) {
-				$s += $d;
-				$d = floatval($row['efficiency']) / 100 * $d;
-				$sugarsm += $d;
-				$mashkg += $amount;
-			}
-			$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);
-			if ($item['f_added'] < 4)
-				$this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true);
-			else
-				$this->Cell(15,5,' ',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();
-		}
-		$v = $s / 1.611 + $row['wg_amount'];
-		$s = 1000 * $s / ($v * 10);	//deg. Plato
-		$est_mash_sg = plato_to_sg($s);
-		$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();
-		}
-		if ($row['starter_enable'] && $row['prop1_volume']) {
-			$sv = 0;
-			$st = 0;
-        		for ($i = 1; $i < 5; $i++) {
-                		$pv = "prop".$i."_volume";
-                		if (floatval($row[$pv])) {
-					$st++;
-					if (floatval($row[$pv]) > $sv)
-                        			$sv = floatval($row[$pv]);
-                		}
-        		}
-			$this->Cell($vul,5,$st." staps giststarter",0,0,'L',true);
-			$this->Cell(40,5,'',0,0,'R',true);
-			$this->Cell(30,5,"Vooraf",0,0,'L',true);
-			$this->Cell(20,5,sprintf("%.3f",$sv)." L",0,0,'R',true);
-			$this->Cell(20,5,'',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,'Diversen 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("%.2f %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();
-		if ($row['w2_name'] && floatval($row['w2_amount'])) {
-			$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 $mashkg;
-		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);
-
-		$mashtime = 0;
-		$mashtemp = 0;
-		$mash_infuse = 0;
-		$arr = json_decode($row['json_mashs'], true);
-		foreach($arr as $item) {
-			if ($item['step_type'] == 0) { // infusion
-				$mash_infuse += floatval($item['step_infuse_amount']);
-			}
-			if ($item['step_temp'] < 75) { // ignore mashout temps
-				$mashtime += floatval($item['step_time']);
-				$mashtemp += floatval($item['step_time']) * floatval($item['step_temp']);
-			}
-		}
-		$mashtemp = $mashtemp / $mashtime;
-		if (($mashkg > 0) && ($mash_infuse > 0) && ($mashtime > 0) && ($mashtemp > 0)) {
-			$row['est_fg'] = estimate_fg($pSugar, $pCara, $mash_infuse / $mashkg, $mashtime, $mashtemp, $svg, $row['est_og']);
-		} else {
-			$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,'Flessen CO2',0,0,'L',true);
-		$this->Cell(25,5,sprintf("%.1f",$row['bottle_carbonation']).'%',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,'Fusten CO2',0,0,'L',true);
-		$this->Cell(25,5,sprintf("%.1f",$row['keg_carbonation']).'%',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();
-
-		$this->SetX($this->TableX);
-		$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->Cell($vul,5,'',0,0,'L',false);
-		$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();
-	}
-
-	function PrintDiff($v1, $v2, $decimals, $un) {
-
-		$val1 = floatval($v1);
-		$val2 = floatval($v2);
-		if ($val2 > $val1)
-			$diff = '+' . number_format($val2 - $val1, $decimals) . $un;
-		else
-			$diff = number_format($val2 - $val1, $decimals) . $un;
-		$this->Cell(30,5,$diff,0,0,'L',true);
-	}
-
-	function Brewday($row) {
-
-		global $my_brix_correction;
-		global $my_grain_absorbtion;
-		global $coolingtype;
-		global $aerationtype;
-		global $est_mash_sg;
-		global $mashtype;
-		if ($this->GetY() > 100)
-                        $this->AddPage();
-                else
-                        $this->Ln(10);
-
-		$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, 'Brouwdag gegevens',0,0,'C',true);
-		$this->Ln();
-
-		$this->SetFont('Helvetica','',9);
-        	$this->SetFillColor(210,245,255);
-        	$this->SetX($this->TableX);
-        	$this->Cell(35,5,'Datum start',0,0,'L',true);
-        	$this->Cell(50,5,$row['brew_date_start'],0,0,'L',true);
-        	$this->Cell($vul,5,'',0,0,'L',false);
-		$this->Cell(35,5,'Datum eind',0,0,'L',true);
-		$this->Cell(50,5,$row['brew_date_end'],0,0,'L',true);
-		$this->Ln(10);
-
-		$domash = 0;
-		$arr = json_decode($row['json_mashs'], true);
-		foreach($arr as $item) {
-			if ($item['step_sg'] > 1.005)
-				$domash = 1;
-		}
-		if ($domash) {
-			$this->SetX($this->TableX);
-			$this->SetFont('Helvetica','B',9);
-			$this->SetFillColor(175,175,255);
-			$vul = $this->w - $this->rMargin - $this->lMargin - 125;
-			$this->Cell(5, 5, '',0,0,'L',true);
-			$this->Cell($vul,5, 'Maisch stap',0,0,'L',true);
-			$this->Cell(30,5, 'Type',0,0,'L',true);
-			$this->Cell(30,5, 'Temperatuur',0,0,'L',true);
-			$this->Cell(30,5, 'SG',0,0,'L',true);
-			$this->Cell(30,5, 'pH',0,0,'L',true);
-			$this->Ln();
-			$this->SetFont('Helvetica','',9);
-			$this->SetFillColor(210,245,255);
-			$arr = json_decode($row['json_mashs'], true);
-			$step = 0;
-			foreach($arr as $item) {
-				$step++;
-				$this->Cell(5,5,$step,0,0,'L',true);
-				$this->Cell($vul,5,$item['step_name'],0,0,'L',true);
-				$this->Cell(30,5,$mashtype[$item['step_type']],0,0,'L',true);
-				$this->Cell(30,5,sprintf("%.1f",$item['step_temp']).'-'.sprintf("%.1f",$item['end_temp']).DEG.'C',0,0,'L',true);
-				$this->Cell(30,5,sprintf("%.3f",$item['step_sg']),0,0,'L',true);
-				$this->Cell(30,5,sprintf("%.2f",$item['step_ph']),0,0,'L',true);
-				$this->Ln();
-			}
-			$this->Ln();
-		}
-
-		$this->SetX($this->TableX);
-		$this->SetFont('Helvetica','B',9);
-		$this->SetFillColor(175,175,255);
-		$vul = $this->w - $this->rMargin - $this->lMargin - 130;
-		$this->Cell($vul, 5, 'Gegeven',0,0,'L',true);
-		$this->Cell(50, 5, 'Gewenst',0,0,'L',true);
-		$this->Cell(50, 5, 'Werkelijk',0,0,'L',true);
-		$this->Cell(30, 5, 'Verschil',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->SetFont('Helvetica','',9);
-                $this->SetFillColor(210,245,255);
-        	$this->Cell($vul,5,'Maisch zuurgraad',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", $row['mash_ph']).' pH',0,0,'L',true);
-        	$this->Cell(50,5,sprintf("%.2f", $row['brew_mash_ph']).' pH',0,0,'L',true);
-		$this->PrintDiff($row['mash_ph'], $row['brew_mash_ph'], 2, ' pH');
-        	$this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Maisch densiteit',0,0,'L',true);
-		$this->Cell(50,5,density_str(floatval($est_mash_sg)),0,0,'L',true);
-                $this->Cell(50,5,density_str(floatval($row['brew_mash_sg'])),0,0,'L',true);
-		$this->PrintDiff($est_mash_sg, $row['brew_mash_sg'], 3, ' SG');
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Maisch rendement',0,0,'L',true);
-                $this->Cell(50,5,'100.0%',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_mash_efficiency']))."%",0,0,'L',true);
-		$this->PrintDiff(100.0, $row['brew_mash_efficiency'], 1, '%');
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Spoelwater zuurgraad',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", $row['sparge_ph']).' pH',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.2f", $row['brew_sparge_ph']).' pH',0,0,'L',true);
-		$this->PrintDiff($row['sparge_ph'], $row['brew_sparge_ph'], 2, ' pH');
-		$this->Ln(7);
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Voor koken zuurgraad',0,0,'L',true);
-		$this->Cell(50,5,'',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.2f", $row['brew_preboil_ph'])." pH",0,0,'L',true);
-		$this->Cell(30,5,'',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Voor koken densiteit',0,0,'L',true);
-		$this->Cell(50,5,'',0,0,'L',true);
-		$this->Cell(50,5,density_str(floatval($row['brew_preboil_sg'])),0,0,'L',true);
-		$this->Cell(30,5,'',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Voor koken volume',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", $row['boil_size'] * 1.04)." liter",0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_volume'])." liter",0,0,'L',true);
-		$this->PrintDiff($row['boil_size'] * 1.04, $row['brew_preboil_volume'], 1, ' liter');
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Voor koken rendement',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['efficiency']))."%",0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_preboil_efficiency']))."%",0,0,'L',true);
-		$this->PrintDiff($row['efficiency'], $row['brew_preboil_efficiency'], 1, '%');
-		$this->Ln(7);
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Na koken zuurgraad',0,0,'L',true);
-		$this->Cell(50,5,'',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.2f", $row['brew_aboil_ph'])." pH",0,0,'L',true);
-		$this->Cell(30,5,'',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Na koken densiteit',0,0,'L',true);
-		$this->Cell(50,5,density_str(floatval($row['est_og'])),0,0,'L',true);
-                $this->Cell(50,5,density_str(floatval($row['brew_aboil_sg'])),0,0,'L',true);
-		$this->PrintDiff($row['est_og'], $row['brew_aboil_sg'], 3, ' SG');
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Na koken volume',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", $row['batch_size'] * 1.04)." liter",0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_volume'])." liter",0,0,'L',true);
-		$this->PrintDiff($row['batch_size'] * 1.04, $row['brew_aboil_volume'], 1, ' liter');
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell($vul,5,'Na koken rendement',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['efficiency']))."%",0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_aboil_efficiency']))."%",0,0,'L',true);
-		$this->PrintDiff($row['efficiency'], $row['brew_aboil_efficiency'], 1, '%');
-                $this->Ln(7);
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Koeler & trub verlies',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['eq_trub_chiller_loss'])).' liter',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_tcloss'])).' liter',0,0,'L',true);
-		$this->PrintDiff($row['eq_trub_chiller_loss'], $row['brew_fermenter_tcloss'], 1, ' lter');
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Extra water in gistvat',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['eq_top_up_water'])).' liter',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_extrawater'])).' liter',0,0,'L',true);
-		$this->PrintDiff($row['eq_top_up_water'], $row['brew_fermenter_extrawater'], 1, ' liter');
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Volume naar gistvat',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['batch_size']) - floatval($row['eq_trub_chiller_loss'])).' liter',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_volume'])).' liter',0,0,'L',true);
-		$this->PrintDiff(floatval($row['batch_size']) - floatval($row['eq_trub_chiller_loss']), $row['brew_fermenter_volume'], 1, ' liter');
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Densiteit in gistvat',0,0,'L',true);
-		$this->Cell(50,5,density_str(floatval($row['est_og'])),0,0,'L',true);
-		$this->Cell(50,5,density_str(floatval($row['brew_fermenter_sg'])),0,0,'L',true);
-		$this->PrintDiff($row['est_og'], $row['brew_fermenter_sg'], 3, ' SG');
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Kleur in gistvat',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.0f", floatval($row['est_color'])).' EBC',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_color'])).' EBC',0,0,'L',true);
-		$this->PrintDiff($row['est_color'], $row['brew_fermenter_color'], 0, ' EBC');
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Bitterheid in gistvat',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.0f", floatval($row['est_ibu'])).' IBU',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_ibu'])).' IBU',0,0,'L',true);
-		$this->PrintDiff($row['est_ibu'], $row['brew_fermenter_ibu'], 0, ' IBU');
-		$this->Ln(7);
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Koelen methode',0,0,'L',true);
-		$this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Koelen temperatuur',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_cooling_to'])).DEG.'C',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell($vul,5,'Koelen tijdsduur',0,0,'L',true);
-		$this->Cell(50,5,sprintf("%.0f", floatval($row['brew_cooling_time'])).' minuten',0,0,'L',true);
-		$this->Ln(7);
-	}
-
-	function Fermentation($row) {
-		
-		if ($this->GetY() > 230)
-                        $this->AddPage();
-                else
-                        $this->Ln(10);
-
-                $vul = $this->w - $this->rMargin - $this->lMargin - 180;
-                $cMargin=$this->cMargin;
-                $this->cMargin=2;
-                $this->TableX=$this->lMargin;
-                $this->SetFont('Helvetica','B',9);
-                $this->SetX($this->TableX);
-                $this->SetFillColor(255,150,100);
-                $this->Cell(0, 5, 'Vergisting gegevens',0,0,'C',true);
-                $this->Ln();
-
-		$this->SetFont('Helvetica','',9);
-                $this->SetFillColor(210,245,255);
-
-                $this->SetX($this->TableX);
-                $this->Cell(45,5,'Hoofdvergisting start temp.',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['primary_start_temp']).DEG.'C',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Hoofdvergisting piek temp.',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['primary_max_temp']).DEG.'C',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Hoofdvergisting eind temp.',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['primary_end_temp']).DEG.'C',0,0,'L',true);
-		$this->Cell($vul,5,'',0,0,'L',false);
-		$this->Cell(45,5,'Hoofdvergisting densiteit',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.3f",floatval($row['primary_end_sg'])).' SG',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell(45,5,'Hoofdvergisting einde',0,0,'L',true);
-                $this->Cell(45,5,$row['primary_end_date'],0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell(45,5,'Navergisting tempertuur',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f", $row['secondary_temp']).DEG.'C',0,0,'L',true);
-		$this->Cell($vul,5,'',0,0,'L',false);
-		$this->Cell(45,5,'Nagisten densiteit',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.3f",floatval($row['secondary_end_sg'])).' SG',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Nagisten einde',0,0,'L',true);
-                $this->Cell(45,5,$row['secondary_end_date'],0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell(45,5,'Lageren temperatuur',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['tertiary_temp']).DEG.'C',0,0,'L',true);
-		$this->Cell($vul,5,'',0,0,'L',false);
-		$this->Cell(45,5,'Lageren densiteit',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.3f",floatval($row['fg'])).' SG',0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Lageren einde',0,0,'L',true);
-                $this->Cell(45,5,$row['package_date'],0,0,'L',true);
-		$this->Cell($vul,5,'',0,0,'L',false);
-		$svg = calc_svg(floatval($row['brew_fermenter_sg']), floatval($row['fg']));
-		$this->Cell(45,5,'Schijnbare vergistingsgraad',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$svg).'%',0,0,'L',true);
-                $this->Ln();
-	}
-
-	function Packaging($row) {
-
-		global $bottle_sugar;
-		global $bottle_sugar_amount;
-		global $keg_sugar;
-		global $keg_sugar_amount;
-
-		if ($this->GetY() > 230)
-                        $this->AddPage();
-                else
-                        $this->Ln(10);
-
-                $vul = $this->w - $this->rMargin - $this->lMargin - 180;
-                $cMargin=$this->cMargin;
-                $this->cMargin=2;
-                $this->TableX=$this->lMargin;
-                $this->SetFont('Helvetica','B',9);
-                $this->SetX($this->TableX);
-                $this->SetFillColor(255,150,100);
-                $this->Cell(0, 5, 'Verpakken',0,0,'C',true);
-                $this->Ln();
-
-                $this->SetFont('Helvetica','',9);
-                $this->SetFillColor(210,245,255);
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Datum verpakken',0,0,'L',true);
-                $this->Cell(45,5,$row['package_date'],0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Hoeveelheid',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f", $row['package_volume']).' liter',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Alcohol volume',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['package_abv']).'%',0,0,'L',true);
-		if (($row['package_infuse_amount'] > 0) && ($row['package_infuse_abv'] == 0)) {
-			$this->Cell($vul,5,'',0,0,'L',false);
-                	$this->Cell(45,5,'Water toevoegen',0,0,'L',true);
-                	$this->Cell(45,5,sprintf("%.1f", $row['package_infuse_amount']).' liter',0,0,'L',true);
-		}
-		$this->Ln(7);
-
-		if (($row['package_infuse_amount'] > 0) && ($row['package_infuse_abv'] > 0)) {
-			$this->SetX($this->TableX);
-                	$this->Cell(45,5,'Drank toevoegen',0,0,'L',true);
-                	$this->Cell(45,5,sprintf("%.1f",$row['package_infuse_amount']).' liter',0,0,'L',true);
-			$this->Cell($vul,5,'',0,0,'L',false);
-                        $this->Cell(45,5,'Bevat alcohol volume',0,0,'L',true);
-                        $this->Cell(45,5,sprintf("%.1f", $row['package_infuse_abv']).'%',0,0,'L',true);
-			$this->Ln();
-
-			$this->SetX($this->TableX);
-        		$this->Cell(180,5,iconv('UTF-8','windows-1252',$row['package_infuse_notes']),0,0,'L',true);	
-			$this->Ln(7);
-		}
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Flessen volume',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['bottle_amount']).' liter',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Fusten volume',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f", $row['keg_amount']).' liter',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'CO2 volumes',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.2f",$row['bottle_carbonation']),0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'CO2 volumes',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.2f", $row['keg_carbonation']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Suiker',0,0,'L',true);
-                $this->Cell(45,5,$bottle_sugar,0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Suiker',0,0,'L',true);
-                $this->Cell(45,5,$keg_sugar,0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Hoeveelheid',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['bottle_priming_amount']).' gram/liter',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-		if ($row['keg_forced_carb']) {
-			$this->Cell(45,5,'Geforceerd op druk zetten',0,0,'L',true);
-			$this->Cell(45,5,'Ja',0,0,'L',true);
-		} else {
-                	$this->Cell(45,5,'Hoeveelheid',0,0,'L',true);
-                	$this->Cell(45,5,sprintf("%.1f", $row['keg_priming_amount']).' gram/liter',0,0,'L',true);
-		}
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Totaal suiker',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.3f",$bottle_sugar_amount).' kg',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-		if ($row['keg_forced_carb']) {
-			$this->Cell(45,5,'Druk op fust',0,0,'L',true);
-			$this->Cell(45,5,sprintf("%.1f",$row['keg_pressure']).' bar',0,0,'L',true);
-		} else {
-                	$this->Cell(45,5,'Totaal suiker',0,0,'L',true);
-                	$this->Cell(45,5,sprintf("%.3f",$keg_sugar_amount).' kg',0,0,'L',true);
-		}
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Water oplossen',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.3f",$row['bottle_priming_water']).' liter',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-		if (! $row['keg_forced_carb']) {
-                	$this->Cell(45,5,'Water oplossen',0,0,'L',true);
-                	$this->Cell(45,5,sprintf("%.3f",$row['keg_priming_water']).' liter',0,0,'L',true);
-		}
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Alcohol volume',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['package_abv'] + $row['bottle_priming_amount'] * 0.47 / 7.907).'%',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Alcohol volume',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['package_abv'] + $row['keg_priming_amount'] * 0.47 / 7.907).'%',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Hergisting temperatuur',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f",$row['bottle_carbonation_temp']).DEG.'C',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Hergisting temperatuur',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f", $row['keg_carbonation_temp']).DEG.'C',0,0,'L',true);
-                $this->Ln();
-	}
-
-	function Tasting($row) {
-
-		if ($this->GetY() > 200)
-                        $this->AddPage();
-                else
-                        $this->Ln(10);
-
-                $vul = $this->w - $this->rMargin - $this->lMargin - 180;
-                $cMargin=$this->cMargin;
-                $this->cMargin=2;
-                $this->TableX=$this->lMargin;
-                $this->SetFont('Helvetica','B',9);
-                $this->SetX($this->TableX);
-                $this->SetFillColor(255,150,100);
-                $this->Cell(0, 5, 'Proef notities',0,0,'C',true);
-                $this->Ln();
-
-                $this->SetFont('Helvetica','',9);
-                $this->SetFillColor(210,245,255);
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Proeven datum',0,0,'L',true);
-                $this->Cell(45,5,$row['taste_date'],0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(45,5,'Waardering',0,0,'L',true);
-                $this->Cell(45,5,sprintf("%.1f", $row['taste_rate']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Kleur',0,0,'L',true);
-                $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_color']),0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-		$this->Cell(45,5,'Helderheid',0,0,'L',true);
-		$this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_transparency']),0,0,'L',true);
-		$this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Schuim',0,0,'L',true);
-                $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_head']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Aroma',0,0,'L',true);
-                $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_aroma']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Smaak',0,0,'L',true);
-                $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_taste']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Mondgevoel',0,0,'L',true);
-                $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_mouthfeel']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Nasmaak',0,0,'L',true);
-                $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_aftertaste']),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(45,5,'Notities',0,0,'L',true);
-                $this->MultiCell(0,5,iconv('UTF-8','windows-1252',$row['taste_notes']),0,'L',true);
-                $this->Ln();
-	}
-}
-
-
-
-class PDF extends PDF_MySQL_Table {
-	function Header() {
-		global $row;
-		global $prdate;
-		global $stage;
-		global $divide_parts;
-		global $divide_part;
-		$this->Image('images/logo.png',10,10,30);
-		// Title
-		$this->SetFont('Helvetica','B',18);
-		$this->SetX(45);
-		$this->Cell(0,8,$row['code'].' '.$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->SetX(45);
-		$this->Cell(17,5,'Fase:',0,0,'L');
-		$this->Cell(0,5,$stage[$row['stage']],0,1,'L');
-		$this->SetX(45);
-                $this->Cell(17,5,'Batch:',0,0,'L');
-		if ($divide_parts == 0)
-			$this->Cell(0,5,"Niet gespitst",0,1,'L');
-		else
-			$this->Cell(0,5,"Split batch ".($divide_part + 1)." van ".($divide_parts + 1),0,1,'L');
-		$this->Ln(2);
-		// 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,iconv('UTF-8','windows-1252',$row['notes']),0,'L',true);
-}
-
-if ($row['stage'] > 2) {
-	$pdf->Brewday($row);
-}
-
-if ($row['stage'] > 3) {
-	$pdf->Fermentation($row);
-}
-if ($row['stage'] > 6) {
-	$pdf->Packaging($row);
-}
-if ($row['stage'] > 9) {
-	$pdf->Tasting($row);
-}
-
-$pdf->Output();
--- a/www/prod_torecipe.php	Fri Aug 05 11:02:01 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +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 products WHERE record='".$record."'");
-$row = mysqli_fetch_array($result);
-
-/*
- * Make this duplicate a fresh product.
- */
-$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='0.000";
-$sql .= "', est_abv='" . $row['est_abv'];
-$sql .= "', est_carb='0";
-$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='" . mysqli_real_escape_string($link, $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, "db_recipes: result: ".mysqli_error($link));
-} else {
-	$lastid = mysqli_insert_id($link);
-	syslog(LOG_NOTICE, "db_recipes: inserted record ".$lastid);
-}
-echo "<script>window.close();</script>";
-exit;

mercurial