About
Contact
Disclaimer
Sitemap
coretanhans
Artikel dan Tips & Trick ada di website ini, selamat datang di coretanhans.com
Blogger
Food
Insurance
Lifestyle
Healthy
Technology
Error
More
Disclaimer
Sitemap
Theme
Tutorial
Home
Delphi 7
Perpustakaan
Aplikasi Perpustakaan - Edisi 6 (Form Transaksi Peminjaman)
Aplikasi Perpustakaan - Edisi 6 (Form Transaksi Peminjaman)
Hans
Agustus 13, 2019
Program Perpustakaan.
Tampilan Menu Utama
1. Membuat Form Transaksi Peminjaman.
Selanjutnya kita membuat Form TransaksiPemijaman, untuk source kode kalian bisa lihat di bawah sini:
source code:
1: unit Unit5;
2:
3: interface
4:
5: uses
6: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7: Dialogs, StdCtrls, XPMan, DB, ADODB, Buttons, ComCtrls;
8:
9: type
10: TForm_Peminjaman = class(TForm)
11: GroupBox1: TGroupBox;
12: XPManifest1: TXPManifest;
13: Label1: TLabel;
14: ComboBox1: TComboBox;
15: Label2: TLabel;
16: Edit1: TEdit;
17: Query: TADOQuery;
18: GroupBox2: TGroupBox;
19: Label3: TLabel;
20: Label4: TLabel;
21: ComboBox2: TComboBox;
22: Edit2: TEdit;
23: ListBox1: TListBox;
24: GroupBox3: TGroupBox;
25: Label5: TLabel;
26: DateTimePicker1: TDateTimePicker;
27: DateTimePicker2: TDateTimePicker;
28: Label6: TLabel;
29: Label7: TLabel;
30: Edit3: TEdit;
31: BitBtn2: TBitBtn;
32: Button1: TButton;
33: BitBtn1: TBitBtn;
34: procedure FormActivate(Sender: TObject);
35: procedure ComboBox1Click(Sender: TObject);
36: procedure ComboBox2Click(Sender: TObject);
37: procedure Button1Click(Sender: TObject);
38: procedure BitBtn1Click(Sender: TObject);
39: procedure BitBtn2Click(Sender: TObject);
40: procedure FormClose(Sender: TObject; var Action: TCloseAction);
41: private
42: { Private declarations }
43: public
44: procedure CekForm;
45: { Public declarations }
46: end;
47:
48: var
49: Form_Peminjaman: TForm_Peminjaman;
50:
51: implementation
52:
53: uses unit2;
54:
55: {$R *.dfm}
56:
57: procedure TForm_Peminjaman.CekForm;
58: begin
59: if (strtoint(edit3.Text) > 0) and (edit1.Text <> '') then
60: bitbtn1.Enabled := true
61: else
62: bitbtn1.Enabled := false;
63: end;
64:
65: procedure TForm_Peminjaman.FormActivate(Sender: TObject);
66: begin
67: combobox1.Clear;
68: combobox2.Clear;
69: edit1.Clear;
70: edit2.Clear;
71: edit3.Clear;
72: listbox1.Clear;
73: Query.Connection := Form_Utama.Koneksi;
74: Query.SQL.Add('select id_anggota from tabel_anggota;');
75: Query.Active := true;
76:
77: while not Query.Eof do
78: begin
79: combobox1.Items.Add(Query['id_anggota']);
80: Query.Next;
81: end;
82:
83: Query.Active := false;
84: Query.SQL.Clear;
85: Query.SQL.Add('select kd_buku from tabel_buku;');
86: Query.Active := true;
87:
88: while not Query.Eof do
89: begin
90: combobox2.Items.Add(Query['kd_buku']);
91: Query.Next;
92: end;
93:
94: Query.Active := false;
95: Query.SQL.Clear;
96:
97: datetimepicker1.Date := Date;
98: datetimepicker2.Date := (Date + 7);
99: edit3.Text := inttostr(listbox1.Count);
100: end;
101:
102: procedure TForm_Peminjaman.ComboBox1Click(Sender: TObject);
103: begin
104: Query.SQL.Add('select nm_anggota from tabel_anggota where id_anggota="' +
combobox1.Text + '";');
105: Query.Active := true;
106: edit1.Text := Query['nm_anggota'];
107: Query.Active := false;
108: Query.SQL.Clear;
109: CekForm;
110: end;
111:
112: procedure TForm_Peminjaman.ComboBox2Click(Sender: TObject);
113: begin
114: Query.SQL.Add('select judul from tabel_buku where kd_buku="' + combobox2.Text + '";');
115: Query.Active := true;
116: edit2.Text := Query['judul'];
117: Query.Active := false;
118: Query.SQL.Clear;
119: button1.Enabled := true;
120: end;
121:
122: procedure TForm_Peminjaman.Button1Click(Sender: TObject);
123: begin
124: listbox1.Items.Add(combobox2.Text);
125: combobox2.Items.Delete(combobox2.ItemIndex);
126: combobox2.Text := '';
127: edit2.Clear;
128: edit3.Text := inttostr(listbox1.Count);
129: button1.Enabled := false;
130: CekForm;
131: end;
132:
133: procedure TForm_Peminjaman.BitBtn1Click(Sender: TObject);
134: var
135: i,j: integer;
136: begin
137: Query.SQL.Add('select * from tabel_peminjaman;');
138: Query.Active := true;
139: i := 0;
140: j := (listbox1.Count - 1);
141: listbox1.ItemIndex := 0;
142:
143: while (i <= j) do
144: begin
145: Query.InsertRecord([combobox1.Text, listbox1.Items[i],
FormatDateTime('dd/mm/yyyy',datetimepicker1.Date),
FormatDateTime('dd/mm/yyyy',datetimepicker2.Date), 1, 0]);
146: i := i + 1;
147: end;
148:
149: Query.Active := false;
150: Query.SQL.Clear;
151:
152: MessageDlg('Sukses!',mtInformation,[mbOk],0);
153: close;
154: end;
155:
156: procedure TForm_Peminjaman.BitBtn2Click(Sender: TObject);
157: begin
158: close;
159: end;
160:
161: procedure TForm_Peminjaman.FormClose(Sender: TObject;
162: var Action: TCloseAction);
163: begin
164: Form_Utama.Panel1.Show;
165: end;
166:
167: end.
Posting Lebih Baru
Posting Lama
Related Posts
Comments
Langganan:
Posting Komentar ( Atom )
Info Arlina
Comments