650 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sodium, 1, 'f', 1)); |
651 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sodium, 1, 'f', 1)); |
651 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_chloride, 1, 'f', 1)); |
652 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_chloride, 1, 'f', 1)); |
652 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sulfate, 1, 'f', 1)); |
653 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_sulfate, 1, 'f', 1)); |
653 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_ph, 1, 'f', 2)); |
654 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(recipe->wb_ph, 1, 'f', 2)); |
654 y += 20; |
655 y += 20; |
655 } |
656 |
656 |
657 /* |
657 /* |
658 * Print recipe notes if present. |
658 * Print recipe notes if present. |
659 */ |
659 */ |
660 if (recipe->notes.length()) { |
660 if (recipe->notes.length()) { |
661 QStringList lines = recipe->notes.split("\n"); |
661 QStringList lines = recipe->notes.split("\n"); |
662 |
662 |
663 if (lines.size() && recipe->notes != "") { |
663 if (lines.size() && recipe->notes != "") { |
664 if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { |
664 if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { |
665 printer->newPage(); |
665 printer->newPage(); |
666 printHeader(&painter); |
666 printHeader(&painter); |
667 y = 120; |
667 y = 120; |
668 } else { |
|
669 y += 40; |
|
670 } |
|
671 |
|
672 /* Notes header */ |
|
673 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
674 painter.setPen(Qt::black); |
|
675 painter.fillRect( 0, y, 735, 20, c_header); |
|
676 painter.drawText( 0, y+4, 735, 20, Qt::AlignCenter, tr("Recipe notes")); |
|
677 y += 20; |
|
678 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
679 for (int i = 0; i < lines.size(); i++) { |
|
680 painter.fillRect( 0, y, 735, 20, c_line1); |
|
681 painter.drawText( 0, y+4, 735, 20, Qt::AlignLeft, lines[i]); |
|
682 y += 20; |
|
683 } |
|
684 } |
|
685 } |
|
686 |
|
687 } else if (p_job == PR_PRODUCT) { |
|
688 |
|
689 qDebug() << "print product"; |
|
690 printHeader(&painter); |
|
691 y = 120; |
|
692 /* Generic header */ |
|
693 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
694 painter.setPen(Qt::black); |
|
695 painter.fillRect( 0, y, 735, 20, c_header); |
|
696 painter.drawText( 0, y+4, 735, 20, Qt::AlignCenter, tr("Product overview")); |
|
697 y += 20; |
|
698 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
699 painter.fillRect( 0, y, 300, 20, c_line1); |
|
700 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Brew type")); |
|
701 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, recipe_types[product->type]); |
|
702 painter.fillRect(435, y, 300, 20, c_line1); |
|
703 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Efficiency")); |
|
704 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 %").arg(product->efficiency, 1, 'f', 1)); |
|
705 y += 20; |
|
706 painter.fillRect( 0, y, 300, 20, c_line1); |
|
707 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Boil time")); |
|
708 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, QString("%1 minutes.").arg(product->boil_time, 1, 'f', 0)); |
|
709 painter.fillRect(435, y, 300, 20, c_line1); |
|
710 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Batch size")); |
|
711 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 L.").arg(product->batch_size, 1, 'f', 1)); |
|
712 y += 20; |
|
713 painter.fillRect( 0, y, 300, 20, c_line1); |
|
714 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Start SG")); |
|
715 painter.drawText(120, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_og, 1, 'f', 3)); |
|
716 painter.drawText(210, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_og_min, 1, 'f', 3).arg(product->st_og_max, 1, 'f', 3)); |
|
717 painter.fillRect(435, y, 300, 20, c_line1); |
|
718 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("End SG")); |
|
719 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_fg, 1, 'f', 3)); |
|
720 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_fg_min, 1, 'f', 3).arg(product->st_fg_max, 1, 'f', 3)); |
|
721 y += 20; |
|
722 painter.fillRect( 0, y, 300, 20, c_line1); |
|
723 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Estimated Alcohol")); |
|
724 painter.drawText(120, y+4, 90, 20, Qt::AlignLeft, QString("%1%").arg(product->est_abv, 1, 'f', 1)); |
|
725 painter.drawText(210, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_abv_min, 1, 'f', 1).arg(product->st_abv_max, 1, 'f', 1)); |
|
726 painter.fillRect(435, y, 300, 20, c_line1); |
|
727 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Estimated CO2 vol")); |
|
728 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_carb, 1, 'f', 1)); |
|
729 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_carb_min, 1, 'f', 1).arg(product->st_carb_max, 1, 'f', 1)); |
|
730 y += 20; |
|
731 painter.fillRect( 0, y, 120, 20, c_line1); |
|
732 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Color (") + color_method[product->color_method] + ")"); |
|
733 painter.fillRect(120, y, 180, 20, Utils::ebc_to_color(product->est_color)); |
|
734 if (product->est_color > 30) |
|
735 painter.setPen(Qt::white); |
|
736 painter.drawText(120, y+4, 90, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0)); |
|
737 painter.drawText(210, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_color_min, 1, 'f', 0).arg(product->st_color_max, 1, 'f', 0)); |
|
738 painter.setPen(Qt::black); |
|
739 painter.fillRect(435, y, 300, 20, c_line1); |
|
740 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("IBU (") + ibu_method[product->ibu_method] + ")"); |
|
741 painter.drawText(555, y+4, 90, 20, Qt::AlignLeft, QString("%1").arg(product->est_ibu, 1, 'f', 1)); |
|
742 painter.drawText(645, y+4, 90, 20, Qt::AlignLeft, QString("(%1 - %2)").arg(product->st_ibu_min, 1, 'f', 0).arg(product->st_ibu_max, 1, 'f', 0)); |
|
743 y += 20; |
|
744 painter.fillRect( 0, y, 300, 20, c_line1); |
|
745 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Beer style")); |
|
746 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->st_name); |
|
747 painter.fillRect(435, y, 300, 20, c_line1); |
|
748 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Stage")); |
|
749 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, prod_stages[product->stage]); |
|
750 y += 40; |
|
751 |
|
752 /* Fermentables */ |
|
753 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
754 painter.setPen(Qt::black); |
|
755 painter.fillRect( 0, y, 735, 20, c_header); |
|
756 painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, tr("Fermentable")); |
|
757 painter.drawText(265, y+4, 70, 20, Qt::AlignRight, tr("Percent")); |
|
758 painter.drawText(340, y+4, 70, 20, Qt::AlignRight, tr("Yield")); |
|
759 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
|
760 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
|
761 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
|
762 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
|
763 y += 20; |
|
764 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
765 double cost_fermentables = 0; |
|
766 QString soort, amount, use; |
|
767 for (int i = 0; i < product->fermentables.size(); i++) { |
|
768 double cost = product->fermentables.at(i).f_amount * product->fermentables.at(i).f_cost; |
|
769 cost_fermentables += cost; |
|
770 |
|
771 if (product->fermentables.at(i).f_type == 0) |
|
772 soort = fermentable_graintypes[product->fermentables.at(i).f_graintype]; |
|
773 else |
|
774 soort = fermentable_types[product->fermentables.at(i).f_type]; |
|
775 |
|
776 if (product->fermentables.at(i).f_amount > 100) |
|
777 amount = QString("%1 kg").arg(product->fermentables.at(i).f_amount, 1, 'f', 1); |
|
778 else if (product->fermentables.at(i).f_amount > 10) |
|
779 amount = QString("%1 kg").arg(product->fermentables.at(i).f_amount, 1, 'f', 2); |
|
780 else |
|
781 amount = QString("%1 gr").arg(product->fermentables.at(i).f_amount * 1000, 1, 'f', 0); |
|
782 |
|
783 painter.fillRect( 0, y, 735, 20, f_line); |
|
784 |
|
785 painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, product->fermentables.at(i).f_name + |
|
786 QString(", %1 EBC (").arg(product->fermentables.at(i).f_color, 1, 'f', 0) + |
|
787 product->fermentables.at(i).f_supplier + ")"); |
|
788 if (product->fermentables.at(i).f_added < FERMENTABLE_ADDED_BOTTLE) |
|
789 painter.drawText(265, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).f_percentage, 1, 'f', 1)); |
|
790 else |
|
791 painter.drawText(265, y+4, 70, 20, Qt::AlignRight, ""); |
|
792 painter.drawText(340, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->fermentables.at(i).f_yield, 1, 'f', 1)); |
|
793 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, soort); |
|
794 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, fermentable_added[product->fermentables.at(i).f_added]); |
|
795 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
|
796 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
|
797 y += 20; |
|
798 } |
|
799 painter.fillRect(670, y, 60, 20, c_line1); |
|
800 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_fermentables, 1, 'f', 3)); |
|
801 y += 40; |
|
802 |
|
803 /* Hops */ |
|
804 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
805 painter.fillRect( 0, y, 735, 20, c_header); |
|
806 painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, tr("Hop")); |
|
807 painter.drawText(265, y+4, 70, 20, Qt::AlignRight, tr("Alpha")); |
|
808 painter.drawText(340, y+4, 70, 20, Qt::AlignRight, tr("IBU")); |
|
809 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
|
810 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
|
811 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
|
812 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
|
813 y += 20; |
|
814 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
815 double cost_hops = 0; |
|
816 for (int i = 0; i < product->hops.size(); i++) { |
|
817 |
|
818 double cost = product->hops.at(i).h_amount * product->hops.at(i).h_cost; |
|
819 cost_hops += cost; |
|
820 double ibu = Utils::toIBU(product->hops.at(i).h_useat, product->hops.at(i).h_form, product->preboil_sg, product->batch_size, |
|
821 product->hops.at(i).h_amount, product->hops.at(i).h_time, product->hops.at(i).h_alpha, |
|
822 product->ibu_method, product->brew_whirlpool9, product->brew_whirlpool7, product->brew_whirlpool6, product->boil_time); |
|
823 |
|
824 if (product->hops.at(i).h_useat == 2 || product->hops.at(i).h_useat == 4) // Boil or Whirlpool |
|
825 use = hop_useat[product->hops.at(i).h_useat] + QString(" %1 min").arg(product->hops.at(i).h_time); |
|
826 else if (product->hops.at(i).h_useat == 5) // Dryhop |
|
827 use = hop_useat[product->hops.at(i).h_useat] + QString(" %1 days").arg(product->hops.at(i).h_time / 1440); |
|
828 else |
|
829 use = hop_useat[product->hops.at(i).h_useat]; |
|
830 |
|
831 if (product->hops.at(i).h_amount > 1) |
|
832 amount = QString("%1 kg").arg(product->hops.at(i).h_amount, 1, 'f', 3); |
|
833 else |
|
834 amount = QString("%1 gr").arg(product->hops.at(i).h_amount * 1000, 1, 'f', 1); |
|
835 |
|
836 painter.fillRect( 0, y, 735, 20, h_line); |
|
837 painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, product->hops.at(i).h_name + " (" + product->hops.at(i).h_origin + ")"); |
|
838 painter.drawText(265, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->hops.at(i).h_alpha, 1, 'f', 1)); |
|
839 painter.drawText(340, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(ibu, 1, 'f', 1)); |
|
840 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, hop_forms[product->hops.at(i).h_form]); |
|
841 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, use); |
|
842 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
|
843 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
|
844 y += 20; |
|
845 } |
|
846 painter.fillRect(670, y, 60, 20, c_line1); |
|
847 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_hops, 1, 'f', 3)); |
|
848 y += 40; |
|
849 |
|
850 /* Yeasts */ |
|
851 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
852 painter.fillRect( 0, y, 735, 20, c_header); |
|
853 painter.drawText( 0, y+4, 335, 20, Qt::AlignLeft, tr("Yeast")); |
|
854 painter.drawText(340, y+4, 70, 20, Qt::AlignRight, tr("Attn")); |
|
855 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
|
856 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
|
857 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
|
858 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
|
859 y += 20; |
|
860 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
861 double cost_yeasts = 0; |
|
862 for (int i = 0; i < product->yeasts.size(); i++) { |
|
863 double cost = product->yeasts.at(i).y_amount * product->yeasts.at(i).y_cost; |
|
864 cost_yeasts += cost; |
|
865 |
|
866 if (product->yeasts.at(i).y_form == 0) |
|
867 amount = QString("%1 pack").arg(product->yeasts.at(i).y_amount, 1, 'f', 0); |
|
868 else if (product->yeasts.at(i).y_form == 1 || product->yeasts.at(i).y_form == 6) |
|
869 amount = QString("%1 gr").arg(product->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); |
|
870 else |
|
871 amount = QString("%1 ml").arg(product->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); |
|
872 |
|
873 painter.fillRect( 0, y, 735, 20, y_line); |
|
874 painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, product->yeasts.at(i).y_laboratory + " " + |
|
875 product->yeasts.at(i).y_product_id + " (" + |
|
876 product->yeasts.at(i).y_name + ")"); |
|
877 painter.drawText(340, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->yeasts.at(i).y_attenuation, 1, 'f', 1)); |
|
878 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, yeast_forms[product->yeasts.at(i).y_form]); |
|
879 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, yeast_use[product->yeasts.at(i).y_use]); |
|
880 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); |
|
881 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
|
882 y += 20; |
|
883 } |
|
884 if (product->starter_enable && product->prop_volume[0]) { |
|
885 int st = 0; |
|
886 double sv = 0; |
|
887 for (int i = 0; i < 4; i++) { |
|
888 if (product->prop_volume[i] > 0.0) { |
|
889 st++; |
|
890 if (product->prop_volume[i] > sv) |
|
891 sv = product->prop_volume[i]; |
|
892 } |
|
893 } |
|
894 painter.fillRect( 0, y, 735, 20, y_line); |
|
895 painter.drawText( 0, y+4, 260, 20, Qt::AlignLeft, QString(tr("%1 step yeaststarter")).arg(st)); |
|
896 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, QString(tr("Before"))); |
|
897 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, QString("%1 L").arg(sv, 1, 'f', 3)); |
|
898 y += 20; |
|
899 } |
|
900 painter.fillRect(670, y, 60, 20, c_line1); |
|
901 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_yeasts, 1, 'f', 3)); |
|
902 |
|
903 if ((y + 80 + (product->miscs.size() * 20)) > painter.device()->height()) { /* Rows + header + footer + blank */ |
|
904 printer->newPage(); |
|
905 printHeader(&painter); |
|
906 y = 120; |
|
907 } else { |
|
908 y += 40; |
|
909 } |
|
910 |
|
911 /* Miscs */ |
|
912 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
913 painter.fillRect( 0, y, 735, 20, c_header); |
|
914 painter.drawText( 0, y+4, 410, 20, Qt::AlignLeft, tr("Misc ingredient")); |
|
915 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, tr("Type")); |
|
916 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, tr("Use at")); |
|
917 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, tr("Amount")); |
|
918 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, tr("Cost")); |
|
919 y += 20; |
|
920 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
921 double cost_miscs = 0; |
|
922 for (int i = 0; i < product->miscs.size(); i++) { |
|
923 double cost = product->miscs.at(i).m_amount * product->miscs.at(i).m_cost; |
|
924 cost_miscs += cost; |
|
925 |
|
926 if (product->miscs.at(i).m_use_use == 2) |
|
927 use = misc_uses[product->miscs.at(i).m_use_use] + QString(" %1 min").arg(product->miscs.at(i).m_time); |
|
928 else |
|
929 use = misc_uses[product->miscs.at(i).m_use_use]; |
|
930 |
|
931 if (product->miscs.at(i).m_type == 4) // Water agent |
|
932 painter.fillRect( 0, y, 735, 20, mw_line); |
|
933 else if (product->miscs.at(i).m_type == 3) // Fining |
|
934 painter.fillRect( 0, y, 735, 20, mf_line); |
|
935 else if (product->miscs.at(i).m_type < 3 || product->miscs.at(i).m_type == 5) // Spice, Herb, Flavour, Yeast nutrient |
|
936 painter.fillRect( 0, y, 735, 20, ms_line); |
|
937 else |
|
938 painter.fillRect( 0, y, 735, 20, mo_line); |
|
939 painter.drawText( 0, y+4, 410, 20, Qt::AlignLeft, product->miscs.at(i).m_name); |
|
940 painter.drawText(415, y+4, 90, 20, Qt::AlignLeft, misc_types[product->miscs.at(i).m_type]); |
|
941 painter.drawText(510, y+4, 90, 20, Qt::AlignLeft, use); |
|
942 painter.drawText(605, y+4, 60, 20, Qt::AlignRight, |
|
943 QString("%1 %2").arg(product->miscs.at(i).m_amount * 1000.0, 1, 'f', 1).arg(product->miscs.at(i).m_amount_is_weight ? "gr":"ml")); |
|
944 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); |
|
945 y += 20; |
|
946 } |
|
947 painter.fillRect(670, y, 60, 20, c_line1); |
|
948 painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost_miscs, 1, 'f', 3)); |
|
949 |
|
950 if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { /* Rows + header + blank */ |
|
951 printer->newPage(); |
|
952 printHeader(&painter); |
|
953 y = 120; |
|
954 } else { |
|
955 y += 40; |
|
956 } |
|
957 |
|
958 /* Mash */ |
|
959 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
960 painter.fillRect( 0, y, 735, 20, c_header); |
|
961 painter.drawText( 0, y+4, 160, 20, Qt::AlignLeft, tr("Mash step")); |
|
962 painter.drawText(165, y+4, 90, 20, Qt::AlignLeft, tr("Step type")); |
|
963 painter.drawText(260, y+4, 60, 20, Qt::AlignRight, tr("Start °C")); |
|
964 painter.drawText(325, y+4, 60, 20, Qt::AlignRight, tr("End °C")); |
|
965 painter.drawText(390, y+4, 60, 20, Qt::AlignRight, tr("Time")); |
|
966 painter.drawText(455, y+4, 60, 20, Qt::AlignRight, tr("Ramp")); |
|
967 painter.drawText(520, y+4, 60, 20, Qt::AlignRight, tr("L/kg")); |
|
968 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec L.")); |
|
969 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("Inf/dec °C")); |
|
970 y += 20; |
|
971 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
972 for (int i = 0; i < product->mashs.size(); i++) { |
|
973 painter.fillRect( 0, y, 735, 20, m_line); |
|
974 painter.drawText( 0, y+4, 160, 20, Qt::AlignLeft, product->mashs.at(i).step_name); |
|
975 painter.drawText(165, y+4, 90, 20, Qt::AlignLeft, step_types[product->mashs.at(i).step_type]); |
|
976 painter.drawText(260, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_temp, 1, 'f', 1)); |
|
977 painter.drawText(325, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).end_temp, 1, 'f', 1)); |
|
978 painter.drawText(390, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0)); |
|
979 painter.drawText(455, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).ramp_time, 1, 'f', 0)); |
|
980 painter.drawText(520, y+4, 60, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_wg_ratio, 1, 'f', 2)); |
|
981 if (product->mashs.at(i).step_type != 1) { |
|
982 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_amount, 1, 'f', 1)); |
|
983 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->mashs.at(i).step_infuse_temp, 1, 'f', 1)); |
|
984 } |
|
985 y += 20; |
|
986 } |
|
987 |
|
988 if ((y + 80 + ((product->w2_amount > 0) ? 40:0)) > painter.device()->height()) { /* waters + header + blank */ |
|
989 printer->newPage(); |
|
990 printHeader(&painter); |
|
991 y = 120; |
|
992 } else { |
|
993 y += 40; |
|
994 } |
|
995 |
|
996 /* Water */ |
|
997 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
998 painter.fillRect( 0, y, 735, 20, c_header); |
|
999 painter.drawText( 0, y+4, 135, 20, Qt::AlignLeft, tr("Water source")); |
|
1000 painter.drawText(135, y+4, 70, 20, Qt::AlignRight, tr("Volume")); |
|
1001 painter.drawText(210, y+4, 70, 20, Qt::AlignRight, tr("Ca")); |
|
1002 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, tr("Mg")); |
|
1003 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, tr("CaCO3")); |
|
1004 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, tr("Na")); |
|
1005 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, tr("Cl")); |
|
1006 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, tr("SO4")); |
|
1007 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, tr("pH")); |
|
1008 y += 20; |
|
1009 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
1010 painter.fillRect( 0, y, 735, 20, w_line); |
|
1011 painter.drawText( 0, y+4, 135, 20, Qt::AlignLeft, product->w1_name); |
|
1012 painter.drawText(135, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->w1_amount, 1, 'f', 1)); |
|
1013 painter.drawText(210, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_calcium, 1, 'f', 1)); |
|
1014 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_magnesium, 1, 'f', 1)); |
|
1015 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_total_alkalinity, 1, 'f', 1)); |
|
1016 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sodium, 1, 'f', 1)); |
|
1017 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_chloride, 1, 'f', 1)); |
|
1018 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_sulfate, 1, 'f', 1)); |
|
1019 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w1_ph, 1, 'f', 2)); |
|
1020 y += 20; |
|
1021 if (product->w2_amount > 0) { |
|
1022 /* |
|
1023 * If there is dillution water, show it and the mixed result too. |
|
1024 */ |
|
1025 painter.fillRect( 0, y, 735, 20, w_line); |
|
1026 painter.drawText( 0, y+4, 135, 20, Qt::AlignLeft, product->w2_name); |
|
1027 painter.drawText(135, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->w2_amount, 1, 'f', 1)); |
|
1028 painter.drawText(210, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_calcium, 1, 'f', 1)); |
|
1029 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_magnesium, 1, 'f', 1)); |
|
1030 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_total_alkalinity, 1, 'f', 1)); |
|
1031 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sodium, 1, 'f', 1)); |
|
1032 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_chloride, 1, 'f', 1)); |
|
1033 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_sulfate, 1, 'f', 1)); |
|
1034 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->w2_ph, 1, 'f', 2)); |
|
1035 y += 20; |
|
1036 painter.fillRect( 0, y, 735, 20, w_line); |
|
1037 painter.drawText( 0, y+4, 135, 20, Qt::AlignLeft, tr("Mixed water")); |
|
1038 painter.drawText(135, y+4, 70, 20, Qt::AlignRight, QString("%1 L").arg(product->wg_amount, 1, 'f', 1)); |
|
1039 painter.drawText(210, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_calcium, 1, 'f', 1)); |
|
1040 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_magnesium, 1, 'f', 1)); |
|
1041 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_total_alkalinity, 1, 'f', 1)); |
|
1042 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_sodium, 1, 'f', 1)); |
|
1043 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_chloride, 1, 'f', 1)); |
|
1044 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_sulfate, 1, 'f', 1)); |
|
1045 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wg_ph, 1, 'f', 2)); |
|
1046 y += 20; |
|
1047 } |
|
1048 painter.fillRect( 0, y, 735, 20, w_line); |
|
1049 painter.drawText( 0, y+4, 135, 20, Qt::AlignLeft, tr("Treated water")); |
|
1050 painter.drawText(210, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_calcium, 1, 'f', 1)); |
|
1051 painter.drawText(285, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_magnesium, 1, 'f', 1)); |
|
1052 painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_total_alkalinity, 1, 'f', 1)); |
|
1053 painter.drawText(435, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sodium, 1, 'f', 1)); |
|
1054 painter.drawText(510, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_chloride, 1, 'f', 1)); |
|
1055 painter.drawText(585, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_sulfate, 1, 'f', 1)); |
|
1056 painter.drawText(660, y+4, 70, 20, Qt::AlignRight, QString("%1").arg(product->wb_ph, 1, 'f', 2)); |
|
1057 y += 20; |
|
1058 |
|
1059 /* |
|
1060 * Print product notes if present. |
|
1061 */ |
|
1062 if (product->notes.length()) { |
|
1063 QStringList lines = product->notes.split("\n"); |
|
1064 |
|
1065 if (lines.size() && product->notes != "") { |
|
1066 if ((y + 80 + (lines.size() * 20)) > painter.device()->height()) { |
|
1067 printer->newPage(); |
|
1068 printHeader(&painter); |
|
1069 y = 120; |
|
1070 } else { |
|
1071 y += 40; |
|
1072 } |
|
1073 |
|
1074 /* Notes header */ |
|
1075 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
1076 painter.setPen(Qt::black); |
|
1077 painter.fillRect( 0, y, 735, 20, c_header); |
|
1078 painter.drawText( 0, y+4, 735, 20, Qt::AlignCenter, tr("Recipe notes")); |
|
1079 y += 20; |
|
1080 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
1081 for (int i = 0; i < lines.size(); i++) { |
|
1082 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1083 painter.drawText( 0, y+4, 735, 20, Qt::AlignLeft, lines[i]); |
|
1084 y += 20; |
|
1085 } |
|
1086 } |
|
1087 } |
|
1088 |
|
1089 if (product->stage > PROD_STAGE_BREW) { |
|
1090 if ((y + 100) > painter.device()->height()) { |
|
1091 printer->newPage(); |
|
1092 printHeader(&painter); |
|
1093 y = 120; |
668 } else { |
1094 } else { |
669 y += 40; |
1095 y += 40; |
670 } |
1096 } |
671 |
1097 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
672 /* Notes header */ |
|
673 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
674 painter.setPen(Qt::black); |
1098 painter.setPen(Qt::black); |
675 painter.fillRect( 0, y, 735, 20, c_header); |
1099 painter.fillRect( 0, y, 735, 20, c_header); |
676 painter.drawText( 0, y+4, 735, 20, Qt::AlignCenter, tr("Recipe notes")); |
1100 painter.drawText( 0, y+2, 735, 20, Qt::AlignCenter, tr("Product brewday")); |
|
1101 y += 20; |
|
1102 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
1103 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1104 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Brewday start")); |
|
1105 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->brew_date_start.toString("dd MMM yyyy hh:mm")); |
|
1106 painter.fillRect(435, y, 300, 20, c_line1); |
|
1107 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Brewday end")); |
|
1108 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, product->brew_date_end.toString("dd MMM yyyy hh:mm")); |
|
1109 |
|
1110 /* Mash history */ |
|
1111 if ((y + 60 + (product->mashs.size() * 20)) > painter.device()->height()) { |
|
1112 printer->newPage(); |
|
1113 printHeader(&painter); |
|
1114 y = 120; |
|
1115 } else { |
|
1116 y += 40; |
|
1117 } |
|
1118 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
1119 painter.fillRect( 0, y, 735, 20, m_line); |
|
1120 painter.drawText( 30, y+4, 260, 20, Qt::AlignLeft, tr("Mash step")); |
|
1121 painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, tr("Step type")); |
|
1122 painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, tr("Temperature")); |
|
1123 painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, tr("Minutes")); |
|
1124 painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, tr("SG")); |
|
1125 painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, tr("pH")); |
|
1126 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
1127 y += 20; |
|
1128 for (int i = 0; i < product->mashs.size(); i++) { |
|
1129 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1130 painter.drawText( 0, y+4, 30, 20, Qt::AlignCenter, QString("%1").arg(i + 1)); |
|
1131 painter.drawText( 30, y+4, 260, 20, Qt::AlignLeft, product->mashs.at(i).step_name); |
|
1132 painter.drawText(290, y+4, 120, 20, Qt::AlignLeft, step_types[product->mashs.at(i).step_type]); |
|
1133 painter.drawText(400, y+4, 110, 20, Qt::AlignLeft, QString("%1 - %2°C"). |
|
1134 arg(product->mashs.at(i).step_temp, 1, 'f', 1).arg(product->mashs.at(i).end_temp, 1, 'f', 1)); |
|
1135 painter.drawText(510, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_time, 1, 'f', 0)); |
|
1136 painter.drawText(585, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_sg, 1, 'f', 3)); |
|
1137 painter.drawText(660, y+4, 75, 20, Qt::AlignLeft, QString("%1").arg(product->mashs.at(i).step_ph, 1, 'f', 1)); |
|
1138 y += 20; |
|
1139 } |
|
1140 |
|
1141 /* Brew history */ |
|
1142 if ((y + 470) > painter.device()->height()) { |
|
1143 printer->newPage(); |
|
1144 printHeader(&painter); |
|
1145 y = 120; |
|
1146 } else { |
|
1147 y += 20; |
|
1148 } |
|
1149 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
1150 painter.fillRect( 0, y, 735, 20, m_line); |
|
1151 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Brew item")); |
|
1152 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, tr("Expected")); |
|
1153 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, tr("Reached")); |
|
1154 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, tr("Difference")); |
|
1155 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
|
1156 y += 20; |
|
1157 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1158 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Mash pH")); |
|
1159 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->mash_ph, 1, 'f', 2)); |
|
1160 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_mash_ph, 1, 'f', 2)); |
|
1161 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->mash_ph, product->brew_mash_ph, 2, " pH")); |
|
1162 y += 20; |
|
1163 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1164 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Mash density")); |
|
1165 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_mash_sg)); |
|
1166 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_mash_sg)); |
|
1167 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_mash_sg, product->brew_mash_sg, 3, " SG")); |
|
1168 y += 20; |
|
1169 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1170 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Mash efficiency")); |
|
1171 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, "100%"); |
|
1172 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_mash_efficiency, 1, 'f', 1)); |
|
1173 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(100.0, product->brew_mash_efficiency, 1, "%")); |
|
1174 y += 20; |
|
1175 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1176 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Sparge pH")); |
|
1177 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->sparge_ph, 1, 'f', 2)); |
|
1178 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_sparge_ph, 1, 'f', 2)); |
|
1179 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->sparge_ph, product->brew_sparge_ph, 2, " pH")); |
|
1180 y += 25; |
|
1181 |
|
1182 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1183 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Pre boil pH")); |
|
1184 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2)); |
|
1185 y += 20; |
|
1186 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1187 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Pre boil density")); |
|
1188 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->preboil_sg)); |
|
1189 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_preboil_sg)); |
|
1190 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->preboil_sg, product->brew_preboil_sg, 3, " SG")); |
|
1191 y += 20; |
|
1192 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1193 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Pre boil volume")); |
|
1194 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->boil_size * 1.04, 1, 'f', 1)); |
|
1195 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_preboil_volume, 1, 'f', 1)); |
|
1196 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->boil_size * 1.04, product->brew_preboil_volume, 1, " L")); |
|
1197 y += 20; |
|
1198 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1199 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Pre boil efficiency")); |
|
1200 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1)); |
|
1201 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_preboil_efficiency, 1, 'f', 1)); |
|
1202 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_preboil_efficiency, 1, "%")); |
|
1203 y += 25; |
|
1204 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1205 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("After boil pH")); |
|
1206 //painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_preboil_ph, 1, 'f', 2)); |
|
1207 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 pH").arg(product->brew_aboil_ph, 1, 'f', 2)); |
|
1208 y += 20; |
|
1209 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1210 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("After boil density")); |
|
1211 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og)); |
|
1212 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_aboil_sg)); |
|
1213 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_aboil_sg, 3, " SG")); |
|
1214 y += 20; |
|
1215 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1216 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("After boil volume")); |
|
1217 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size * 1.04, 1, 'f', 1)); |
|
1218 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_aboil_volume, 1, 'f', 1)); |
|
1219 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size * 1.04, product->brew_aboil_volume, 1, " L")); |
|
1220 y += 20; |
|
1221 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1222 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("After boil efficiency")); |
|
1223 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->efficiency, 1, 'f', 1)); |
|
1224 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1%").arg(product->brew_aboil_efficiency, 1, 'f', 1)); |
|
1225 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->efficiency, product->brew_aboil_efficiency, 1, "%")); |
|
1226 y += 25; |
|
1227 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1228 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Chiller and trub loss")); |
|
1229 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_trub_chiller_loss, 1, 'f', 1)); |
|
1230 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_tcloss, 1, 'f', 1)); |
|
1231 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_trub_chiller_loss, product->brew_fermenter_tcloss, 1, " L")); |
|
1232 y += 20; |
|
1233 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1234 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Top up water")); |
|
1235 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->eq_top_up_water, 1, 'f', 1)); |
|
1236 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_extrawater, 1, 'f', 1)); |
|
1237 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->eq_top_up_water, product->brew_fermenter_extrawater, 1, " L")); |
|
1238 y += 20; |
|
1239 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1240 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Fermenter volume")); |
|
1241 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->batch_size - product->eq_trub_chiller_loss, 1, 'f', 1)); |
|
1242 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 L").arg(product->brew_fermenter_volume, 1, 'f', 1)); |
|
1243 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->batch_size - product->eq_trub_chiller_loss, product->brew_fermenter_volume, 1, " L")); |
|
1244 y += 20; |
|
1245 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1246 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Fermenter density")); |
|
1247 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, strDensity(product->est_og)); |
|
1248 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, strDensity(product->brew_fermenter_sg)); |
|
1249 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_og, product->brew_fermenter_sg, 3, " SG")); |
|
1250 y += 20; |
|
1251 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1252 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Fermenter color")); |
|
1253 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->est_color, 1, 'f', 0)); |
|
1254 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 EBC").arg(product->brew_fermenter_color, 1, 'f', 0)); |
|
1255 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_color, product->brew_fermenter_color, 0, " EBC")); |
|
1256 y += 20; |
|
1257 painter.fillRect( 0, y, 735, 20, c_line1); |
|
1258 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Fermenter IBU")); |
|
1259 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->est_ibu, 1, 'f', 0)); |
|
1260 painter.drawText(450, y+4, 200, 20, Qt::AlignLeft, QString("%1 IBU").arg(product->brew_fermenter_ibu, 1, 'f', 0)); |
|
1261 painter.drawText(650, y+4, 85, 20, Qt::AlignLeft, strDiff(product->est_ibu, product->brew_fermenter_ibu, 0, " IBU")); |
|
1262 y += 25; |
|
1263 painter.fillRect( 0, y, 450, 20, c_line1); |
|
1264 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Cooling method")); |
|
1265 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, cooling_method[product->brew_cooling_method]); |
|
1266 y += 20; |
|
1267 painter.fillRect( 0, y, 450, 20, c_line1); |
|
1268 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Cooling temperature")); |
|
1269 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1°C").arg(product->brew_cooling_to, 1, 'f', 1)); |
|
1270 y += 20; |
|
1271 painter.fillRect( 0, y, 450, 20, c_line1); |
|
1272 painter.drawText( 0, y+4, 250, 20, Qt::AlignLeft, tr("Cooling time")); |
|
1273 painter.drawText(250, y+4, 200, 20, Qt::AlignLeft, QString("%1 min").arg(product->brew_cooling_time, 1, 'f', 0)); |
|
1274 } |
|
1275 |
|
1276 if (product->stage > PROD_STAGE_TERTIARY) { |
|
1277 if ((y + 200) > painter.device()->height()) { |
|
1278 printer->newPage(); |
|
1279 printHeader(&painter); |
|
1280 y = 120; |
|
1281 } else { |
|
1282 y += 40; |
|
1283 } |
|
1284 painter.setFont(QFont("Helvetica", 9, QFont::Bold)); |
|
1285 painter.setPen(Qt::black); |
|
1286 painter.fillRect( 0, y, 735, 20, c_header); |
|
1287 painter.drawText( 0, y+2, 735, 20, Qt::AlignCenter, tr("Product fermentation")); |
677 y += 20; |
1288 y += 20; |
678 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
1289 painter.setFont(QFont("Helvetica", 9, QFont::Normal)); |
679 for (int i = 0; i < lines.size(); i++) { |
1290 painter.fillRect( 0, y, 300, 20, c_line1); |
680 painter.fillRect( 0, y, 735, 20, c_line1); |
1291 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Primary start temp")); |
681 painter.drawText( 0, y+4, 735, 20, Qt::AlignLeft, lines[i]); |
1292 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_start_temp, 1, 'f', 1)); |
682 y += 20; |
1293 painter.fillRect(435, y, 300, 20, c_line1); |
683 } |
1294 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Primary peak temp")); |
|
1295 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_max_temp, 1, 'f', 1)); |
|
1296 y += 20; |
|
1297 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1298 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Primary end temp")); |
|
1299 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->primary_end_temp, 1, 'f', 1)); |
|
1300 painter.fillRect(435, y, 300, 20, c_line1); |
|
1301 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Primary density")); |
|
1302 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->primary_end_sg, 1, 'f', 3)); |
|
1303 y += 20; |
|
1304 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1305 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Primary end date")); |
|
1306 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->primary_end_date.toString("dd MMM yyyy")); |
|
1307 y += 20; |
|
1308 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1309 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Secondary end temp")); |
|
1310 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->secondary_temp, 1, 'f', 1)); |
|
1311 painter.fillRect(435, y, 300, 20, c_line1); |
|
1312 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Secondary density")); |
|
1313 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->secondary_end_sg, 1, 'f', 3)); |
|
1314 y += 20; |
|
1315 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1316 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Secondary end date")); |
|
1317 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->secondary_end_date.toString("dd MMM yyyy")); |
|
1318 y += 20; |
|
1319 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1320 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Tertiary temperature")); |
|
1321 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, QString("%1°C").arg(product->tertiary_temp, 1, 'f', 1)); |
|
1322 painter.fillRect(435, y, 300, 20, c_line1); |
|
1323 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Final density")); |
|
1324 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1 SG").arg(product->fg, 1, 'f', 3)); |
|
1325 y += 20; |
|
1326 painter.fillRect( 0, y, 300, 20, c_line1); |
|
1327 painter.drawText( 0, y+4, 120, 20, Qt::AlignLeft, tr("Tertiary end date")); |
|
1328 painter.drawText(120, y+4, 180, 20, Qt::AlignLeft, product->package_date.toString("dd MMM yyyy")); |
|
1329 painter.fillRect(435, y, 300, 20, c_line1); |
|
1330 painter.drawText(435, y+4, 120, 20, Qt::AlignLeft, tr("Apperant attenuation")); |
|
1331 painter.drawText(555, y+4, 180, 20, Qt::AlignLeft, QString("%1%").arg(Utils::calc_svg(product->brew_fermenter_sg, product->fg), 1, 'f', 1)); |
|
1332 } |
|
1333 |
|
1334 if (product->stage > PROD_STAGE_PACKAGE) { |
|
1335 |
|
1336 } |
|
1337 |
|
1338 if (product->stage > PROD_STAGE_TASTE) { |
|
1339 |
684 } |
1340 } |
685 } |
1341 } |
686 |
1342 |
687 painter.end(); |
1343 painter.end(); |
688 } |
1344 } |
689 |
1345 |
|
1346 |
|
1347 QString PrinterDialog::strDiff(double v1, double v2, int decimals, QString suffix) |
|
1348 { |
|
1349 return QString("%1%2%3").arg((v2 > v1) ? "+":"").arg(v2 - v1, 1, 'f', decimals).arg(suffix); |
|
1350 } |
|
1351 |
|
1352 |
|
1353 QString PrinterDialog::strDensity(double density) |
|
1354 { |
|
1355 return QString("%1 SG %2°Brix %3°P").arg(density, 1, 'f', 3).arg(Utils::sg_to_brix(density), 1, 'f', 1).arg(Utils::sg_to_plato(density), 1, 'f', 1); |
|
1356 } |
690 |
1357 |
691 |
1358 |
692 void PrinterDialog::printHeader(QPainter *painter) |
1359 void PrinterDialog::printHeader(QPainter *painter) |
693 { |
1360 { |
694 QPixmap outPixmap = QPixmap(); |
1361 QPixmap outPixmap = QPixmap(); |