www/prod_print.php

changeset 243
b43214d218c0
parent 241
e95d2886f49f
child 245
3649c3d31d15
equal deleted inserted replaced
242:97c237654ddd 243:b43214d218c0
452 452
453 453
454 // Kostprijs per liter, calorieren 454 // Kostprijs per liter, calorieren
455 $this->cMargin=$cMargin; 455 $this->cMargin=$cMargin;
456 } 456 }
457
458 function Checkheader($text) {
459 $this->SetFont('Arial','B',10);
460 $this->Cell(0, 4,$text,0,0,'L',true);
461 $this->SetFont('Arial','',10);
462 $this->Ln(6);
463 }
464
465 function Checkline($text) {
466 $this->Rect(10,$this->GetY(),4,4);
467 $this->SetX(15);
468 $this->Cell(0, 4,$text,0,1,'L',true);
469 $this->Ln(1);
470 }
471
472 function Checklist($row) {
473
474 global $my_grain_absorbtion;
475 global $my_brix_correction;
476 $mashwater = 0;
477 $numsalts = 0;
478
479 $this->AddPage();
480 $this->SetFillColor(255,255,255);
481 $this->Checkheader('Water en -behandeling');
482 if ($row['w1_name']) {
483 $this->Checkline(sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name']);
484 $mashwater += floatval($row['w1_amount']);
485 }
486 if ($row['w2_name']) {
487 $this->Checkline(sprintf("%.1f",floatval($row['w2_amount'])).' liter water '.$row['w2_name']);
488 $mashwater += floatval($row['w2_amount']);
489 }
490 $arr = json_decode($row['json_miscs'], true);
491 foreach($arr as $item) {
492 if ($item['m_type'] == 4) { // Only the water agents
493 $this->Checkline(sprintf("%.1f",floatval($item['m_amount'] * 1000)).' gram '.$item['m_name']);
494 $numsalts++;
495 }
496 }
497 $this->Ln(5);
498
499 $this->Checkheader('Mout afwegen en schroten');
500 $arr = json_decode($row['json_fermentables'], true);
501 foreach($arr as $item) {
502 if ($item['f_added'] == 0) { // to mash
503 $s = sprintf("%.3f",floatval($item['f_amount'])).' kg ';
504 $s .= iconv('UTF-8','windows-1252',$item['f_name']);
505 $s .= ' ('.iconv('UTF-8','windows-1252',$item['f_supplier']).')';
506 $this->Checkline($s);
507 }
508 }
509 $this->Checkline('mout schroten');
510 $this->Ln(5);
511
512 $this->Checkheader('Maischen');
513 $mvol = 0;
514 $grainabsortion = 0;
515 $arr = json_decode($row['json_mashs'], true);
516 if (count($arr) > 0) {
517 $loop = 0;
518 foreach($arr as $item) {
519 if ($item['step_type'] == 0)
520 $mvol += $item['step_infuse_amount']; // We need this later.
521 if ($loop == 0) {
522 $s = sprintf("%.1f",$mashwater).' liter water opwarmen tot ';
523 $s .= sprintf("%.1f",$item['step_temp']).' '.DEG.'C (';
524 $s .= sprintf("%.1f",kettle_cm($mashwater,$row['eq_tun_volume'],$row['eq_tun_height']));
525 $s .= ' cm onder de rand)';
526 $this->Checkline($s);
527 if ($numsalts > 0)
528 $this->Checkline('brouwzouten en -zuren toevoegen');
529 $this->Checkline('mout storten en inmaischen');
530 $hops = json_decode($row['json_hops'], true);
531 foreach($hops as $item2) {
532 if ($item2['h_useat'] == 0) {
533 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr ';
534 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' toevoegen';
535 $this->Checkline($s);
536 }
537 }
538 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C');
539 $this->Checkline('pH meten en bijstellen (doel pH beslag: '.sprintf("%.1f",$row['mash_ph']).' pH)');
540 } else {
541 if ($item['step_type'] == 0) { // Infusion
542 $s = 'toevoegen '.$item['step_infuse_amount'].' liter water van xx '.DEG.'C';
543 } else if ($item['step_type'] == 1) { // Direct heat
544 $s = 'opwarmen tot '.$item['step_temp'].' '.DEG.'C';
545 } else { // Decoction
546 $s = 'uitnemen, opwarmen, koken en terugstorten van '.$item['step_infuse_amount'].' liter deelbeslag';
547 }
548 $this->Checkline($s);
549 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C');
550 }
551 $loop++;
552 }
553 $est_mash_sg = 0;
554 $s = 0;
555 $ferms = json_decode($row['json_fermentables'], true);
556 foreach($ferms as $item) {
557 if ($item['f_added'] == 0) {
558 $d = $item['f_amount'] * ($item['f_yield'] / 100) * (1 - $item['f_moisture'] / 100);
559 $mvol += $item['f_amount'] * $item['f_moisture'] / 100;
560 $grainabsorbtion += $my_grain_absorbtion * $item['f_amount'];
561 $s += $d;
562 }
563 }
564 $sugardensity = 1.611;
565 $v = $s / $sugardensity + $mvol;
566 $plato = 1000 * $s / ($v * 10); // deg. Plato
567 $mash_sg = plato_to_sg($plato);
568 $brix = $plato * $my_brix_correction;
569 $s = 'doel sg eind maischen: '.sprintf("%.3f",$mash_sg);
570 $s .= ' SG ('.sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
571 $this->Checkline($s);
572 }
573 $this->Ln(5);
574
575 $acidtype = array( 'Melkzuur', 'Zoutzuur', 'Fosforzuur', 'Zwavelzuur' );
576 $this->Checkheader('Filteren en spoelen');
577 $s = sprintf("%.1f",$row['sparge_volume']).' liter spoelwater opwarmen tot '.sprintf("%.1f",$row['sparge_temp']).' '.DEG.'C';
578 $this->Checkline($s);
579 $s = 'spoelwater aanzuren to pH <= '.sprintf("%.1f",$row['sparge_ph']).' met ';
580 $s .= sprintf("%.1f",$row['sparge_acid_amount']*1000).' ml. '.$acidtype[$row['sparge_acid_type']];
581 $this->Checkline($s);
582
583 $spoelw = ($row['boil_size'] - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03; // A small heat correction
584 $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater');
585 $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * 1.04).' liter (';
586 $s .= sprintf("%.1f",kettle_cm($row['boil_size'] * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)';
587 $this->Checkline($s);
588 // TODO: doel SG in kookketel: 1.053 SG (13.4 Brix, 13.0 P)
589 $hops = json_decode($row['json_hops'], true);
590 foreach($hops as $item2) {
591 if ($item2['h_useat'] == 1) {
592 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr ';
593 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' toevoegen na het spoelen';
594 $this->Checkline($s);
595 }
596 }
597 $this->Ln(5);
598
599 $this->Checkheader('Koken');
600 $this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
601 for ($i = $row['boil_time']; $i >= 0; $i--) {
602
603 if ($i == 10) {
604 $ferms = json_decode($row['json_fermentables'], true);
605 foreach($ferms as $item1) {
606 if ($item1['f_added'] == 1) {
607 $s = sprintf("%.3f",$item1['f_amount']).' kg ';
608 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).' bij 10 minuten voor einde koken';
609 $this->Checkline($s);
610 }
611 }
612 if ($row['brew_cooling_method'] == 1)
613 $this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
614 }
615 $hops = json_decode($row['json_hops'], true);
616 foreach($hops as $item2) {
617 if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
618 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr ';
619 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' bij ';
620 if ($i > 0)
621 $s .= $i.' minuten voor einde koken';
622 else
623 $s .= 'vlamuit';
624 $this->Checkline($s);
625 }
626 }
627 $miscs = json_decode($row['json_miscs'], true);
628 foreach($miscs as $item3) {
629 if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
630 $s = sprintf("%.1f",$item3['m_amount']*1000).' gr ';
631 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).' bij ';
632 if ($i > 0)
633 $s .= $i.' minuten voor einde koken';
634 else
635 $s .= 'vlamuit';
636 $this->Checkline($s);
637 }
638 }
639
640 }
641 $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*1.04).' liter (';
642 $s .= sprintf("%.1f",kettle_cm($row['batch_size']*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
643 $s .= ' cm onder de rand)';
644 $this->Checkline($s);
645 $plato = sg_to_plato($row['est_og']);
646 $brix = $plato * $my_brix_correction;
647 $s = 'doel SG einde koken: '.sprintf("%.3f",$row['est_og']).' SG (';
648 $s .= sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)'.$this->GetY();
649 $this->Checkline($s);
650 if ($this->GetY() > 200)
651 $this->AddPage();
652 else
653 $this->Ln(5);
654
655 if (($row['brew_whirlpool9'] + $row['brew_whirlpool7'] + $row['brew_whirlpool6'] + $row['brew_whirlpool2']) > 0) {
656 $this->Checkheader('Whirlpool en koelen');
657 if ($row['brew_whirlpool9'] > 0) {
658 $s = 'Whirlpool voor '.$row['brew_whirlpool9'].' min. Temperatuur boven 85 '.DEG.'C houden';
659 $this->Checkline($s);
660 }
661 if ($row['brew_whirlpool7'] > 0) {
662 $this->Checkline('koelen tot 79 '.DEG.'C');
663 $s = 'Whirlpool voor '.$row['brew_whirlpool7'].' min. Temperatuur tussen 72 en 79 '.DEG.'C houden';
664 $this->Checkline($s);
665 }
666 if ($row['brew_whirlpool6'] > 0) {
667 $this->Checkline('koelen tot 66 '.DEG.'C');
668 $s = 'Whirlpool voor '.$row['brew_whirlpool6'].' min. Temperatuur tussen 60 en 66 '.DEG.'C houden';
669 $this->Checkline($s);
670 }
671 $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
672 if ($row['brew_whirlpool2'] > 0) {
673 $s = 'Whirlpool voor '.$row['brew_whirlpool2'].' min.';
674 $this->Checkline($s);
675 }
676 } else {
677 $this->Checkheader('Koelen');
678 $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
679 }
680 $this->Checkline('gistvat ontsmetten en evt. pomp en slangen ontsmetten');
681 $this->Checkline('wort naar gistvat overbrengen');
682 if ($this->GetY() > 200)
683 $this->AddPage();
684 else
685 $this->Ln(5);
686
687 $this->Checkheader('Gist enten');
688 // 'wort beluchten'
689 // 'evt. giststarter afgieten'
690 // 'gist hydrateren in ' ' ml gedesinfecteerd water van '
691 // '15 minuten laten staan bij '
692 // 'gistmengsel voorzichtig roeren'
693 // 'langzaam laten afkoelen tot ' 'temperatuur wort'
694 // 'gist toevoegen'
695 // ' water toevoegen in gistvat' (topupwater)
696 if ($this->GetY() > 200)
697 $this->AddPage();
698 else
699 $this->Ln(5);
700
701 $this->Checkheader('Vergisting starten');
702 $this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
703
704 // 'Toevoegingen tijdens vergisting'
705 // 'Toevoegingen tijdens nagisting/lagering'
706 // fermentables & hops & miscs verdelen over primary/secondary/teriary
707
708 // 'Toevoegingen tijdens bottelen/op fust zetten'
709 }
457 } 710 }
458 711
459 712
460 713
461 class PDF extends PDF_MySQL_Table { 714 class PDF extends PDF_MySQL_Table {
462 function Header() { 715 function Header() {
463 global $row; 716 global $row;
464 global $prdate; 717 global $prdate;
465 $stage = array( 'Plan', 'Wacht', 'Brouwen', 'Hoofdgisting', 'Nagisting', 'Lagering', 'Afvullen', 'Hergisten', 'Rijpen', 'Proeven', 'Gereed', 'Afgesloten' ); 718 $stage = array( 'Plan', 'Wacht', 'Brouwen', 'Hoofdgisting', 'Nagisting', 'Lagering', 'Afvullen', 'Hergisten', 'Rijpen', 'Proeven', 'Gereed', 'Afgesloten' );
466 $this->Image('images/logo.png',10,6,30); 719 $this->Image('images/logo.png',10,10,30);
467 // Title 720 // Title
468 $this->SetFont('Helvetica','B',18); 721 $this->SetFont('Helvetica','B',18);
469 $this->SetX(45); 722 $this->SetX(45);
470 $this->Cell(0,8,$row['name'],0,1,'L'); 723 $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L');
471 $this->Ln(1); 724 $this->Ln(1);
472 $this->SetFont('Helvetica','',10); 725 $this->SetFont('Helvetica','',10);
473 $this->SetX(45); 726 $this->SetX(45);
474 $this->Cell(17,5,'Datum:',0,0,'L'); 727 $this->Cell(17,5,'Datum:',0,0,'L');
475 $this->Cell(0,5,$prdate,0,1,'L'); 728 $this->Cell(0,5,$prdate,0,1,'L');
503 $pdf->Ln(); 756 $pdf->Ln();
504 $pdf->SetFillColor(210,245,255); 757 $pdf->SetFillColor(210,245,255);
505 $pdf->MultiCell(0,4,$row['notes'],0,'L',true); 758 $pdf->MultiCell(0,4,$row['notes'],0,'L',true);
506 } 759 }
507 760
508 if ($row['stage'] == 2) { 761 if ($row['stage'] == 1 || $row['stage'] == 2) {
509 // Checklist 762 // Checklist
763 $pdf->Checklist($row);
510 } 764 }
511 if ($row['stage'] > 2) { 765 if ($row['stage'] > 2) {
512 // Brouw rapport 766 // Brouw rapport
513 } 767 }
514 if ($row['stage'] > 3) { 768 if ($row['stage'] > 3) {

mercurial