Monday, February 13, 2012

Tutorial membuat aplikasi Client-server

hello sobat blogger kali ini saya tidak akan membahas tentang tutorial blogger seperti biasanya melainkan tutorial programmer,yah gpp blog ini kan mmg untuk share ilmu kawan,dan kebanyakan juga sobat blogger merupakan programmer juga,contohnya seperti saya hehe...

emm saya menguasai beberapa bahasa seperti PHP,SQL,dan BASIC dan untuk kali ini saya akan mengajarkan cara membuat APLIKASI BERBASIS CLIENT-SERVER yang menggunakan program DELPHI 7.0,mungkin bagi teman2lagi beljar DELPHI nha ini salah satu contoh aplikasi yang dapat kawan2 buat....
oke kita mulai saja bahas tutornya,kali ini projectnya tentang APLIKASI DATA TRANSAKSI SISWA yah yg sederhana dulu kawan tp scriptnya udah bikin pusing ^_^


Kita mulai pembuatan Form1 (dimana form utama atau tampilan awal aplikasinya ) kawan2 Buka DELPHI >>File>>New>>Form trus  double klik pada form1 dan ganti codenya dengan script dibawah ini : 


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, DB, ADODB, DBTables, Grids, DBGrids, StdCtrls, ExtCtrls,
  Buttons, jpeg;

type
  Tutama = class(TForm)
    MainMenu1: TMainMenu;
    Mulai1: TMenuItem;
    Login1: TMenuItem;
    Logout1: TMenuItem;
    Exit1: TMenuItem;
    Data1: TMenuItem;
    Siswa1: TMenuItem;
    ransaksi1: TMenuItem;
    koneksi: TADOConnection;
    bitlogin: TBitBtn;
    bitsiswa: TBitBtn;
    bittransaksi: TBitBtn;
    bitkeluar: TBitBtn;
    Timer1: TTimer;
    hari: TLabel;
    waktu: TLabel;
    Panel1: TPanel;
    Panel2: TPanel;
    Label1: TLabel;
    Image1: TImage;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Button1: TButton;
    procedure Siswa1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
    procedure ransaksi1Click(Sender: TObject);
    procedure Login1Click(Sender: TObject);
    procedure Logout1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure bitinformasiClick(Sender: TObject);
    procedure bitloginClick(Sender: TObject);
    procedure bitsiswaClick(Sender: TObject);
    procedure bittransaksiClick(Sender: TObject);
    procedure bitkeluarClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  utama: Tutama;

implementation

uses Unit2, Unit4, Unit3, Unit5, information;
{$R *.dfm}
procedure Tutama.Siswa1Click(Sender: TObject);
begin
siswa.Show;
utama.Enabled:=false;
end;
procedure Tutama.FormCreate(Sender: TObject);
begin
logout1.Enabled:=false;
data1.Enabled:=false;
bitsiswa.Enabled:=false;
bittransaksi.Enabled:=false;
end;
procedure Tutama.Exit1Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure Tutama.ransaksi1Click(Sender: TObject);
begin
transaksi.Show;
utama.Enabled:=false;
end;
procedure Tutama.Login1Click(Sender: TObject);
begin
login.Show;
utama.Enabled:=false;
end;
procedure Tutama.Logout1Click(Sender: TObject);
begin
login.enabled:=true;
logout1.Enabled:=false;
data1.Enabled:=false;
bitsiswa.Enabled:=false;
bittransaksi.Enabled:=false;
bitlogin.Enabled:=true;
MessageDlg('Silahkan Login Kembali Jika Ingin Melihat Data',mtInformation,[mbOK],0);
end;

procedure Tutama.Timer1Timer(Sender: TObject);
var
  DataHari   : TDateTime;
  Days       : array[1..7] of string;
  Present    : TDate;
  Hr,Bln,Thn : Word;
  Bulan      : String;
