Tutorial Program Karcis Tol

Embed Size (px)

Citation preview

  • 7/23/2019 Tutorial Program Karcis Tol

    1/25

    Tutorial Delphi 7 Program Karcis Tol| 1

    PROGRAM KARCIS TOL DELPHI 7

    Pada tutorial kali ini kita akan membuat sebuah program yang digunakan untuk pembayaran karcis

    jalan tol. Pada program ini kita memakai database Paradox versi 7 sebagai ruang penyimpanan datanya.

    Berikut tutorial nya :

    1. Menyiapkan Folder Penyimpanan

    Buatlah folder pada drive D:/dengan nama Program Tol

    Buatlah folder DBdidalam folder Program Tol, sebagai tempat penyimpanan table

    Buatlah folder Imagedidalam folde Program Tol, sebagai tempat penyimpanan gambar.

    2. Membuat Database

    Koneksi Database :

    Mengatur Alias Manager

    A. Buka Program Delphi 7

    B. Pilih Tools | Database Desktop

    C. Pada Database Desktop, pilih Tools | Alias Manager

    D.

    Klik tombol New

    E. Ketik DB_Tolpada kotak teks Database Alias

    F. Pilih STANDARDpada kotak kombo Drivertype

    G. Ketik Addres dari folder tempat menyimpan data pada kotak teks Path

    Cont : D:\Program Tol\db

    H. Klik tombol OK. Kemudian simpan jendela komfirmasi menyimpan alias, dengan menekan

    Yes

    Membuat Tabel :

    A. Pada Database Desktop, pilih menu File | New | Table...muncul jendela create table

    B.

    Pilih Paradox 7, lalu klik OKC. Isikan struktur tabel hingga lengkap

    D. Untuk menentukan kunci, double klik pada kolom key hingga muncul tanda*. Tanda *

    menyatakan bahwa field tersebut adalah kunci.

    E. Simpan struktur tabel dengan Save as.

    Struktur Tabel Petugas

    Struktur Tabel Golongan

  • 7/23/2019 Tutorial Program Karcis Tol

    2/25

    Tutorial Delphi 7 Program Karcis Tol| 2

    Struktur Tabel Struk

    3. Membuat Program

    3.1.Form Utama

    ScreenShot program :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form1 Name Form1

    Caption Program Karcis Jalan TolHeight 445

    Width 505

    Position poDesktopCenter

    MainMenu1 Name MainMenu1

    Items

    Label1 Caption PROGRAM KARCIS TOL

    Label2 Caption dddd,dd/mm/yyyy

  • 7/23/2019 Tutorial Program Karcis Tol

    3/25

    Tutorial Delphi 7 Program Karcis Tol| 3

    Label3 Caption 00.00

    Label4 Caption |

    Timer1 Enabled True

    Interval 1000

    Image1 Picture Load gambar

    Stretch True

    Kode Program :

    1. Tambahkan kode berikut dibawah kode implementation.

    2. Tombol mainmenu, Data | Petugas :

    3. Tombol mainmenu, Data | Karcis :

    4. Tombol mainmenu, Data | Golongan :

    5. Tombol mainmenu, Pembayaran Karcis :

    6.Tombol mainmenu, Laporan | Laporan Data Karcis :

    7.Tombol mainmenu, Laporan | Laporan Data Petugas :

    8.Tombol mainmenu, Keluar :

    F1.DP1C(S: O);3.;

    ;

    F1.K1C(S: O);6.S;

    ;

    F1.G1C(S: O);4.S;

    ;

    F1.PK1C(S: O);5.S

    ;

    P, G, K, DK,

    F1.LDK1C(S: O);7.QR1.P;

    ;

    F1.LDP1C(S: O);8.QR1.P;;

    F1.K1C(S: O);

    ('A EI ?', C, ,N,0)= 1.C;;

  • 7/23/2019 Tutorial Program Karcis Tol

    4/25

    Tutorial Delphi 7 Program Karcis Tol| 4

    9.Tombol Timer1 :

    10.

    Simpan dengan nama UnitUtama.

    3.2.Form Splashscreen

    ScreenShot program :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form2 Name Form2

    Caption Launcher

    Height 350

    Width 600

    Position poDesktopCenter

    Image1 Picture Load gambar

    Stretch TrueLabel1 Caption PROGRAM KARCIS TOL

    Label2 Caption Checking Program ...

    Label3 Caption designer

    ProgressBar1 Left 16

    Height 17

    Width 545

    Timer 1 Enabled True

    Interval 1000

    Timer2 Enabled True

    Interval 100

    procedure TForm1.Timer1Timer(Sender: TObject);begin

    label2.Caption:=FormatDateTime('dddd, dd/mm/yyyy',now);

    label3.Caption:=FormatDateTime('hh:nn',now);

    end;

  • 7/23/2019 Tutorial Program Karcis Tol

    5/25

    Tutorial Delphi 7 Program Karcis Tol| 5

    Sebelum ke kode program, ubahlah form2 menjadi Available Forms, berikut caranya :

    1. Pilih menu Projectlalu pilih Options

    2. Pilih/Klik form2 disebelah kiri. Lalu pindahkan ke sebelah kanan dengan klik panah ke

    kanan ( > )

    Kode Program :

    1. Klik 2x Form2 atau pada events onCreate :

    2. Klik 2x Timer1 :

    3. Klik 2x Timer2 :

    F2.FC(S: O);:=0;3.C:='';;

    F2.1(S: O);1.P:=1.P+10; P1.P=100

    1.E:=;;

    ;

    F2.2(S: O);:=+1;

    (>=0) (=20) (=25

  • 7/23/2019 Tutorial Program Karcis Tol

    6/25

    Tutorial Delphi 7 Program Karcis Tol| 6

    4. Buka Project managermelalui menu View | Project Manager, akan tampil sbb :

    Klik kanan pada nama project, pilih View Source, lalu cari kode dibawah ini

    Lalu ubah kode tadi menjadi seperti dibawah ini :

    A.I;A.CF(F1, F1);A.R;

    .

    2:=F2.C(A);2.S;2.; 2.1.E A.PM;

  • 7/23/2019 Tutorial Program Karcis Tol

    7/25

    Tutorial Delphi 7 Program Karcis Tol| 7

    5. Simpan dengan nama UnitSplashscreen..

    3.3.Form Petugas

    ScreenShot program :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form3 Name Form3

    Caption Data Petugas

    Height 359

    Width 445Position poDesktopCenter

    Label1 Caption Data Petugas Tol

    GroupBox1 Caption (Kosong)

    Label2 Caption Kode Petugas

    Label3 Caption Nama

    Label4 Caption Gender

    Label5 Caption Telp

    Label6 Caption Alamat

    Table1 Name TPetugas

    Database Name DB_Tol

    Table Name Petugas.db

    Active True

    DataSource1 Name DSPetugas

  • 7/23/2019 Tutorial Program Karcis Tol

    8/25

    Tutorial Delphi 7 Program Karcis Tol| 8

    DataSet TPetugas

    Enabled True

    Query1 Name QPetugas

    Database Name DB_Tol

    DBEdit1 Name DBEkode

    DataSource DSPetugas

    DataField Kd_petugas

    ReadOnly True

    DBEdit2 Name DBEnama

    DataSource DSPetugas

    DataField Nama

    ReadOnly True

    DBEdit3 Name DBEgender

    DataSource DSPetugas

    DataField Kelamin

    ReadOnly True

    ComboBox1 Name CBgender

    Items PriaWanita

    DBEdit4 Name DBETelpDataSource DSPetugas

    DataField Telp

    ReadOnly True

    DBEdit5 Name DBEAlamat

    DataSource DSPetugas

    DataField Alamat

    ReadOnly True

    Button1 Caption &Tambah

    Button2 Caption &Edit

    Button3 Caption &Hapus

    Button4 Caption &TutupButton5 Caption

    Button8 Caption >>

    Button9 Caption &Cari

    Button10 Caption &Batal

    DBEdit6 Name DBEcari

    DataSource DSPetugas

    DataField Kd_petugas

    Kode Program :

    1. Tambahkan kode berikut dibawah kode implementation.

    2. Tambahkan procedure didbawah kode Public{ Public Declaration } sbb :

    Lalu ketikan kode procedure nya dibawah implementationsbb :

    ;

    P RO; ;

    ;

    $R *.

  • 7/23/2019 Tutorial Program Karcis Tol

    9/25

    Tutorial Delphi 7 Program Karcis Tol| 9

    3. Klik 2x button1 atau pada events onClick :

    F3.B1C(S: O); 1.C='&'

    ;.A;CB.:=;DBE.:=;

    10.:=;1.C:='&S';2.E:=;3.E:=;4.E:=;

    1.C='&S'

    CB.='P' .FBN('').AS:=''

    .FBN('').AS:='';

    .P;

    RO;CB.:=;DBE.:=;10.:=;1.C:='&';2.E:=;3.E:=;4.E:=;

    ;;

  • 7/23/2019 Tutorial Program Karcis Tol

    10/25

    Tutorial Delphi 7 Program Karcis Tol| 10

    4. Klik 2x button2 atau pada events onClick :

    5. Klik 2x button3 atau pada events onClick :

    F3.B2C(S: O); ,:; 2.C='&E' 2.C:='&S';10.:=;

    CB.:=;DBE.:=;1.E:=;3.E:=;4.E:=;; ''= CB.:='P'

    CB.:='';

    2.C='&S'

    CB.='P' :=''

    :='';

    :=' ="'+ +'" ="'+DBE.+'"';Q.SQL.C;Q.SQL.A();Q.ESQL;CB.:=;DBE.:=;10.:=;

    2.C:='&E';1.E:=;3.E:=;4.E:=;RO;P.R;

    ;;

    F3.B3C(S: O);

    ('A DELEE '+DBE.+' ?', C,,N,0)= .D;

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    11/25

    Tutorial Delphi 7 Program Karcis Tol| 11

    6. Klik 2x button10 atau pada events onClick :

    7. Klik 2x button4 atau pada events onClick :

    8. Klik 2x button5 atau pada events onClick :

    9. Klik 2x button6 atau pada events onClick :

    10.Klik 2x button7 atau pada events onClick :

    11.Klik 2x button8 atau pada events onClick :

    F3.B10C(S: O); 1.C='&S'

    .C;RO;CB.:=;

    DBE.:=;10.:=;1.C:='&';2.E:=;3.E:=;4.E:=;

    2.C='&S'

    RO;CB.:=;DBE.:=;10.:=;2.C:='&E';1.E:=;3.E:=;4.E:=;

    ;;

    F3.B4C(S: O);

    3.C;

    ;

    F3.B5C(S: O);.F;

    ;

    F3.B6C(S: O);

    .P;;

    F3.B7C(S: O);.N;

    ;

    F3.B8C(S: O);

    .L;;

  • 7/23/2019 Tutorial Program Karcis Tol

    12/25

    Tutorial Delphi 7 Program Karcis Tol| 12

    12.Klik DBECari pada events onEnter :

    13.Klik 2x button9 atau pada events onClick :

    14.Simpan dengan nama UnitPetugas.

    3.4.Form Golongan

    ScreenShot :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form4 Name Form4

    Caption Data Golongan

    Height 461

    Width 452Position poDesktopCenter

    Label1 Caption DATA gOLONGAN KENDARAAN

    GroupBox1 Caption (Kosong)

    Label2 Caption Kode Golongan

    Label3 Caption Tarif Tol

    Label4 Caption Deskripsi

    Table1 Name Tgol

    Database Name DB_Tol

    Table Name Golongan.db

    Active True

    DataSource1 Name DSgolDataSet Tgol

    Enabled True

    F3.DBECE(S: O);.SK;

    ;

    F3.B9C(S: O); :;:=DBE.; .GK=

    ('D '++' !', , OK,0);;

  • 7/23/2019 Tutorial Program Karcis Tol

    13/25

    Tutorial Delphi 7 Program Karcis Tol| 13

    DBEdit1 Name DBEkode

    DataSource DSgol

    DataField Kd_golongan

    ReadOnly True

    DBEdit2 Name DBEtarif

    DataSource DSgol

    DataField Tarif

    ReadOnly True

    DBMemo1 Name DBMdeskripsi

    DataSource DSgol

    DataField Keterangan

    Button1 Caption &Tambah

    Button2 Caption &Edit

    Button3 Caption &Hapus

    Button4 Caption &Tutup

    Button5 Caption

    Button8 Caption >>

    Button9 Caption &CariButton10 Caption &Batal

    DBGrid1 DataSource DSgol

    ReadOnly True

    Kode Program :

    1. Tambahkan kode berikut dibawah kode implementation

    2. Klik 2x button1 atau pada events onClick :

    F4.B1C(S: O); 1.C='&'

    1.C:='&S';DBE.RO:=;DBE.RO:=;DBM.RO:=;10.:=;2.E:=;3.E:=;4.E:=;

    .A; 1.C='&S'

    1.C:='&';DBE.RO:=;DBE.RO:=;DBM.RO:=;10.:=;2.E:=;3.E:=;4.E:=;.P;

    ;;

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    14/25

    Tutorial Delphi 7 Program Karcis Tol| 14

    3. Klik 2x button2 atau pada events onClick :

    4. Klik 2x button3 atau pada events onClick :

    5. Klik 2x button10 atau pada events onClick :

    6. Klik 2x button4 atau pada events onClick :

    7. Klik 2x button5 atau pada events onClick :

    F4.B2C(S: O); 2.C='&E'

    2.C:='&S';DBE.RO:=;DBE.RO:=;

    DBM.RO:=;1.E:=;3.E:=;4.E:=;

    2.C='&S'

    2.C:='&E';DBE.RO:=;DBE.RO:=;DBM.RO:=;2.E:=;3.E:=;4.E:=;

    ;;

    procedure TForm4.Button3Click(Sender: TObject);begin

    if messagedlg('Are you sure to DELETE data '+DBEkode.Text+' ?', mtConfirmation,[mbYes,mbNo],0) = mrYes then

    Tgol.Delete;

    end;

    F4.B10C(S: O);

    1.C:='&';DBE.RO:=;DBE.RO:=;DBM.RO:=;10.:=;2.E:=;3.E:=;4.E:=;

    .C;;

    F4.B4C(S: O);4.C;

    ;

    F4.B5C(S: O);

    .F;;

  • 7/23/2019 Tutorial Program Karcis Tol

    15/25

    Tutorial Delphi 7 Program Karcis Tol| 15

    8. Klik 2x button6 atau pada events onClick :

    9. Klik 2x button7 atau pada events onClick :

    10.Klik 2x button8 atau pada events onClick :

    11.Simpan dengan nama UnitGolongan.

    3.5.Form Pembayaran Karcis

    ScreenShot :

    F4.B6C(S: O);.;

    ;

    F4.B7C(S: O);.;

    ;

    F4.B8C(S: O);.;

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    16/25

    Tutorial Delphi 7 Program Karcis Tol| 16

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form5 Name Form5

    Caption Pembayaran Karcis Tol

    Height 528

    Width 571Position poDesktopCenter

    Label1 Caption PEMABAYARAN KARCIS TOL

    GroupBox1 Caption Input Kendaraan

    Table1 Name Tgol

    Database Name DB_Tol

    Table Name Golongan.db

    Active True

    DataSource1 Name DSgol

    DataSet Tgol

    Enabled True

    Table2 Name Tkarcis

    Database Name DB_Tol

    Table Name Struk.db

    Active True

    DataSource2 Name DSkarcis

    DataSet Tkarcis

    Enabled True

    Table3 Name Tpetugas

    Database Name DB_Tol

    Table Name petugas.db

    Active True

    DataSource3 Name DSpetugas

    DataSet TpetugasEnabled True

    Label2 Caption No. Kendaraan

    Label3 Caption Golongan

    Edit Name Enopol

    DBComboBox1 Name DBCgol

    DataSource DSKarcis

    DataField Kd_golongan

    ReadOnly True

    Button1 Caption Baru

    Button2 Caption Proses

    Enabled FalseButton3 Caption Tutup

    Button4 Caption Cetak

    Button6 Caption Aktifkan

    GroupBox2 Caption Output Tiket

    Label Caption No.Karcis

    Label Caption Harga Tiket

    Label Caption Rp.

    Label Caption No.Kendaraan

    Label Caption Jenis Kendaraan

    Label Caption Tanggal

    Label Caption Waktu

    Label Caption Petugas

    DBText1 DataSource DSKarcis

  • 7/23/2019 Tutorial Program Karcis Tol

    17/25

    Tutorial Delphi 7 Program Karcis Tol| 17

    DataField No.Struk

    Edit Name Nostruk

    Visible False

    DBEText2 DataSource DSKarcis

    DataField Bayar

    DBEdit1 DataSource DSKarcis

    DataField No.pol

    DBEMmemo1 DataSource DSKarcis

    Datafield desc

    DBEdit2 DataSource DSKarcis

    DataField Tgl

    DBEdit3 DataSource DSKarcis

    DataField Time

    DBEdit4 DataSource DSKarcis

    Datafield petugas

    GroupBox3 Caption Petugas

    Label Caption Masukkan Kode Tugas

    Edit Name Ekode

    Button6 Caption Aktifkan

    Label Caption KodeLabel Caption Nama

    Edit Name Ekode2

    Edit Name Enama

    Timer1 Interval 1000

    Enabled True

    Pada komponen Table2 atau TKarcis perlu ditambahkan Field Petugas dan Desc untuk

    menampilkan nama petugas pada DBEdit4 dan desc pada DBMemo1, berikut caranya :

    1.

    Klik 2x pada Table3 atau TKarcis hingga muncul popup menu2.

    Pilih Fields Editor..., klik kanan dan pilih Add All Fields

    3.

    Klik kanan lagi, pilih New Fields

    4.

    Ketikkan Petugaspada name

    5.

    Pilih stringuntuk type

    6.

    Isikan 25untuk size

    7.

    Field type berupa Lookup

    8.

    Pada LookUp Definition,

    Key Fields : Kd_petugas DataSet : Tpetugas

    LookUp Key : Kd_petugas Result Field : Nama9.

    Lakukan hal yang sama pada membuat DESC :

    Key Fields : Kd_golongan DataSet : Tgol

    LookUp Key : Kd_golongan Result Field : keterangan

    Kode Program :

    1. Tambahkan kode berikut dibawah kode implementation

    , KP;

  • 7/23/2019 Tutorial Program Karcis Tol

    18/25

    Tutorial Delphi 7 Program Karcis Tol| 18

    2. Tambahkan procedure didbawah kode Public{ Public Declaration } sbb :

    Lalu ketikan kode procedure nya dibawah implementationsbb :

    P ;

    , KP;$R *.

    F5.; :;

    :;

    K.L;

    K.RC=0 .:='1';:=K'N.S';:=()+1;.:=();;

    ; F5.;

    5.E:=;6.E:=;7.E:=;8.E:=;9.E:=;

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    19/25

    Tutorial Delphi 7 Program Karcis Tol| 19

    3. Klik 2x button6 atau pada events onClick :

    4. Klik 2x button2 atau pada events onClick :

    5. Klik 2x button1 atau pada events onClick :

    F5.B6C(S: O); 6.C='A'

    .FK(E.) ('D K '+.+' !',I,OK,0);

    E2.:='K';E.:='N';6.C:='NA';

    1.E:=;2.E:=;4.E:=;3.E:=;DBC.RO:=;;;

    K.A; 6.C='NA'

    6.C:='A';1.E:=;2.E:=;4.E:=;3.E:=;.C;2.C;

    .C;(' NA !', I, OK,0);.C;

    ;;

    F5.B2C(S: O);

    K'.':=.;'N.':=E.;'':=DBC.;

    K'':=E2.;K'':=();K'':=();K'':='2';K.P;

    ;

    F5.B1C(S: O);;K.A;

    E.C;E.SF();

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    20/25

    Tutorial Delphi 7 Program Karcis Tol| 20

    6. Klik 2x button4 atau pada events onClick :

    7. Klik 2x button3 atau pada events onClick :

    8. Simpan dengan nama UnitKarcis.

    3.6. Form Data Karcis

    ScreenShot :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form6 Name Form6

    Caption DATA KARCIS TOL

    Height 407

    Width 690

    Position poDesktopCenterLabel1 Caption DATA KARCIS TOL

    Table1 Name TKarcis

    Database Name DB_Tol

    Table Name struk.db

    Active True

    DataSource1 Name DSkarcis

    DataSet TKarcis

    Enabled True

    Button3 Caption &Hapus

    Button4 Caption &Tutup

    Button5 Caption

    F5.B4C(S: O);9.QR1.P;

    ;

    F5.B3C(S: O);

    5.C;

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    21/25

    Tutorial Delphi 7 Program Karcis Tol| 21

    Button8 Caption >>

    DBGrid1 DataSource DSKarcis

    ReadOnly True

    Kode Program :

    1. Tambahkan kode berikut dibawah kode implementation

    2. Klik 2x button3 atau pada events onClick :

    3.

    Klik 2x button4 atau pada events onClick :

    4. Klik 2x button5 atau pada events onClick :

    5.

    Klik 2x button6 atau pada events onClick :

    6. Klik 2x button7 atau pada events onClick :

    7.

    Klik 2x button8 atau pada events onClick :

    8. Simpan dengan nama UnitDatakarcis.

    ;

    procedure TForm6.Button3Click(Sender: TObject);

    begin

    if messagedlg('Are you sure to DELETE this data ?', mtConfirmation,

    [mbYes,mbNo],0)=mrYes thenbegin

    Tkarcis.Delete;

    end;

    end;

    F6.B4C(S: O);6.C;

    ;

    F6.B5C(S: O);K.F;

    ;

    F6.B6C(S: O);K.;;

    F6.B7C(S: O);K.;;

    F6.B8C(S: O);K.;;

  • 7/23/2019 Tutorial Program Karcis Tol

    22/25

    Tutorial Delphi 7 Program Karcis Tol| 22

    3.7.Form Laporan Data Karcis

    ScreenShot :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form7 Name Form7

    Caption LAPORAN DATA KARCIS

    Table1 Name Tdata

    Database Name DB_Tol

    Table Name struk.db

    Active True

    DataSource1 Name DSdata

    DataSet Tdata

    Enabled True

    Table2 Name Tpetugas

    Database Name DB_Tol

    Table Name petugas.db

    Active True

    Qreport1 Bands Has Title True

    Bands Has Detail True

    Dataset TData

    TitleBand1 Has Child TrueFrame Draw Bottom True

    Frame Width 2

    QRLabel Caption Data Pembayaran Karcis

    QRLabel Caption No.Karcis

    QRLabel Caption Golongan

    QRLabel Caption Kendaraan

    QRLabel Caption Tanggal

    QRLabel Caption Waktu

    QRLabel Caption Bayar

    QRLabel Caption Petugas

    QRDBText1 DataSource DsdataDataField No.Struk

    QRDBText2 DataSource DSdata

  • 7/23/2019 Tutorial Program Karcis Tol

    23/25

    Tutorial Delphi 7 Program Karcis Tol| 23

    DataField Kd_golongan

    QRDBText3 DataSource Dsdata

    DataField No.pol

    QRDBText4 DataSource DSdata

    DataField Tgl

    QRDBText5 DataSource Dsdata

    DataField Time

    QRDBText6 DataSource DSdata

    DataField Bayar

    QRDBText7 DataSource Dsdata

    DataField Petugas

    Tambahkan Uses UnitUtamadibawah kode impelementation.

    Untuk menampilkan namapetugasperlu ditambahkan field baru pada Tdata, berikut

    caranya :

    1. Klik 2x pada Tdata hingga muncul popup menu

    2.

    Pilih Fields Editor..., klik kanan dan pilih Add All Fields3. Klik kanan lagi, pilih New Fields

    4. Ketikkan Petugaspada name

    5. Pilih stringuntuk type

    6. Isikan 25untuk size

    7. Field type berupa Lookup

    8. Pada LookUp Definition,

    Key Fields : Kd_petugas DataSet : Tpetugas

    LookUp Key : Kd_petugas Result Field : Nama

    Simpan dengan nama UnitCetakKarcis.

    3.8.Form Laporan Data Petugas

    ScreenShot :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form8 Name Form8

    Caption LAPORAN DATA PETUGAS

    Table1 Name Tdata

  • 7/23/2019 Tutorial Program Karcis Tol

    24/25

    Tutorial Delphi 7 Program Karcis Tol| 24

    Database Name DB_Tol

    Table Name PETUGAS.db

    Active True

    DataSource1 Name DSdata

    DataSet Tdata

    Enabled True

    Qreport1 Bands Has Title True

    Bands Has Detail True

    Dataset TData

    TitleBand1 Has Child True

    Frame Draw Bottom True

    Frame Width 2

    QRLabel Caption LAPORAN DATA PETUGAS

    QRLabel Caption Kode Petugas

    QRLabel Caption Nama

    QRLabel Caption Gender

    QRLabel Caption Telp

    QRLabel Caption Alamat

    QRDBText1 DataSource Dsdata

    DataField Kd_petugasQRDBText2 DataSource DSdata

    DataField Nama

    QRDBText3 DataSource Dsdata

    DataField Kelamin

    QRDBText4 DataSource DSdata

    DataField Telp

    QRDBText5 DataSource Dsdata

    DataField Alamat

    Tambahkan Uses UnitUtamadibawah kode impelementation.Untuk menampilkan Jenis Kelaminperlu ditambahkan Field Kalkulasi pada Tdata, berikut

    caranya :

    9. Klik 2x pada Tdata hingga muncul popup menu

    10.Pilih Fields Editor..., klik kanan dan pilih Add All Fields

    11.Klik kanan lagi, pilih New Fields

    12.Ketikkan Kelaminpada name

    13.Pilih stringuntuk type

    14.

    Isikan 6untuk size

    15.

    Field type berupa Calculate16.

    Tambahkan kode pada komponen Tdata events onCalc :

    Simpan dengan nama UnitCetakPetugas.

    F8.CF(DS: DS); 'G' = .:='P'.:='';

    ;

  • 7/23/2019 Tutorial Program Karcis Tol

    25/25

    3.9.Form Cetak Karcis Tol

    ScreenShot :

    Komponen dan properties-nya :

    Nama Komponen Properties Nilai

    Form9 Name Form9Caption Karcis

    Qreport1 Bands Has Title True

    Page Bottom Margin 5mm

    Page Top Margin 5mm

    Page Right Margin 5mm

    Page Left Margin 5mm

    Page Length 60mm

    Page Width 55mm

    QRLabel Caption KARCIS TOL

    QRLabel Caption Golongan

    QRLabel Caption Tarif

    QRDBText1 DataSource Form5.TKarcis

    DataField No.srtuk

    QRDBText2 DataSource Form5.TKarcis

    DataField No.pol

    QRDBText3 DataSource Form5.TKarcis

    DataField Kd_golongan

    QRDBText4 DataSource Form5.TKarcis

    DataField Bayar

    QRDBText5 DataSource Form5.TKarcis

    DataField Tgl

    QRDBText6 DataSource Form5.TKarcis

    DataField TimeQRDBText7 DataSource Form5.TKarcis

    DataField Petugas

    Tambahkan Uses UnitKarcisdibawah kode impelementation.

    Simpan dengan nama UnitKarcisPrint.