borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (want to print) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Bill Printing
Poster Message
karu
Level: Guest


icon Bill Printing

I am trying to print the bill for small glossary shop using following code.

Private Sub Command1_Click()
        Printer.NewPage
        Printer.Font.Name = "Courier New"
        Printer.Font.Size = 8
        
        Printer.Print Space(18) & "Title" & vbCrLf
        Printer.Print Space(18) & "helloo all" & vbCrLf
        ....
        ....
        .....
        Printer.Print String(55, "-") & vbCrLf
        Printer.Print vbCrLf & vbCrLf
        Printer.Print "### -------------------- ###"
        Printer.EndDoc
End Sub

I need to print a single bill at a time. Paper I am using is roll paper. This above code is printing a bill but after finshed with prinitng it is throwing out certain paper. Please help me. How to stop the printer to throw a page after printing job is over.
Printer I am using is Epson LX300.  Please help.


[Edited by karu on 14-09-2003 at 09:53 AM GMT]T]   

[Edited by karu on 23-09-2003 at 09:59 AM GMT]

[Edited by karu on 23-09-2003 at 10:00 AM GMT]

14-09-2003 at 09:51 AM
| Quote Reply
nirmal
Level: Guest

icon Re: Bill Printing

You only need to set papersize property of printer object according to height of your bill. Set papersize before you start writing printing code, this will solve your problem.

14-10-2003 at 01:26 PM
| Quote Reply
caloy
Level: Protégé

Registered: 15-03-2006
Posts: 4
icon Re: Bill Printing

am using DOS printing so it would print fast. im trying to print the contents of my flexgrid. i have used the .printpicture of flexgrid but it still eject some papers..

the code above  doesnt work with me... it still throws up some paper even after i have set the paper size... i cnat even set the font...

i have the code below...  maybe you could help the  novice....


        Open "LPT1" For Output As #1
        
        Print #1, ""
        Print #1, ""
        
        Print #1, Tab(7); resibo.Label1(0)
        Print #1, resibo.Label1(1)
        Print #1, ""
        Print #1, ""


            For i = 0 To w - 5
                Print #1, .TextMatrix(i, 1); Tab(5) _
                          ; Left(.TextMatrix(i, 2), 15), _
                          .TextMatrix(i, 3)
            Next i
            
            For i = i To w
                Print #1, .TextMatrix(i, 2), , _
                          .TextMatrix(i, 3)
            Next i
            
            Print #1, ""
            Print #1, ""
            Print #1, ""
            Print #1, ""
            
            Close #1

maybe if you could hel me modify it to format my receipt.

15-03-2006 at 08:50 AM
View Profile Send Email to User Show All Posts | Quote Reply
soumen
Level: Trainee

Registered: 08-08-2006
Posts: 1
icon Re: Bill Printing

It is throwing some paper because of page setting.
I think set the paper in such a manner that is better for the printing.If the printer has custom page setting then use the option.
If it not helping you please mail me.

____________________________
soumen

08-08-2006 at 04:13 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
senthil
Level: Trainee

Registered: 04-11-2006
Posts: 1
icon Re: Bill Printing

pls reply for problem in code

dos printing in vb in difference font size, how to use
chr$ - function ho to use

04-11-2006 at 03:23 PM
View Profile Send Email to User Show All Posts | Quote Reply
ssn
Level: Trainee

Registered: 07-04-2007
Posts: 1
icon Re: Bill Printing

I am using PRINT #1, to write text in a file and i m printing it using edit.com.  even i tried to send ESC command to set page length in lines.  even after that once the printing over it ejects the paper a lot.  My paper is a roll paper of 40 character width.  Please help me how to stop the ejection of paper. Once print over i want it to stop there itself.

07-04-2007 at 01:43 PM
View Profile Send Email to User Show All Posts | Quote Reply
gunpath
Level: Trainee

Registered: 17-09-2007
Posts: 1
icon Re: Bill Printing

Private Sub CashPrint()

Dim cPaid As String, cBbal As String
Dim nWgt As String, nQty As String, cTotwgt As String, cLess As String
Dim nLM As Integer, cVl As String, nBG As Integer, cHl As String
Dim nTotAmt As Double, nTotQty, nTRAmt As Double
Dim nTlen, nLoop, nInc As Integer, cString As String

nLM = 0
cVl = " "
cHl = "-"
Open "c:\files\testfile" For Output As #1  ' Open file for output.
For l = 1 To 4
Print #1, Chr(27) + "j" + "n"
Next
'############### Head Printing #################
       Print #1,
    Print #1, Space(nLM) + CPad(CboCaCr.Text, 40)
    
    Print #1, Space(nLM) + Space(1) + "No." + RPad(Left(Trim(txtBNo.Text), 6), 6) + Space(15) + "Date:" + txtBDt.Text
    If txtpartyname.Text <> "" Then
        Print #1, Space(nLM) + Chr$(27) + Chr$(71) + "M/s " + Trim(txtpartyname.Text) + Chr(27) + Chr$(72)
    Else
        Print #1, Space(nLM) + Chr$(27) + Chr$(71) + "M/s " + Trim(txtName.Text) + Chr(27) + Chr$(72)
    End If
    If TxtAdd1.Text <> "" Then Print #1, Space(nLM) + TxtAdd1.Text
    If TxtAdd2.Text <> "" Then Print #1, Space(nLM) + TxtAdd2.Text
    If txtadd3.Text <> "" Then Print #1, Space(nLM) + txtadd3.Text
