Exemplo n.º 1
0
 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
 {
     e.Graphics.DrawString("Noona's Store", new Font("Georgia", 12, FontStyle.Bold), Brushes.DarkOrange, new Point(100));
     e.Graphics.DrawString("Harga Produk Total :", new Font("Georgia", 8, FontStyle.Bold), Brushes.DarkOrange, new Point(100, 40));
     foreach (DataGridViewRow row in BillDGV.Rows)
     {
         productid    = Convert.ToInt32(row.Cells["Column1"].Value);
         productname  = "" + row.Cells["Column2"].Value;
         productprice = Convert.ToInt32(row.Cells["Column3"].Value);
         productqty   = Convert.ToInt32(row.Cells["Column4"].Value);
         totall       = Convert.ToInt32(row.Cells["Column5"].Value);
         e.Graphics.DrawString("" + productid, new Font("Georgia", 8, FontStyle.Regular), Brushes.SandyBrown, new Point(26, pos));
         e.Graphics.DrawString("" + productname, new Font("Georgia", 8, FontStyle.Regular), Brushes.SandyBrown, new Point(45, pos));
         e.Graphics.DrawString("" + productprice, new Font("Georgia", 8, FontStyle.Regular), Brushes.SandyBrown, new Point(200, pos));
         e.Graphics.DrawString("" + productqty, new Font("Georgia", 8, FontStyle.Regular), Brushes.SandyBrown, new Point(240, pos));
         e.Graphics.DrawString("" + totall, new Font("Georgia", 8, FontStyle.Regular), Brushes.SandyBrown, new Point(275, pos));
         pos += 20;
     }
     e.Graphics.DrawString("Grand Total: Rp " + GrandTotal + " ribu", new Font("Georgia", 10, FontStyle.Bold), Brushes.Salmon, new Point(150, pos + 50));
     e.Graphics.DrawString("Terimakasih sudah berbelanja, bahagia selalu^^", new Font("Georgia", 8, FontStyle.Bold), Brushes.Salmon, new Point(100, pos + 85));
     e.Graphics.DrawString("-----------Noona's Store-----------", new Font("Georgia", 8, FontStyle.Bold), Brushes.Salmon, new Point(170, pos + 120));
     BillDGV.Rows.Clear();
     BillDGV.Refresh();
     pos        = 100;
     GrandTotal = 0;
 }
Exemplo n.º 2
0
 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
 {
     e.Graphics.DrawString("Book Shop", new Font("Century Gothic", 12, FontStyle.Bold), Brushes.Red, new Point(80));
     e.Graphics.DrawString("ID PRODUCT PRICE QUANTITY TOTAL", new Font("Century Gothic", 10, FontStyle.Bold), Brushes.Red, new Point(26, 40));
     foreach (DataGridViewRow row in BillDGV.Rows)
     {
         prodid    = Convert.ToInt32(row.Cells["Column1"].Value);
         prodname  = "" + row.Cells["Column2"].Value;
         prodprice = Convert.ToInt32(row.Cells["Column3"].Value);
         prodqty   = Convert.ToInt32(row.Cells["Column4"].Value);
         tottal    = Convert.ToInt32(row.Cells["Column5"].Value);
         e.Graphics.DrawString("" + prodid, new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(26, pos));
         e.Graphics.DrawString("" + prodname, new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(45, pos));
         e.Graphics.DrawString("" + prodprice, new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(120, pos));
         e.Graphics.DrawString("" + prodqty, new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(170, pos));
         e.Graphics.DrawString("" + tottal, new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(235, pos));
         pos = pos + 20;
     }
     e.Graphics.DrawString("Grand Total: RS" + Grdtotal, new Font("Century Gothic", 12, FontStyle.Bold), Brushes.Crimson, new Point(60, pos + 50));
     e.Graphics.DrawString("***********BookStore***********", new Font("Century Gothic", 10, FontStyle.Bold), Brushes.Crimson, new Point(40, pos + 85));
     BillDGV.Rows.Clear();
     BillDGV.Refresh();
     pos      = 100;
     Grdtotal = 0;
 }