Jumat, 15 April 2016

[belajar-access] [TANYA] Eject Printer LPT

 

Mohon bantuannya
Sy sedang membuat aplikasi utk cetak Nota menggunakan Printer LX-300
Dimana kertas Nota sudah tersedia (bkn Continous Form), baris tersedia utk cetak daftar Nama Barang sebanyak 40 baris.

Bagaimanya caranya agar setelah 40 baris bisa Eject Kertas ?

kode sbb :

Private Sub cmdPrint_Click()

Open "LPT1" For Output As #1

strSQL = "SELECT * FROM TRANS;"


Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strSQL, dbOpenSnapshot)

With rst
NoTrans = rst!NO_TRAN
NmCus = rst!NM_CUS
AlCus = rst!ALAMAT

Print #1, strSQL
Print #1,
Print #1, REPL(" ", 60) & Format(Now(), "dd-mmm-yyyy")
Print #1,
Print #1, REPL(" ", 57) & Left(NmCus, 23)
Print #1,
Print #1, REPL(" ", 57) & Left(AlCus, 23)
Print #1,
Print #1,
Print #1,
Print #1,
.MoveFirst
total = 0
r = 0
Do While Not rst.EOF
    r = r + 1
    Print #1, PADL(Format(r, "#"), 2) & PADR(Format(rst!QTY, "#,#"), 5) & " " & PADL(rst!Satuan, 3) & "   " & PADL(rst!NM_BRG, 30) & " " & PADR(Format(rst!HG_SAT, "#,#"), 11) & " " & PADR(Format((rst!QTY * rst!HG_SAT), "#,#"), 13)
    total = total + Nz(rst!QTY * rst!HG_SAT)
    .MoveNext
Loop

MsgBox r

Print #1, REPL(" ", 58) & REPL("-", 12)
Print #1, PADR("JUMLAH", 58) & PADR(Format(total, "#,#"), 12)
If Me.txtDisc.Value = 0 Then
    nDisc = "0%"
Else
    If Right(Format(Me.txtDisc.Value, "#.#%"), 2) = ".%" Then
        nDisc = Mid(Format(Me.txtDisc.Value, "#.#%"), 1, Len(Format(Me.txtDisc.Value, "#.#%")) - 2) & "%"
    Else
        nDisc = Format(Me.txtDisc.Value, "#.#%")
    End If
End If
Print #1, PADR("Disc " & nDisc, 58) & PADR(Format(total * Me.txtDisc.Value, "#,#"), 12)
Print #1, REPL(" ", 58) & REPL("-", 12)
NETTO = total - total * Me.txtDisc.Value
Print #1, PADR("NETTO", 58) & PADR(Format(NETTO, "#,#"), 12)
'Print #1, REPL("1234567890", 8)

Close #1
End With

End Sub


Function PADC(text As String, pjg As Integer) As String
PADC = Space((pjg - Len(Trim(text))) / 2) & Trim(text)
End Function

Function PADR(text As String, pjg As Integer) As String
PADR = Space(pjg - Len(Trim(text))) & Trim(text)
End Function

Function PADL(text As String, pjg As Integer) As String
PADL = Trim(text) & Space(pjg - Len(Trim(text)))
End Function

Function REPL(text As String, pjg As Integer) As String
Dim a As Integer
For a = 1 To pjg
    REPL = REPL & text
Next a
End Function


Terima kasih atas bantuannya,

Regards,
Eko Santoso

__._,_.___

Posted by: "exz@nt" <exzantmilis@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
SPAM IS PROHIBITED

.

__,_._,___

Tidak ada komentar:

Posting Komentar