Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Function

Status
Not open for further replies.

UKmedia

Programmer
Nov 2, 2002
90
Hey All,

I have the following code which prints out a reciept but what I want to do it Left Justify the frmMain.ListView1.ListItems(i).Text as this is the price. I want the receipt to print like so:

13/08/2008 12:00
Cashier : Richard
Till: 1

1 x Kingsmeal £0.90
2 x Milk (Full Fat) £1.10
1 x News Paper (The Sun) £0.25

---------------------------------------
Total: £2.25
Tender: £5.00
Change: £2.75
---------------------------------------

HAVE A NICE DAY
S011808081200

Code:
With Printer
'Header of Reciept

Printer.Print ""
Printer.Print ""
Printer.Print Now()
Printer.Print "Served By: " & frmMain.StatusBar1.Panels(1).Text
Printer.Print "Gardiff Ltd - Store #1"
Printer.Print
Printer.Print
Printer.Print
'Reciept Items
.FontItalic = True
For i = 1 To frmMain.ListView1.ListItems.Count
Printer.Print frmMain.ListView1.ListItems(i).ListSubItems(2).Text & " x   " & frmMain.ListView1.ListItems(i).Text & "                  £" & frmMain.ListView1.ListItems(i).ListSubItems(1).Text
Next i
Printer.Print
.FontItalic = False
.FontBold = True
Printer.Print "---------------------------------------------------------------------"
Printer.Print "                                                           Sub Total: " & frmMain.lblVTotal.Caption
Printer.Print "                                                           Tender:      £" & frmCash.txtInputTotal.Text
Printer.Print "                                                           Change:      £0.00"
Printer.Print "---------------------------------------------------------------------"
Printer.Print ""
Printer.Print ""
.FontBold = False
Printer.Print "                              PLEASE COME AGAIN"
'End Of Reciept
Printer.Print "                                 " & frmMain.txtSalesOrderNumber.Text
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
.EndDoc

End With

Also I want to set the number of times the reciept prints I use Printer.Copies but it will only ever print 1 and not 2. Any ideas on all of this would be a great help.

Thanks

Richard


UKmedia productions
 
Hi Richard

Have you considered writing the info to a temp text file? This would give you control over the number of times you can print it, and also some (very) basic formatting options (spaces, tabs etc)? You can then delete it at the end if required.

As for the listview I'm afraid I don't know - could you write the data to something like a RichTextBox instead which may give you more options?

Cheers

Asjeff
 
How about this (I used an asterisk instead of a pound sign)

Printer.Print frmMain.ListView1.ListItems(i).ListSubItems(2).Text & " x " & frmMain.ListView1.ListItems(i).Text & " £" &
format (frmMain.ListView1.ListItems(i).ListSubItems(1).Text, "\*##,###.00)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top