Exemple #1
0
        private void Doc_PrintPage_retouching(object sender, PrintPageEventArgs e)
        {
            float x = e.MarginBounds.Left;
            float y = e.MarginBounds.Top;

            this.pblabel.Width  = 100;
            this.pblabel.Height = 100;

            Bitmap bmp = new Bitmap(this.pblabel.Width, this.pblabel.Height);

            this.pblabel.DrawToBitmap(bmp, new Rectangle(0, 0, this.pblabel.Width, this.pblabel.Height));
            // e.Graphics.DrawImage((Image)bmp, x, y);
            e.Graphics.DrawImage((Image)bmp, 30, 45);


            String          intlotcode = "";
            String          grade      = "";
            double          rweight    = 0;
            String          remark     = "";
            MainMenu        frm        = new MainMenu();
            List <object[]> data       = new List <object[]>();

            data = frm.get_data_table_string("tbretouchingdetails", "loin_number", loinnumber);
            if (data.Count > 0)
            {
                intlotcode = data[0][1].ToString();
                grade      = data[0][4].ToString();
                rweight    = double.Parse(data[0][5].ToString());
                remark     = data[0][6].ToString();
            }

            String asfis  = "";
            String suprec = "";

            String[] suppcode;
            String   suppliercode = "";
            String   cert         = "";

            data = frm.get_data_table_string("tbreceiving", "intlotcode", intlotcode);
            if (data.Count > 0)
            {
                asfis        = data[0][2].ToString();
                suprec       = data[0][5].ToString();
                suppcode     = suprec.Split('-');
                suppliercode = suppcode[1].ToString();
                cert         = data[0][6].ToString();
            }


            String origin         = "";
            String fishing_ground = "";

            String certcode = "";

            data = frm.get_data_table_string("tbsupplier", "suppcode", suppliercode);
            if (data.Count > 0)
            {
                origin         = data[0][9].ToString();
                fishing_ground = data[0][7].ToString();
                certcode       = data[0][13].ToString();
            }

            String loincode = loinnumber;


            DateTime cutdate;
            String   cutdatestr = "";

            data = frm.get_data_table_string("tbcuttingdetails", "intlotcode", intlotcode);
            if (data.Count > 0)
            {
                cutdate    = DateTime.Parse(data[0][2].ToString());
                cutdatestr = cutdate.ToString("yyyy-MM-dd");
            }
            else
            {
                List <object[]> data1 = new List <object[]>();
                data1      = frm.get_data_table_string("tbreceiving", "intlotcode", intlotcode);
                cutdate    = DateTime.Parse(data1[0][4].ToString());
                cutdatestr = cutdate.ToString("yyyy-MM-dd");
            }

            String productname = "";

            data = frm.get_data_table_string("tbretouching", "intlotcode", intlotcode);
            if (data.Count > 0)
            {
                productname = data[0][2].ToString();
            }

            String grupsize = "";

            data = frm.get_grupsize_loin(rweight);
            if (data.Count > 0)
            {
                grupsize = data[0][0].ToString();
            }

            /*
             * List<object[]> dataretouching = new List<object[]>();
             * dataretouching= get_dataretouching(intlotcode, rweight, remark);
             */

            //e.Graphics.DrawString(loincode, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 30, 155);

            e.Graphics.DrawString(loincode, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 38, 145);

            String textfrozen = "Keep Frozen -18\u00b0C";

            e.Graphics.DrawString(textfrozen, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 160);


            e.Graphics.DrawString(grade, new Font("Arial", 20, FontStyle.Bold), Brushes.Black, 35, 10);
            e.Graphics.DrawString(grupsize, new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 35, 35);

            //e.Graphics.DrawString(grade, new Font("Arial", 20, FontStyle.Bold), Brushes.Black, 34, 15);

            String datalabel;

            datalabel = "Species";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 20);
            datalabel = asfis;
            e.Graphics.DrawString(datalabel, new Font("Arial", 14, FontStyle.Bold), Brushes.Black, 150, 35);

            datalabel = "Grade";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 215, 20);

            datalabel = grade;
            e.Graphics.DrawString(datalabel, new Font("Arial", 14, FontStyle.Bold), Brushes.Black, 215, 35);

            datalabel = "Weight (Kg)";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 297, 20);
            datalabel = rweight.ToString();
            e.Graphics.DrawString(datalabel, new Font("Arial", 14, FontStyle.Bold), Brushes.Black, 297, 35);


            //e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 140, 60);

            datalabel = "Internal Lot Code";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 148, 60);

            datalabel = intlotcode;
            e.Graphics.DrawString(datalabel, new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 145, 75);

            datalabel = "Remark";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 316, 60);

            datalabel = remark;
            e.Graphics.DrawString(datalabel, new Font("Arial", 13, FontStyle.Bold), Brushes.Black, 315, 75);

            datalabel = "Origin";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 100);

            datalabel = origin;
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 115);

            datalabel = "Fishing Ground";
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 215, 100);

            datalabel = fishing_ground;
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 220, 115);

            datalabel = "Processing Date: " + cutdatestr;
            e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 130);

            if (!cert.Equals("") && !certcode.Equals(""))
            {
                datalabel = cert + " Code: " + certcode;
                e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 145);
            }
            e.Graphics.DrawString(cert, new Font("Arial", 20, FontStyle.Bold), Brushes.Black, 60, 160);
            e.Graphics.DrawString(productname, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 150, 175);

/*
 *          e.Graphics.DrawString(loincode, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 38, 145);
 *          e.Graphics.DrawString(grade, new Font("Arial", 20, FontStyle.Bold), Brushes.Black, 50, 15);
 *
 *          String datalabel;
 *          datalabel = "Asfis";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 20);
 *          datalabel = asfis;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 35);
 *
 *          datalabel = "Grade";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 237, 20);
 *
 *          datalabel = grade;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 237, 35);
 *
 *          datalabel = "Weight";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 297, 20);
 *          datalabel = rweight.ToString() + " (Kg)";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 297, 35);
 *
 *
 *          //e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 140, 60);
 *
 *          datalabel = "Lot code";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 55);
 *
 *          datalabel = intlotcode;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 70);
 *
 *
 *          datalabel = "Remark";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 297, 55);
 *
 *          datalabel = remark;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 297, 70);
 *
 *          datalabel = "Origin";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 90);
 *
 *          datalabel = origin;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 105);
 *
 *          datalabel = "Fishing Ground";
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 260, 90);
 *
 *          datalabel = fishing_ground;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 260, 105);
 *
 *          datalabel = "Processing Date: " + cutdatestr;
 *          e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 125);
 *
 *          if (!cert.Equals(""))
 *          {
 *              datalabel = "FT Code: " + certcode;
 *              e.Graphics.DrawString(datalabel, new Font("Arial", 8, FontStyle.Bold), Brushes.Black, 180, 145);
 *          }
 *
 */
        }