# HG changeset patch # User Michiel Broek # Date 1561061682 -7200 # Node ID 7d231014b30119ef10edf7ab669f7c69ec31db87 # Parent 2230d3faeed979e5d4f7d9ad8bdb295aa144afb0 Added packaging and tasting to print product. diff -r 2230d3faeed9 -r 7d231014b301 www/prod_print.php --- a/www/prod_print.php Thu Jun 20 20:21:28 2019 +0200 +++ b/www/prod_print.php Thu Jun 20 22:14:42 2019 +0200 @@ -33,6 +33,10 @@ $mashkg = 0; date_default_timezone_set('Europe/Amsterdam'); $prdate = date(DATE_RFC2822); +$bottle_sugar = ''; +$keg_sugar = ''; +$bottle_sugar_amount = 0; +$keg_sugar_amount = 0; class PDF_MySQL_Table extends FPDF @@ -111,6 +115,10 @@ global $colorw; global $preboil_sg; global $mashkg; + global $bottle_sugar; + global $bottle_sugar_amount; + global $keg_sugar; + global $keg_sugar_amount; $added = array( 'Maischen', 'Koken 10 min', 'Vergisten', 'Nagisten/lageren', 'Bottelen', 'Op fust' ); $ftype = array( 'Mout', 'Suiker', 'Vloeibaar extract', 'Droog extract', 'Ongemout graan' ); $mtype = array( 'Basismout', 'Geroosterde mout', 'Cara- of crystalmout', 'Geƫeste mout', 'Zuurmout', 'Speciale mout', 'Geen mout' ); @@ -156,6 +164,15 @@ else $soort = iconv('UTF-8','windows-1252',$ftype[$item['f_type']]); + if ($item['f_added'] == 4) { + $bottle_sugar = $name; + $bottle_sugar_amount = $amount; + } + if ($item['f_added'] == 5) { + $keg_sugar = $name; + $keg_sugar_amount = $amount; + } + $cost = $amount * $costkg; $cost_fermentables += $cost; $total_fermentables += $amount; @@ -794,12 +811,8 @@ } function Fermentation($row) { -/* - * primary_start_temp primary_max_temp primary_end_temp primary_end_sg primary_end_date - * secondary_temp secondary_end_date - * tertiary_temp package_date - */ - if ($this->GetY() > 180) + + if ($this->GetY() > 230) $this->AddPage(); else $this->Ln(10); @@ -867,10 +880,205 @@ 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(); } }