01.
Private
Sub
PrintDocument1_PrintPage(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.Drawing.Printing.PrintPageEventArgs)
Handles
PrintDocument1.PrintPage
02.
03.
Dim
column(8)
As
Integer
04.
column(1) = 10
05.
column(2) = 70
06.
column(3) = 160
07.
column(4) = 320
08.
column(5) = 430
09.
column(6) = 530
10.
column(7) = 120
11.
column(8) = 570
12.
13.
Dim
font
As
New
Font(
"Cordia New"
, 14, FontStyle.Bold)
14.
Dim
font1
As
New
Font(
"Cordia New"
, 18, FontStyle.Bold)
15.
Dim
font2
As
New
Font(
"Cordia New"
, 14)
16.
e.Graphics.DrawString(
"ร้านปัญญารุ่งเรืองการค้า"
, font1, Brushes.Black, column(1), 20)
17.
e.Graphics.DrawString(
"โทร : 087-975-5125"
, font2, Brushes.Black, column(1), 48)
18.
e.Graphics.DrawString(
"เลขที่ใบเสร็จ : "
+ frm_productsale.lbl_receipt_no.Text, font2, Brushes.Black, column(1), 69)
19.
e.Graphics.DrawString(
"วันที่ : "
+ frm_productsale.lbl_receipt_date.Text, font2, Brushes.Black, column(1), 87)
20.
e.Graphics.DrawString(frm_productsale.lbl_time.Text, font2, Brushes.Black, column(7), 87)
21.
e.Graphics.DrawLine(Pens.Black, column(1), 110, 610, 110)
22.
23.
Dim
line
As
Integer
= 120
24.
Dim
line1
As
Integer
= 105
25.
26.
e.Graphics.DrawString(
"ลำดับ"
, font2, Brushes.Black, column(1), line)
27.
e.Graphics.DrawString(
"รหัสสินค้า"
, font2, Brushes.Black, column(2), line)
28.
e.Graphics.DrawString(
"รายการสินค้า"
, font2, Brushes.Black, column(3), line)
29.
e.Graphics.DrawString(
"จำนวนสินค้า"
, font2, Brushes.Black, column(4), line)
30.
e.Graphics.DrawString(
"ราคาสินค้า"
, font2, Brushes.Black, column(5), line)
31.
e.Graphics.DrawString(
"ราคารวม"
, font2, Brushes.Black, column(6), line)
32.
33.
For
i
As
Integer
= 0
To
frm_productsale.list_view_sale.Items.Count - 1
34.
line += 20
35.
Dim
print_out(8)
As
String
36.
With
frm_productsale.list_view_sale
37.
print_out(1) = .Items(i).SubItems(0).Text
38.
print_out(2) = .Items(i).SubItems(1).Text
39.
print_out(3) = .Items(i).SubItems(2).Text
40.
print_out(4) = .Items(i).SubItems(3).Text
41.
print_out(5) = .Items(i).SubItems(4).Text
42.
print_out(6) = .Items(i).SubItems(5).Text
43.
44.
45.
46.
End
With
47.
48.
e.Graphics.DrawString(print_out(1), font2, Brushes.Black, column(1), line)
49.
e.Graphics.DrawString(print_out(2), font2, Brushes.Black, column(2), line)
50.
e.Graphics.DrawString(print_out(3), font2, Brushes.Black, column(3), line)
51.
e.Graphics.DrawString(print_out(4), font2, Brushes.Black, column(4), line)
52.
e.Graphics.DrawString(print_out(5), font2, Brushes.Black, column(5), line)
53.
e.Graphics.DrawString(print_out(6), font2, Brushes.Black, column(6), line)
54.
55.
Next
56.
line += 35
57.
e.Graphics.DrawLine(Pens.Black, column(1), line, 610, line)
58.
line += 9
59.
e.Graphics.DrawString(
"ราคารวม "
& frm_productsale.txt_total.Text &
""
, font, Brushes.Black, column(5), line)
60.
e.Graphics.DrawString(
"บาท "
, font, Brushes.Black, column(8), line)
61.
line += 20
62.
e.Graphics.DrawString(
"เงินที่รับมา "
& txt_receive.Text &
""
, font, Brushes.Black, column(5), line)
63.
e.Graphics.DrawString(
"บาท "
, font, Brushes.Black, column(8), line)
64.
line += 20
65.
e.Graphics.DrawString(
"เงินทอน "
& txt_change.Text &
""
, font, Brushes.Black, column(5), line)
66.
e.Graphics.DrawString(
"บาท "
, font, Brushes.Black, column(8), line)
67.
End
Sub