Kamis, 30 Agustus 2012

Code Print ke Printer OPOS (Printer Kasir)



Option Explicit
Dim CRLF    As String * 2
Dim ESC     As String * 1
Dim no As Integer
Dim statchg As Integer
Dim gtotal As Double
Dim gdisk As Double
Dim gst As Double
Dim MSOLD As Integer
Dim MONHAND As Integer
Dim KODEx As String


Private Sub printSTRUK1()
    Dim fDate   As String
    Dim fTime   As String
    Dim RecNo   As Long
    Dim fRecNo  As String
    Dim ManualCut   As String
    Dim OutputData As String
    Dim totalall As Double
    Dim diskall As Double
    Dim stall As Double
    Dim chg As Double
    Dim ttl As Double
    Dim mnotran As Double
 
   ' Printer.Print SetBitmap; App.Path + "\mbb001.bmp";
      Printer.FontSize = 9
      Printer.FontBold = True
      Picture = LoadPicture
   
      'Printer.PaintPicture(
      Printer.Print "TAMAN BALITA MERBY      "
      Printer.Print " "
      Printer.FontSize = 7
      Printer.FontBold = False
      Printer.Print " Jl. PANDANARAN II/2D SEMARANG"
      Printer.Print "         Telp: 024-8317067"
      Printer.Print " "
      Printer.Print " "
       fDate = Format(Date, "dd-mm-yyyy")   'System date
       fTime = Format(Time, "hh:mm")            'System time
       RecNo = 1                               'Receipt No.
       fRecNo = Format(RecNo, "R-0000")
        Printer.FontSize = 9
        Printer.FontBold = False
        Printer.Print "  "; fDate; "                          "; fTime
        Printer.Print " "
        Printer.FontSize = 9
        Printer.FontBold = True
        Printer.Print "      BUKTI PEMBAYARAN "
        Printer.Print
        Printer.FontSize = 8
        Printer.FontBold = False
        ST00TEMP.RecordSource = "select * from st00temp"
        ST00TEMP.Refresh
        Do While Not ST00TEMP.Recordset.EOF
           Printer.Print Str(ST00TEMP.Recordset.Fields("qty")); "  "; ST00TEMP.Recordset.Fields("name"); Space(26 - Len(ST00TEMP.Recordset.Fields("name"))); Space(9 - Len(Format(ST00TEMP.Recordset.Fields("price"), "#,#0"))); Format(ST00TEMP.Recordset.Fields("price"), "#,#0")
           totalall = totalall + ST00TEMP.Recordset.Fields("total")
           diskall = diskall + ST00TEMP.Recordset.Fields("discpct")
           ttl = ST00TEMP.Recordset.Fields("price") * ST00TEMP.Recordset.Fields("qty")
           mnotran = ST00TEMP.Recordset.Fields("notran")
           ST00TEMP.Recordset.MoveNext
           Loop
           Printer.Print " "
           Printer.FontSize = 10
           Printer.FontBold = True
           Printer.Print "SubTotal  :"; Space(9 - Len(Format(stall, "#,#0"))); Format(stall, "#,#0")
           Printer.Print "Disk      :"; Space(9 - Len(Format(diskall, "#,#0"))); Format(diskall, "#,#0")
           Printer.Print "Total     :"; Space(9 - Len(Format(totalall, "#,#0"))) + Format(totalall, "#,#0")
           Printer.Print " "
           'Printer.PaintPicture
           Printer.FontSize = 9
           Printer.FontBold = False
           Printer.Print "CASH      :"; Space(15 - Len(totalall)) + IIf(Val(Text2(1).Text) = "0", Format(totalall, "#,#0"), Format(Val(Text2(1).Text), "#,#0"))
           Printer.Print "KEMBALI   :"; Space(15 - Len(Text2(2).Text)) + Format(Val(Text2(2).Text), "#,#0")
           Printer.Print "  "
           Printer.Print "Cashier : "; xuser; "    RPC   :"; Space(3 - Len(Format(mnotran, "#,#0"))); Format(mnotran, "#,#0")
           Printer.Print "  "
           Printer.Print "     Terima Kasih Selamat Bergabung"
 Printer.EndDoc
 End Sub

5 komentar:

  1. cara dr desaindr form kosong dan komponen apa yg d gunakan bisa tolong jelaskan?
    terutama code print bitimage tmu220b.trimakasih

    BalasHapus
  2. Tri joko: untuk desain form bisa anda sesuaikan dengan kebutuhan sistem, kode di atas adalah untuk print direct, langsung ke printer, jd tdk memakai komponen tambahan apapun

    BalasHapus
  3. Halooooo, kalo untuk printer thermal yg 58mm cara buat format kertasnya gimana y?

    BalasHapus
  4. Halooooo, kalo untuk printer thermal yg 58mm cara buat format kertasnya gimana y?

    BalasHapus

hay friend... sebelum exit, jgn lupa tinggalkan comment dulu ya...
kalau mau bertanya bisa tulis komentar atau email/fb ke: aranama@ymail.com
thank you...