begin

  Present:=Now;
  Decodedate(Present,Hr,Bln,Thn);
  if Bln=1 then
     Bulan:='Januari' else
  if Bln=2 then
     Bulan:='Februari' else
  if Bln=3 then
     Bulan:='Maret' else
  if Bln=4 then
     Bulan:='April' else
  if Bln=5 then
     Bulan:='Mei' else
  if Bln=6 then
     Bulan:='Juni' else
  if Bln=7 then
     Bulan:='Juli' else
  if Bln=8 then
     Bulan:='Agustus' else
  if Bln=9 then
     Bulan:='September' else
  if Bln=10 then
     Bulan:='Oktober' else
  if Bln=11 then
     Bulan:='Nopember' else
     Bulan:='Desember';

  // Menentukan nama hari
  days[1] := 'Minggu';
  days[2] := 'Senin';
  days[3] := 'Selasa';
  days[4] := 'Rabu';
  days[5] := 'Kamis';
  days[6] := 'Jum''at';
  days[7] := 'Sabtu';
  DataHari := Date;

  Hari.Caption:=days[DayOfWeek(DataHari)]+',  '+Inttostr(Thn)+' '+Bulan+' '+Inttostr(Hr);
  waktu.Caption:=timetostr(time);
end;
procedure Tutama.bitinformasiClick(Sender: TObject);
begin
informasi.Show;
end;
procedure Tutama.bitloginClick(Sender: TObject);
begin
login.show;
end;
procedure Tutama.bitsiswaClick(Sender: TObject);
begin
siswa.Show;
end;
procedure Tutama.bittransaksiClick(Sender: TObject);
begin
transaksi.SHOW;
end;
procedure Tutama.bitkeluarClick(Sender: TObject);
begin
Application.Terminate;
end;
procedure Tutama.Button1Click(Sender: TObject);
begin
informasi.Show;
end;
end.

Hasilnya seperti ini :




Oke itu Form1 kita lanjut Form ke 2 yang biasanya form ini merupakan Form Login buat Aplikasi yang dibuat,,ulangi cara membuat form baru seperti d atas tadi lalu ganti codenya dengan ini :

unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB;

type
  Tlogin = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    EditUsername: TEdit;
    EditPassword: TEdit;
    ButtonLogin: TButton;
    ADOQuery1: TADOQuery;
    Button1: TButton;
    Label3: TLabel;
    procedure ButtonLoginClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure EditPasswordKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  login: Tlogin;

implementation

uses Unit1;

{$R *.dfm}

procedure Tlogin.ButtonLoginClick(Sender: TObject);
var
  Ketemu : Boolean;
  strUserid, strUsername, strPass1, strPass2: String;
begin
  EditUsername.Text := Trim(EditUsername.Text);
  EditPassword.Text := Trim(EditPassword.Text);

  if EditUsername.Text = '' then
    begin
      EditUsername.SetFocus;
      MessageDlg('Maav user name belum terisi',mtWarning,[mbOK],0);
      Exit;
    end
  else
    strUserid := EditUsername.Text;

  if EditPassword.Text = '' then
    begin
      EditPassword.SetFocus;
      MessageDlg('Maav password anda belum terisi',mtWarning,[mbOK],0);
      Exit;
    end
  else
    strPass1 := EditPassword.Text;

  with ADOQuery1 do
  begin
    SQL.Clear;
    SQL.Append('select * from login where user_name='+QuotedStr(strUserid));
    try
      Open;
      if not Eof then
        begin
          Ketemu := True;
          strPass2 := FieldValues['password'];
          strUsername := FieldValues['user_name'];
        end
      else
        begin
          Ketemu := False;
          strPass2 := '';
          strUsername := '';
        end;
    finally
      Close;
    end;
    end;
  if not Ketemu then
    begin
      MessageDlg('Username tidak terdaftar',mtWarning,[mbOK],0);
      EditUsername.Text := '';
      EditUsername.SetFocus;
      Exit;
    end;
  if strPass1 <> strPass2 then
    begin
      MessageDlg(' Maav password Anda Salah !',mtWarning,[mbOK],0);
      EditPassword.Text := '';
      EditPassword.SetFocus;
      Exit;
    end;

  with utama do
  begin
    utama.Enabled:=true;
    login1.Enabled:=false;
    logout1.Enabled:=true;
    data1.Enabled:=true;
    bitsiswa.Enabled:=true;
    bittransaksi.Enabled:=true;
    bitlogin.Enabled:=false;
  end;
  MessageDlg('Login Berhasil',mtInformation,[mbOK],0);
  Close;
end;
procedure Tlogin.FormActivate(Sender: TObject);
begin
EditUsername.Text:='';
EditPassword.Text:='';
end;
procedure Tlogin.EditPasswordKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = vk_return then
    ButtonLogin.SetFocus;
end;
procedure Tlogin.Button1Click(Sender: TObject);
begin
close;
end;
procedure Tlogin.FormCreate(Sender: TObject);
begin
end;
end.

Hasilnya akan seperti ini : 



Next kawan..hehe Form 3 (dimana form 3 merupakan table pengisian data pertama yaitu data siswa) nih kodenya :

unit Unit2;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, DBTables, Grids, DBGrids;

type
  Tsiswa = class(TForm)
    edit1: TEdit;
    edit2: TEdit;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    cmbnew: TButton;
    cmbsimpan: TButton;
    cmbhapus: TButton;
    cmbubah: TButton;
    cmbkeluar: TButton;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Table1: TTable;
    ADOConnection1: TADOConnection;
    Label7: TLabel;
    ADOQuery1: TADOQuery;
    Label8: TLabel;
    procedure cmbnewClick(Sender: TObject);
    procedure cmbkeluarClick(Sender: TObject);
    procedure cmbsimpanClick(Sender: TObject);
    procedure cmbhapusClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure cmbubahClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure edit1Change(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  siswa: Tsiswa;

implementation

uses Unit1;

{$R *.dfm}

procedure Tsiswa.cmbnewClick(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
ComboBox1.Text:='';
ComboBox2.Text:='';
ComboBox3.Text:='';
ComboBox4.Text:='';

Edit1.Enabled:=true;
Edit2.Enabled:=true;
ComboBox1.Enabled:=true;
ComboBox2.Enabled:=true;
ComboBox3.Enabled:=true;
ComboBox4.Enabled:=true;
edit1.SetFocus;
end;

procedure Tsiswa.cmbkeluarClick(Sender: TObject);
begin
with utama do
  begin
  utama.Enabled:=true;
  end;
close;
end;

procedure Tsiswa.cmbsimpanClick(Sender: TObject);
begin
if edit1.text = '' then
begin
  MessageDlg('Data NISN Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
  end;
  if edit2.text = '' then
  begin
    MessageDlg('Data Nama Siswa Harus Di Isi',mtWarning,[mbOk],0);
    Exit;
  end;
  if ComboBox1.text = '' then
  begin
    MessageDlg('Data Jenis Kelamin Harus Di Isi',mtWarning,[mbOk],0);
    Exit;
  end;
  if ComboBox2.text = '' then
  begin
    MessageDlg('Data Agama Harus Di Isi',mtWarning,[mbOk],0);
    Exit;
  end;
  if ComboBox3.text = '' then
  begin
    MessageDlg('Data Kompetensi Keahlian Harus Di Isi',mtWarning,[mbOk],0);
    Exit;
  end;
  if ComboBox4.text = '' then
  begin
    MessageDlg('Data Kelas Harus Di Isi',mtWarning,[mbOk],0);
    Exit;
end
else
begin

Table1.Append;
Table1['nisn']:=edit1.Text;
Table1['nama_siswa']:=edit2.Text;
Table1['jk']:=ComboBox1.Text;
Table1['agama']:=ComboBox2.Text;
Table1['kom_keahlian']:=ComboBox3.Text;
Table1['kelas']:=ComboBox4.Text;
Table1.Refresh;

edit1.Text:='';
edit2.Text:='';
ComboBox1.Text:='';
ComboBox2.Text:='';
ComboBox3.Text:='';
ComboBox4.Text:='';

Edit1.Enabled:=false;
Edit2.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
ComboBox4.Enabled:=false;
MessageDlg('Simpan Data Berhasil',mtInformation,[mbOK],0);
end;

end;

procedure Tsiswa.cmbhapusClick(Sender: TObject);
begin
Table1.Delete;
table1.Refresh;
MessageDlg('Hapus Data Berhasil',mtInformation,[mbOk],0);
end;

procedure Tsiswa.FormShow(Sender: TObject);
begin
table1.Refresh;

edit1.Text:='';
edit2.Text:='';
ComboBox1.Text:='';
ComboBox2.Text:='';
ComboBox3.Text:='';
ComboBox4.Text:='';

Edit1.Enabled:=false;
Edit2.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
ComboBox4.Enabled:=false;
end;

procedure Tsiswa.cmbubahClick(Sender: TObject);
begin
Table1.Edit;
Table1['nisn']:=edit1.Text;
Table1['nama_siswa']:=edit2.Text;
Table1['jk']:=ComboBox1.Text;
Table1['agama']:=ComboBox2.Text;
Table1['kom_keahlian']:=ComboBox3.Text;
Table1['kelas']:=ComboBox4.Text;
Table1.Refresh;

edit1.Text:='';
edit2.Text:='';
ComboBox1.Text:='';
ComboBox2.Text:='';
ComboBox3.Text:='';
ComboBox4.Text:='';

Edit1.Enabled:=false;
Edit2.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
ComboBox4.Enabled:=false;

MessageDlg('Ubah Data Berhasil',mtInformation,[mbOk],0);
end;

procedure Tsiswa.FormActivate(Sender: TObject);
begin
table1.Refresh;
end;

procedure Tsiswa.edit1Change(Sender: TObject);
var
ketemu : Boolean;
begin
with ADOQuery1 do
  begin
    SQL.Clear;
    SQL.Append('select * from datasiswa where nisn='+QuotedStr(edit1.text));
    try
      Open;
      if not Eof then
        begin
          Ketemu := True;
          edit2.text := FieldValues['nama_siswa'];
          ComboBox1.text := FieldValues['jk'];
          ComboBox2.text:= FieldValues['agama'];
          ComboBox3.text:= FieldValues['kom_keahlian'];
          ComboBox4.text:= FieldValues['kelas'];
        end;
    finally
      Close;
    end;
end;
end;
procedure Tsiswa.FormCreate(Sender: TObject);
begin
end;
end.

dan hasilnya :




Lanjuuutttttt...hhehe Form 4 (Dimana merupakan Form terakhir pengisian data yaitu Data transaksi itu sendiri yang tadi Data siswanya.hehe ) ini codenya cekidot :

unit Unit5;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, DBTables, Grids, DBGrids;

type
  Ttransaksi = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Edit4: TEdit;
    ComboBox3: TComboBox;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Table1: TTable;
    ADOConnection1: TADOConnection;
    Label11: TLabel;
    Label12: TLabel;
    ComboBox4: TComboBox;
    Button6: TButton;
    ADOQuery1: TADOQuery;
    ADOQuery2: TADOQuery;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Edit2Change(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    a,b,c,d : integer;
  end;

var
  transaksi: Ttransaksi;

implementation

uses Unit1;

{$R *.dfm}

procedure Ttransaksi.Button1Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='0';
edit5.Text:='0';
edit6.Text:='0';
edit7.Text:='0';
ComboBox1.text:='';
ComboBox2.text:='';
ComboBox3.text:='';
ComboBox4.Text:='';

edit1.Enabled:=true;
edit2.Enabled:=true;
edit4.Enabled:=true;
edit6.Enabled:=true;
ComboBox3.Enabled:=true;
ComboBox4.Enabled:=True;
Button6.Enabled:=true;
Edit1.SetFocus;
end;

procedure Ttransaksi.Button2Click(Sender: TObject);
begin
if edit1.text = '' then
  begin
  MessageDlg('Data No Transaksi Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if edit2.text = '' then
  begin
  MessageDlg('Data NISN Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if edit3.text = '' then
  begin
  MessageDlg('Data Nama Siswa Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if ComboBox1.text = '' then
  begin
  MessageDlg('Data Kompetensi Keahlian Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if ComboBox2.text = '' then
  begin
  MessageDlg('Data Kelas Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if ComboBox3.text = '' then
  begin
  MessageDlg('Data Jumlah Bulan Di Bayar Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if ComboBox4.text = '' then
  begin
  MessageDlg('Data Macam-Macam Iuran Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if edit4.text = '' then
  begin
  MessageDlg('Data Harga Iuran Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if edit5.text = '' then
  begin
  MessageDlg('Data Total Bayar Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if edit6.text = '' then
  begin
  MessageDlg('Data Jumlah Uang Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end;
if edit7.text = '' then
  begin
  MessageDlg('Data Sisa Uang Harus Di Isi',mtWarning,[mbOk],0);
  Exit;
end
else
begin
Table1.Append;
Table1['no_trans']:=edit1.text;
Table1['nisn']:=edit2.text;
Table1['nama_siswa']:=edit3.text;
Table1['kom_keahlian']:=ComboBox1.text;
Table1['kelas']:=ComboBox2.text;
Table1['jml_bln_d_byr']:=ComboBox3.text;
Table1['macam_iuran']:=ComboBox4.text;
Table1['harga_iuran']:=edit4.text;
Table1['total_bayar']:=edit5.text;
Table1['jml_uang']:=edit6.text;
Table1['sisa_uang']:=edit7.text;
Table1.Refresh;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='0';
edit5.Text:='0';
edit6.Text:='0';
edit7.Text:='0';
ComboBox1.text:='';
ComboBox2.text:='';
ComboBox3.text:='';
ComboBox4.Text:='';

edit1.Enabled:=false;
edit2.Enabled:=false;
edit3.Enabled:=false;
edit4.Enabled:=false;
edit5.Enabled:=false;
edit6.Enabled:=false;
edit7.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
ComboBox4.Enabled:=False;
Button6.Enabled:=false;

MessageDlg('Simpan Data Berhasil',mtInformation,[mbOK],0);
end;

end;

procedure Ttransaksi.Button3Click(Sender: TObject);
begin
Table1.Delete;
table1.Refresh;
MessageDlg('Data Berhasil Di Hapus',mtInformation,[mbOK],0);
end;

procedure Ttransaksi.Button5Click(Sender: TObject);
begin
with utama do
begin
  utama.Enabled:=true;
end;
transaksi.Close;
end;

procedure Ttransaksi.Button4Click(Sender: TObject);
begin
Table1.Edit;
Table1['no_trans']:=edit1.text;
Table1['nisn']:=edit2.text;
Table1['nama_siswa']:=edit3.text;
Table1['kom_keahlian']:=ComboBox1.text;
Table1['kelas']:=ComboBox2.text;
Table1['jml_bln_d_byr']:=ComboBox3.text;
Table1['macam_iuran']:=ComboBox4.text;
Table1['harga_iuran']:=edit4.text;
Table1['total_bayar']:=edit5.text;
Table1['jml_uang']:=edit6.text;
Table1['sisa_uang']:=edit7.text;
Table1.Refresh;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='0';
edit5.Text:='0';
edit6.Text:='0';
edit7.Text:='0';
ComboBox1.text:='';
ComboBox2.text:='';
ComboBox3.text:='';
ComboBox4.Text:='';

edit1.Enabled:=false;
edit2.Enabled:=false;
edit3.Enabled:=false;
edit4.Enabled:=false;
edit5.Enabled:=false;
edit6.Enabled:=false;
edit7.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
ComboBox4.Enabled:=False;
button6.Enabled:=false;

MessageDlg('Ubah Data Berhasil',mtInformation,[mbOK],0);
end;

procedure Ttransaksi.Button6Click(Sender: TObject);
begin
a:=StrToInt(combobox3.text);
b:=StrToInt(edit4.text);

edit5.Text:=IntToStr(a*b);
c:=StrToInt(edit5.text);
d:=StrToInt(edit6.Text);

edit7.Text:=IntToStr(d-c);
end;

procedure Ttransaksi.FormShow(Sender: TObject);
begin
table1.Refresh;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
edit7.Text:='';
ComboBox1.text:='';
ComboBox2.text:='';
ComboBox3.text:='';
ComboBox4.text:='';

edit1.Enabled:=False;
edit2.Enabled:=False;
edit3.Enabled:=False;
edit4.Enabled:=False;
edit5.Enabled:=False;
edit6.Enabled:=False;
edit7.Enabled:=False;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
ComboBox4.Enabled:=False;
end;

procedure Ttransaksi.FormActivate(Sender: TObject);
begin
table1.Refresh;
edit3.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
edit5.Enabled:=false;
edit7.Enabled:=false;
Button6.Enabled:=false;
end;

procedure Ttransaksi.Edit1Change(Sender: TObject);
var
ketemu : Boolean;
begin
with ADOQuery1 do
  begin
    SQL.Clear;
    SQL.Append('select * from transaksi where no_trans='+QuotedStr(edit1.text));
    try
      Open;
      if not Eof then
        begin
          Ketemu := True;
          edit2.text := FieldValues['nisn'];
          ComboBox3.Text:= FieldValues['jml_bln_d_byr'];
          ComboBox4.Text:=FieldValues['macam_iuran'];
          edit4.Text:=FieldValues['harga_iuran'];
          edit6.text:=FieldValues['jml_uang'];
          edit5.text:=FieldValues['total_bayar'];
          edit7.text:=FieldValues['sisa_uang'];
        end;
    finally
      Close;
    end;
end;
end;

procedure Ttransaksi.Edit2Change(Sender: TObject);
var
ketemu : Boolean;
begin
with ADOQuery2 do
  begin
    SQL.Clear;
    SQL.Append('select * from datasiswa where nisn='+QuotedStr(edit2.text));
    try
      Open;
      if not Eof then
        begin
          Ketemu := True;
          edit3.text := FieldValues['nama_siswa'];
          ComboBox1.text:= FieldValues['kom_keahlian'];
          ComboBox2.text:= FieldValues['kelas'];
          edit3.Enabled:=false;
          ComboBox1.Enabled:=false;
          ComboBox2.Enabled:=false;
        end;
    finally
      Close;
    end;
end;
end;
procedure Ttransaksi.FormCreate(Sender: TObject);
begin
end;
end.

Dan hasilnya : jengjerenggggg......hehehe^_^ :


Oke selesai nih kawan sekarang APLIKASI BERBASIS CLIENT-SERVER sudah jadi Tinggal di COMPILE trus RUN n SAVE PROJECT (lihat tombal RUN d atas berwarna hijau)

*Note : Sebelumnya kawan2 sudah harus tau pembuatan databasenya dMySQL,lalu koneksi dengan NAVICAT for MySQL dan koneksi datbase dengan apliksai menggunakkan MySQL connector ODBC (terserah versi berapa tapi say menggunakan yang VERSI ODBC 5.1) setelah itu tinggal buat aplikasinya seperti di atas 

Nih buat kawan2 mungkin bingung atau malas namun nantinya tetap aj ujung2 Copas,saya kasih lagi Project program di atas yang sdh saya buat 

Selamat mencoba,semoga bermanfaat dan berhasil kawan ...





5 komentar:

Hendri.. said...

databaseny gak sekalian di upload ya?

Unknown said...

wkwkwk
apanya yg client server ini

Anonymous said...

databasenya mana ?

emil said...

Maaf Master dari mana proses client - servernya ? bisa sekalian diajarkan
Terima kasih sudah berbagi .... sukses selalu

bodo said...

post omong kosong ini preetttt

Post a Comment

 
Pratama Master powered by blogger.com
Design by Simple Diamond and Pratama Master