Loading halaman Tutorial Visual Basic, Delphi, PHP - Calon Programer : Latihan Program PENGGAJIAN ...



1. Buat Tabel Karyawan
Field Type    Size   Key
Kdkary A 5 *
Nmkary     A 20
Jabatan A 20
Gapok N
* Isi Tabel Karyawan
Kdkery     Nmkary Jabatan Gapok
K0001     Ratih Instruktur 1000000
K0002          Deni Indrawan   TS 900000
K003     Citra Angelin Assistent Lab   800000


2. Buat Tabel Penggajian
Field    Type     Size    Key
Noslip     A      6 *
Tgl     D
Kdkary     A      5
Tunjangan     N
PPH     N
Gaber     N
  1. Buat Form : Penggajian.pass
clip_image001
  1. Ketentuan
- Klik Add editbox bersih, tanggal & No Slip tampil otomatis
- Kode Karyawan di input ketika di enter maka tampil nama karyawan, jabatan dan gaji pokok tampil, jika data karyawan tidak ada maka tampil pesan “data tidak ada”
- Tunjangan Di isi ketika di enter pph dan gaji bersih tampil
PPh 5% dari (gapok+tunjangan)
Gaji bersih=gapok+tunjangan-pph
- Click Save maka data akan tersimpan di tabel penggajian
- Klik Exit maka form akan tertutup
CODING
unit PENGGAJIAN;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables, Grids, DBGrids;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label10: TLabel;
Label11: TLabel;
Edit8: TEdit;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Table1: TTable;
Table2: TTable;
procedure Button1Click(Sender: TObject);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure Edit6KeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
procedure bersih;
procedure aktif;
procedure nonaktif;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.aktif;
begin
edit1.Enabled:=true;
Edit2.Enabled:=true;
Edit3.Enabled:=true;
Edit4.Enabled:=true;
Edit5.Enabled:=true;
Edit6.Enabled:=true;
Edit7.Enabled:=true;
Edit8.Enabled:=true;
end;
procedure tform1.nonaktif;
begin
edit1.Enabled:=false;
Edit2.Enabled:=false;
Edit3.Enabled:=false;
Edit4.Enabled:=false;
Edit5.Enabled:=false;
Edit6.Enabled:=false;
Edit7.Enabled:=false;
Edit8.Enabled:=false;
end;
procedure tform1.bersih;
begin
edit1.text:='';
Edit2.text:='';
Edit3.text:='';
Edit4.text:='';
Edit5.text:='';
Edit6.text:='';
Edit7.text:='';
Edit8.text:='';
end;
procedure TForm1.Button1Click(Sender: TObject);
var
no:integer;
begin
no:=Table2.RecordCount+1;
Edit2.Text:=inttostr(no);
Edit1.Text:=datetostr(date);
aktif;
edit3.SetFocus;
end;
procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
if Table1.FindKey([Edit3.Text]) then
begin
Edit4.Text:=Table1['nmkary'];
if Table1['jabatan']='Instruktur' then
RadioButton1.Checked:=true
else
if Table1['jabatan']='Ts' then
RadioButton2.Checked:=true
else
RadioButton3.Checked:=true;
edit6.SetFocus;
Edit5.Text:=Table1['gapok'];
end
else
ShowMessage('Data Karyawan Tidak ada');
end;
end;
procedure TForm1.Edit6KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
Edit7.Text:=floattostr(strtofloat(Edit6.Text)*5/100);
Edit8.Text:=FloatToStr((strtofloat(Edit5.Text)+strtofloat(Edit6.Text))-StrToFloat(Edit7.Text));
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Table2.Append;
Table2['noslip']:=Edit2.Text;
Table2['tgl']:=date;
Table2['kdkary']:=Edit3.Text;
Table2['tunjangan']:=Edit6.Text;
Table2['pph']:=Edit7.Text;
Table2['gaber']:=Edit8.Text;
Table2.Post;
Application.MessageBox('Data Sudah Disimpan','Pesan',MB_ICONINFORMATION+mb_ok)
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bersih;
nonaktif;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if Application.MessageBox('Mau Keluar???','Pesan',MB_ICONQUESTION+MB_OKCANCEL)=idok then
close;
end;
end.
Buat download source code nya klik gambar dibawahRight hug
CP Download

0 Reply :

Posting Komentar

Jika ada pertanyaan atau request,Komentar pada tab blogger akan lebih memudahkan saya untuk membalasnya karena lebih mudah melakukan pengecekan komentar.