'    Print #1, Space(nLM) + Space(1) + "Date:" + txtBDt.Text + Space(5) + "    Time:" + txtTime.Text
'############ End Of Head Printing #################


'############ Body  Printing #################
'    If TxtAdd4.Text <> "" Then Print #1, Space(nLM) + TxtAdd4.Text



'******///////////////////Credit Bill /////////////////////// Starts here
        
'        Print #1, Space(nLM) + cString
'        If i = 1 Then
'        nInc = nInc + 34
'        Else
'        nInc = nInc + 40
'        End If
'        Next
'        End If
'    End If
    
    Print #1, Space(nLM) + String(40, "=")
    Print #1, Space(nLM) + RPad("Rate", 7) + cVl + Chr(15) + CPad("Particulars  ", 30) + Chr(18) + LPad("Qty", 3) + Space(1) + Space(2) + LPad("Amount", 8)
    Print #1, Space(nLM) + String(40, "=")
    
    For i = 1 To flxgrd.Rows - 1
    If flxgrd.TextMatrix(i, 1) <> "" Then
        If Val(flxgrd.TextMatrix(i, 3)) <> 0 Then
'            If Len(Trim(flxgrd.TextMatrix(i, 1))) < 22 Then
                Print #1, Space(nLM) + LPad(Format(flxgrd.TextMatrix(i, 4), "###0.00"), 7) + cVl + Chr(15) + RPad(Left(Trim(flxgrd.TextMatrix(i, 2)), 30), 30) + Chr(18) + cVl + LPad(flxgrd.TextMatrix(i, 3), 3) + Space(1) + Space(1) + LPad(Format(flxgrd.TextMatrix(i, 5), "####0.00"), 8)
'           Else
  '              Print #1, Space(nLM) + RPad(flxgrd.TextMatrix(i, 0), 3) + cVl + Chr(15) + RPad(Left(flxgrd.TextMatrix(i, 1), 30), 30) + Chr(18) + cVl + LPad(flxgrd.TextMatrix(i, 2), 3) + Space(1) + Chr(15) + LPad(Format(flxgrd.TextMatrix(i, 3), "###0.00"), 7) + Chr(18) + Space(1) + LPad(Format(flxgrd.TextMatrix(i, 4), "####0.00"), 8)
    '            Print #1, Space(nLM) + Space(3) + cVl + Chr(15) + RPad(Mid(flxgrd.TextMatrix(i, 1), 22, Len(flxgrd.TextMatrix(i, 1))), 10) + Chr(18) + cVl
   '         End If
        End If
'        nTotAmt = nTotAmt + Val(flxgrd.TextMatrix(i, 5))
'       nTotQty = nTotQty + Val(flxgrd.TextMatrix(i, 3))
    End If
    Next
    
    
    Print #1, Space(nLM) + String(42, "-")
    Print #1, Space(nLM) + Space(2) + "Total    " + Space(8) + LPad(Format(lblTqty, "#####0"), 6) + Space(6) + LPad(Format(lblTamt, "#####0.00"), 9)
    If Val(txtdR.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "            Less  " + Chr(18) + Space(19) + LPad(Format(txtdR.Text, "####0.00"), 8)
    If cboTax.ListIndex = 0 Then
        If Val(txtTax.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "    Sales Tax @" + Format(nMTax, "#0.00") + Chr(18) + Space(19) + LPad(Format(txtTax.Text, "####0.00"), 8)
        If Val(txtAsc.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + " Add Sur Charge" + Format(nMaTax, "#0.00") + Chr(18) + Space(19) + LPad(Format(txtAsc.Text, "####0.00"), 8)

    ElseIf cboTax.ListIndex = 1 Then
        If Val(txtTax.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "    V.A.T     @" + Format(nMVat, "#0.00") + Str(cboTax.ItemData(ListIndex)) + Chr(18) + Space(19) + LPad(Format(txtTax.Text, "####0.00"), 8)
    End If
    If Val(txtTrns.Text) <> 0 Then Print #1, Space(nLM) + Space(2) + Chr(15) + "Transport Charges " + Chr(18) + Space(19) + LPad(Format(txtTrns.Text, "####0.00"), 8)
    
    Print #1, Space(nLM) + Space(32) + String(8, "-")
    Print #1, Space(nLM) + Space(32) + Chr(27) + Chr(71) + LPad(Format(txtTot.Text, "####0.00"), 8) + Chr(27) + Chr(72)
    Print #1, Space(17) + "     Received :" + LPad(Format(txtAmtR.Text, "####0.00"), 8)
    Print #1, Space(nLM) + Space(32) + String(8, "-")
    Print #1, Space(17) + "     Balance  :" + LPad(Format(txtAmtB.Text, "####0.00"), 8)
    Print #1,
    Print #1,
    Print #1,
    Print #1, Chr(15) + cUser + Chr(18)
    Print #1,
    Print #1,

'//////////////// FOR CASH BILL PRINTING procedure ends here

For K = 1 To 11
Print #1,
Next
Close #1

Do While True
RetVal = Shell("C:\FILES\DOSPRINT.BAT", 0)
If MsgBox("Print Again", vbOKCancel) = vbCancel Then
Exit Do
End If
Loop

End Sub

17-09-2007 at 01:37 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : Bill Printing
Next Topic (want to print) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder