www/prod_print.php

changeset 398
7e8f1a7ddeeb
parent 396
804800d8e885
child 407
9281bbbf26a6
equal deleted inserted replaced
397:d3d2b277075b 398:7e8f1a7ddeeb
639 $this->cMargin=$cMargin; 639 $this->cMargin=$cMargin;
640 $this->aCols=array(); 640 $this->aCols=array();
641 $this->Ln(); 641 $this->Ln();
642 } 642 }
643 643
644 function Checkheader($text) {
645 $this->SetFont('Arial','B',10);
646 $this->Cell(0, 4,$text,0,0,'L',true);
647 $this->SetFont('Arial','',10);
648 $this->Ln(6);
649 }
650
651 function Checkline($text) {
652 $this->Cell(2, 4,' ',0,0,'L',true);
653 $this->Cell(4, 4,' ',1,0,'L',true);
654 $this->Cell(0, 4,' '.$text,0,1,'L',true);
655 $this->Ln(1);
656 }
657
658 function Checklist($row) {
659
660 global $my_grain_absorbtion;
661 global $my_brix_correction;
662 $mashwater = 0;
663 $numsalts = 0;
664
665 $this->AddPage();
666 $this->SetFillColor(255,255,255);
667
668 if ($row['starter_enable'] && $row['prop1_volume']) {
669 $this->Checkheader('Giststarter maken');
670 $days = 0;
671 $last = 0;
672 for ($i = 1; $i < 5; $i++) {
673 $pt = "prop".$i."_type";
674 $pv = "prop".$i."_volume";
675 if (floatval($row[$pv])) {
676 $last = $i;
677 if ($row[$pt] == 0)
678 $days += 2;
679 else if ($row[$pt] == 1)
680 $days += 4;
681 else
682 $days += 6;
683 }
684 }
685 $this->Checkline("begin ongeveer ".$days." dagen voor de brouwdag met de giststarter");
686 for ($i = 1; $i < 5; $i++) {
687 $pt = "prop".$i."_type";
688 $pv = "prop".$i."_volume";
689 if (floatval($row[$pv])) {
690 $s = "Starter stap ".$i.", van ".sprintf("%.3f",floatval($row[$pv]));
691 $s .= " liter maken met SG ".sprintf("%.3f",floatval($row['starter_sg']));
692 $this->Checkline($s);
693 if ($row[$pt] == 0) {
694 $s = "ongeveer 24 uur op een magneetroerder";
695 } else if ($row[$pt] == 1) {
696 $s = "enkele dagen regelmatig schudden";
697 } else {
698 $s = "bijna een week rustig laten staan";
699 }
700 $s .= " tot er voldoende gist is";
701 $this->Checkline($s);
702 if ($i < $last) {
703 $this->Checkline("starter minstens 24 uur in de koeling laten uitzakken");
704 $this->Checkline("starter uit de koelkast halen en afgieten");
705 } else {
706 $this->Checkline("starter in de koeling zetten tot de brouwdag");
707 $this->Checkline("starter op de brouwdag uit de koelkast halen en afgieten");
708 }
709 }
710 }
711 $this->Ln(5);
712 }
713
714 $this->Checkheader('Water en -behandeling');
715 if ($row['w1_name']) {
716 $this->Checkline(sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name']);
717 $mashwater += floatval($row['w1_amount']);
718 }
719 if ($row['w2_name']) {
720 $this->Checkline(sprintf("%.1f",floatval($row['w2_amount'])).' liter water '.$row['w2_name']);
721 $mashwater += floatval($row['w2_amount']);
722 }
723 $arr = json_decode($row['json_miscs'], true);
724 foreach($arr as $item) {
725 if ($item['m_type'] == 4) { // Only the water agents
726 $unit = ($item['m_amount_is_weight']) ? " gram ":" ml ";
727 $this->Checkline(sprintf("%.1f",floatval($item['m_amount'] * 1000)).$unit.$item['m_name']);
728 $numsalts++;
729 }
730 }
731 $this->Ln(5);
732
733 $this->Checkheader('Mout afwegen en schroten');
734 $arr = json_decode($row['json_fermentables'], true);
735 foreach($arr as $item) {
736 if ($item['f_added'] == 0) { // to mash
737 $s = sprintf("%.3f",floatval($item['f_amount'])).' kg `';
738 $s .= iconv('UTF-8','windows-1252',$item['f_name']);
739 $s .= '` ('.iconv('UTF-8','windows-1252',$item['f_supplier']).')';
740 $this->Checkline($s);
741 }
742 }
743 $this->Checkline('mout schroten');
744 $this->Ln(5);
745
746 $this->Checkheader('Maischen');
747 $mvol = 0;
748 $msugars = 0; // mash sugars
749 $grainabsorbtion = 0;
750 $arr = json_decode($row['json_mashs'], true);
751 if (count($arr) > 0) {
752 $loop = 0;
753 foreach($arr as $item) {
754 if ($item['step_type'] == 0)
755 $mvol += $item['step_infuse_amount']; // We need this later.
756 if ($loop == 0) {
757 if ($item['step_type'] == 0)
758 $l = $item['step_infuse_amount'];
759 else
760 $l = $mashwater;
761 $s = sprintf("%.1f",$l).' liter water opwarmen tot ';
762 $s .= sprintf("%.1f",$item['step_temp']).' '.DEG.'C (';
763 $s .= sprintf("%.1f",kettle_cm($l,$row['eq_tun_volume'],$row['eq_tun_height']));
764 $s .= ' cm onder de rand)';
765 $this->Checkline($s);
766 if ($numsalts > 0)
767 $this->Checkline('brouwzouten en -zuren toevoegen');
768 $this->Checkline('mout storten en inmaischen');
769 $hops = json_decode($row['json_hops'], true);
770 foreach($hops as $item2) {
771 if ($item2['h_useat'] == 0) {
772 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `';
773 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen';
774 $this->Checkline($s);
775 }
776 }
777 $miscs = json_decode($row['json_miscs'], true);
778 foreach($miscs as $item3) {
779 if ($item3['m_use_use'] == 1 && $item3['m_type'] != 4) { // Only if not a water agent
780 $s = sprintf("%.2f",$item3['m_amount']*1000).' gr `';
781 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` toevoegen';
782 $this->Checkline($s);
783 }
784 }
785 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C');
786 $this->Checkline('pH meten en bijstellen (doel pH beslag: '.sprintf("%.1f",$row['mash_ph']).' pH)');
787 } else {
788 if ($item['step_type'] == 0) { // Infusion
789 $s = 'toevoegen '.$item['step_infuse_amount'].' liter water van xx '.DEG.'C';
790 } else if ($item['step_type'] == 1) { // Direct heat
791 $s = 'opwarmen tot '.$item['step_temp'].' '.DEG.'C';
792 } else { // Decoction
793 $s = 'uitnemen, opwarmen, koken en terugstorten van '.$item['step_infuse_amount'].' liter deelbeslag';
794 }
795 $this->Checkline($s);
796 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C');
797 }
798 $loop++;
799 }
800 $est_mash_sg = 0;
801 $ferms = json_decode($row['json_fermentables'], true);
802 foreach($ferms as $item) {
803 if ($item['f_added'] == 0) {
804 $d = $item['f_amount'] * ($item['f_yield'] / 100) * (1 - $item['f_moisture'] / 100);
805 $mvol += $item['f_amount'] * $item['f_moisture'] / 100;
806 $grainabsorbtion += $my_grain_absorbtion * $item['f_amount'];
807 $msugars += $d;
808 }
809 }
810 $sugardensity = 1.611;
811 $v = $msugars / $sugardensity + $mvol;
812 $plato = 1000 * $msugars / ($v * 10); // deg. Plato
813 $mash_sg = plato_to_sg($plato);
814 $this->Checkline('doel SG eind maischen: '.density_str($mash_sg));
815 }
816 if ($this->GetY() > 200)
817 $this->AddPage();
818 else
819 $this->Ln(5);
820
821 $acidtype = array( 'Melkzuur', 'Zoutzuur', 'Fosforzuur', 'Zwavelzuur' );
822 $this->Checkheader('Filteren en spoelen');
823 $s = sprintf("%.1f",$row['sparge_volume']).' liter spoelwater opwarmen tot '.sprintf("%.1f",$row['sparge_temp']).' '.DEG.'C';
824 $this->Checkline($s);
825 $s = 'spoelwater aanzuren tot pH <= '.sprintf("%.1f",$row['sparge_ph']).' met ';
826 $s .= sprintf("%.1f",$row['sparge_acid_amount']*1000).' ml. '.$acidtype[$row['sparge_acid_type']];
827 $this->Checkline($s);
828 $spoelw = ($row['boil_size'] - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03; // A small heat correction
829 $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater');
830 $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * 1.04).' liter (';
831 $s .= sprintf("%.1f",kettle_cm($row['boil_size'] * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)';
832 $this->Checkline($s);
833 $pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size']));
834 $this->Checkline('doel SG in kookketel: '.density_str($pre_sg));
835 $hops = json_decode($row['json_hops'], true);
836 foreach($hops as $item2) {
837 if ($item2['h_useat'] == 1) {
838 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `';
839 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen na het spoelen';
840 $this->Checkline($s);
841 }
842 }
843 if ($this->GetY() > 200)
844 $this->AddPage();
845 else
846 $this->Ln(5);
847
848 $this->Checkheader('Koken');
849 $this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
850 for ($i = $row['boil_time']; $i >= 0; $i--) {
851 if ($i == 10) {
852 $ferms = json_decode($row['json_fermentables'], true);
853 foreach($ferms as $item1) {
854 if ($item1['f_added'] == 1) {
855 $s = sprintf("%.3f",$item1['f_amount']).' kg `';
856 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij 10 minuten voor einde koken';
857 $this->Checkline($s);
858 }
859 }
860 if ($row['brew_cooling_method'] == 1)
861 $this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
862 }
863 $hops = json_decode($row['json_hops'], true);
864 foreach($hops as $item2) {
865 if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
866 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `';
867 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
868 if ($i > 0)
869 $s .= $i.' minuten voor einde koken';
870 else
871 $s .= 'vlamuit';
872 $this->Checkline($s);
873 }
874 }
875 $miscs = json_decode($row['json_miscs'], true);
876 foreach($miscs as $item3) {
877 if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
878 $s = sprintf("%.1f",$item3['m_amount']*1000).' gr `';
879 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
880 if ($i > 0)
881 $s .= $i.' minuten voor einde koken';
882 else
883 $s .= 'vlamuit';
884 $this->Checkline($s);
885 }
886 }
887
888 }
889 $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*1.04).' liter (';
890 $s .= sprintf("%.1f",kettle_cm($row['batch_size']*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
891 $s .= ' cm onder de rand)';
892 $this->Checkline($s);
893 $this->Checkline('doel SG einde koken: '.density_str($row['est_og']));
894 if ($this->GetY() > 200)
895 $this->AddPage();
896 else
897 $this->Ln(5);
898
899 if (($row['brew_whirlpool9'] + $row['brew_whirlpool7'] + $row['brew_whirlpool6'] + $row['brew_whirlpool2']) > 0) {
900 $this->Checkheader('Whirlpool en koelen');
901 if ($row['brew_whirlpool9'] > 0) {
902 $s = 'Whirlpool voor '.$row['brew_whirlpool9'].' min. Temperatuur boven 85 '.DEG.'C houden';
903 $this->Checkline($s);
904 }
905 if ($row['brew_whirlpool7'] > 0) {
906 $this->Checkline('koelen tot 79 '.DEG.'C');
907 $s = 'Whirlpool voor '.$row['brew_whirlpool7'].' min. Temperatuur tussen 72 en 79 '.DEG.'C houden';
908 $this->Checkline($s);
909 }
910 if ($row['brew_whirlpool6'] > 0) {
911 $this->Checkline('koelen tot 66 '.DEG.'C');
912 $s = 'Whirlpool voor '.$row['brew_whirlpool6'].' min. Temperatuur tussen 60 en 66 '.DEG.'C houden';
913 $this->Checkline($s);
914 }
915 $hops = json_decode($row['json_hops'], true);
916 foreach($hops as $item2) {
917 if ($item2['h_useat'] == 4) {
918 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `';
919 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor ';
920 $s .= $item2['h_time'].' minuten in de whirlpool';
921 $this->Checkline($s);
922 }
923 }
924 $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
925 if ($row['brew_whirlpool2'] > 0) {
926 $s = 'Whirlpool voor '.$row['brew_whirlpool2'].' min.';
927 $this->Checkline($s);
928 }
929 } else {
930 $this->Checkheader('Koelen');
931 $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
932 }
933 $this->Checkline('gistvat ontsmetten en evt. pomp en slangen ontsmetten');
934 $this->Checkline('wort naar gistvat overbrengen');
935 if ($this->GetY() > 200)
936 $this->AddPage();
937 else
938 $this->Ln(5);
939
940 $this->Checkheader('Gist enten');
941 $dry = 0;
942 $yeasts = json_decode($row['json_yeasts'], true);
943 foreach ($yeasts as $item) {
944 if ($item['y_use'] == 0) { // primary
945 if ($item['y_form'] == 0) { // Liquid
946 $this->Checkline($item['y_amount'].' pak '.$item['y_product_id'].', '.$item['y_name'].' gist');
947 } else if ($item['y_form'] == 1) { // Dry
948 $s = sprintf("%.1f",$item['y_amount']*1000).' gram '.$item['y_product_id'].', '.$item['y_name'];
949 $s .= ' gist';
950 $dry += $item['y_amount']*10000;
951 $this->Checkline($s);
952 } else { // Slant/Culture/Frozen/Bottle
953 $s = sprintf("%.0f",$item['y_amount']*1000).' ml '.$item['y_product_id'].', '.$item['y_name'].' gist';
954 $this->Checkline($s);
955 }
956 }
957 }
958 if ($dry > 0) {
959 $this->Checkline(' gist hydrateren in '.$dry.' ml gedesinfecteerd water van 32 '.DEG.'C');
960 $this->Checkline(' 15 minuten laten staan bij 32 '.DEG.'C');
961 $this->Checkline(' gistmengsel voorzichtig roeren en laten afkoelen tot temperatuur wort');
962 $this->Checkline(' gist toevoegen');
963 $this->Checkline('Of');
964 $this->Checkline(' gist rechtstreeks over het wort strooien');
965 } else {
966 if ($row['starter_enable'] && $row['prop1_volume'])
967 $this->Checkline('giststarter toevoegen');
968 else
969 $this->Checkline('gist toevoegen');
970 }
971 if ($row['brew_fermenter_extrawater'] > 0)
972 $this->Checkline(sprintf("%.1f", $row['brew_fermenter_extrawater']).' liter water toevoegen in gistvat');
973 if ($row['brew_aeration_type'] > 0) {
974 $s = 'wort '.$row['brew_aeration_time'].' minuten beluchten met ';
975 $s .= ($row['brew_aeration_type'] == 1) ? "lucht":"zuurstof";
976 $this->Checkline($s);
977 }
978 if ($this->GetY() > 200)
979 $this->AddPage();
980 else
981 $this->Ln(5);
982
983 $this->Checkheader('Vergisting starten');
984 $this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
985
986 // 'Toevoegingen tijdens vergisting'
987 // 'Toevoegingen tijdens nagisting/lagering'
988 // fermentables & hops & miscs verdelen over primary/secondary/teriary
989
990 // 'Toevoegingen tijdens bottelen/op fust zetten'
991 }
992
993 function Brewday($row) { 644 function Brewday($row) {
994 645
995 global $my_brix_correction; 646 global $my_brix_correction;
996 global $my_grain_absorbtion; 647 global $my_grain_absorbtion;
997 648
1211 // Package report 862 // Package report
1212 } 863 }
1213 if ($row['stage'] > 9) { 864 if ($row['stage'] > 9) {
1214 // Taste notes 865 // Taste notes
1215 } 866 }
1216 if ($row['stage'] == 1 || $row['stage'] == 2) {
1217 $pdf->Checklist($row);
1218 }
1219
1220 867
1221 $pdf->Output(); 868 $pdf->Output();

mercurial