Class cetak crystall report di vb6.0

Ok, disini saya memakai crystall report 8 dan ini Classnya.

ini memakai frmCetak yang componentnya cuma CrViewer / Crystall Report Viewer Control.

dan untuk database di crystall report saya pakai ttx (Field Difinition Only)

Contoh file rpt dan ttxnya : Report (Rename dulu ke .rar)

==========================Start==========================

Option Explicit

‘/*create report with crystal report call (*.dll)*/
‘/*create report with Barcode (only for printer barcode)*/
‘/*Author by Yanto Hariyono*/
Private c_app As New CRAXDRT.Application
Private c_rpt As CRAXDRT.Report
Private clsrst As New clsAdo

Public Sub cetakrpt(ByVal filenamerpt As String, ByVal SQL As String, Optional titlerpt As String = “”)
Screen.MousePointer = vbHourglass
Set c_rpt = c_app.OpenReport(App.path & “\” & filenamerpt)
c_rpt.Database.SetDataSource clsrst.ExecuteQueryrst(SQL)
frmcetak.CRViewer.ReportSource = c_rpt
c_rpt.ReportTitle = titlerpt
frmcetak.CRViewer.ViewReport

Screen.MousePointer = vbDefault
frmcetak.Caption = titlerpt
frmcetak.Show
End Sub

Public Sub clrBufferBarcode()
Printer.Print “N” & vbCrLf
End Sub

Public Sub writeBarcode(ByVal code As String)
Dim barcode As String
barcode = Chr(34) + code + Chr(34)
Printer.Print “B200,50,0,1,2,6,100,B,” & barcode & “” & vbCrLf
End Sub

Public Sub writeLabel(ByVal Label As String)
Dim company As String
company = Chr(34) + Label + Chr(34)
Printer.Print “A200,20,0,4,1,1,N,” & company & “” & vbCrLf
End Sub

Public Sub endofPrintBarcode()
Printer.Print “P1”
Printer.EndDoc
End Sub

===========================End=======================

Atau donload aja disini.

By MRTHX

  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: