Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub prtReceipt_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles prtReceipt.PrintPage
- Dim x, y, FontHeight As Integer
- Dim HeadingFont As New Font("Britannic Bold", 16, FontStyle.Bold)
- Dim SubHeadingFont As New Font("Calibri (body)", 13, FontStyle.Regular)
- Dim MyFont As New Font("Calibri (body)", 10, FontStyle.Regular)
- Dim ListFont As New Font("Courier New", 10, FontStyle.Regular)
- Dim StockListFormat As String = "{0,-10}{1,-20}{2,-10}"
- Dim Printline As String
- FontHeight = HeadingFont.GetHeight(e.Graphics)
- x = 5
- y = 70
- e.Graphics.DrawString("Central Games Receipt", HeadingFont, Brushes.DarkRed, x, y)
- x = 10
- y = y + FontHeight + 20
- Printline = ""
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight + 10
- Printline = "Customer Details "
- e.Graphics.DrawString(Printline, SubHeadingFont, Brushes.Black, x, y)
- FontHeight = SubHeadingFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = "CustomerID: " & cboCustomerID.Text
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- FileOpen(3, CustomerFilename, OpenMode.Random,,, Len(CustomerDetails))
- While Not EOF(3)
- FileGet(3, CustomerDetails)
- If CInt(cboCustomerID.Text) = CustomerDetails.CustomerID Then
- FontHeight = MyFont.GetHeight(e.Graphics)
- Printline = "Name: " & CustomerDetails.Name
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- y = y + FontHeight
- Printline = "Address: " & CustomerDetails.Address
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- y = y + FontHeight
- Printline = "Postcode: " & CustomerDetails.Postcode
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- y = y + FontHeight
- Printline = "Phone Number: " & CustomerDetails.phone
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- y = y + FontHeight
- Printline = "Email: " & CustomerDetails.email
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- End If
- End While
- FileClose(3)
- y = y + FontHeight
- Printline = ""
- e.Graphics.DrawString(Printline, SubHeadingFont, Brushes.Black, x, y)
- FontHeight = SubHeadingFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = "Order Details"
- e.Graphics.DrawString(Printline, SubHeadingFont, Brushes.Black, x, y)
- FontHeight = SubHeadingFont.GetHeight(e.Graphics)
- y = y + FontHeight + 10
- Printline = "Ordered Items:"
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = ""
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = (String.Format(StockListFormat, "StockID", "Name", "Price"))
- e.Graphics.DrawString(Printline, ListFont, Brushes.Black, x, y)
- FontHeight = ListFont.GetHeight(e.Graphics)
- y = y + FontHeight
- For count = 0 To lstBasket.Items.Count - 1
- Printline = lstBasket.Items(count).ToString()
- e.Graphics.DrawString(Printline, ListFont, Brushes.Black, x, y)
- y = y + FontHeight
- Next
- FontHeight = MyFont.GetHeight(e.Graphics)
- Printline = ""
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = "Total cost before VAT: " & txtTotal.Text
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = "VAT: " & txtVAT.Text
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = "Gross Cost: " & txtGrossCost.Text
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = ""
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight
- Printline = "Thank you for your purchase!"
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement