Pages

Minggu, 17 Juni 2012

Tugas Besar Praktikum Visual II (DELPHI)

FORM LOGIN


procedure TForm1.Button1Click(Sender: TObject);
begin
if(Edit1.Text = 'teo') and
(Edit2.Text = '102325') then
form2.show
else
Application.MessageBox('Maaf user name dan password salah. . .!!','warning',0);
exit;
end;
end.
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
end.

FORM 2

procedure TForm2.Exit1Click(Sender: TObject);
begin
close;
Application.MessageBox('Jangan lupa keluar','Warning',0);
exit;
end;
end.
procedure TForm2.ProgramPenjualanBarang1Click(Sender: TObject);
begin
form3.Show
end;
end.
procedure TForm2.Pencarian1Click(Sender: TObject);
begin
form4.show
end;
end.


FORM 3






procedure TForm3.Button1Click(Sender: TObject);
begin
  adotable1.Post;
  messagedlg('Data telah tersimpan',mtinformation,[mbok],0);
  dbedit1.Text:='';
  dbedit1.Text:='';
  dbedit1.Text:='';
  dbedit1.Text:='';
  dbedit1.Text:='';
  dbedit1.Text:='';
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
adotable1.Append;
end;

procedure TForm3.FormCreate(Sender: TObject);
begin
dbcombobox1.Items.Add('001');
dbcombobox1.Items.Add('002');
dbcombobox1.Items.Add('003');
dbcombobox1.Items.Add('004');
dbcombobox1.Items.Add('005');
end;

procedure TForm3.DBComboBox1Change(Sender: TObject);
begin
if dbcombobox1.ItemIndex=0 then
  begin
dbEdit1.Text:='notebook';
dbedit2.Text:='2000000';
  end
else if dbcombobox1.ItemIndex=1 then
  begin
dbEdit1.Text:='monitor';
dbedit2.Text:='800000';
  end
else if dbcombobox1.ItemIndex=2 then
  begin
dbEdit1.Text:='hardisk';
dbedit2.Text:='200000';
  end
else if dbcombobox1.ItemIndex=3 then
 begin
dbEdit1.Text:='cd-room';
dbedit2.Text:='20000';
  end
else if dbcombobox1.ItemIndex=4 then
  begin
dbEdit1.Text:='Keyboard';
dbedit2.Text:='50000';
  end;
end;
procedure TForm3.Button4Click(Sender: TObject);
begin
if dbEdit1.Text= '' then
  begin
  ShowMessage('Pilih dahulu barang yang ingin Anda hapus!');
  Exit;
  end;
  ADOTable1.Delete;
  ADOTable1.refresh;
end;
procedure TForm3.Button3Click(Sender: TObject);
begin
adoTable1.Edit;
AdoTable1.Refresh;
end;

procedure TForm3.Button5Click(Sender: TObject);
begin
close;
end;
procedure TForm3.Button6Click(Sender: TObject);
var
  i,j,total : integer;
  totbayar,diskon : real;
begin
  i:=strtoint(dbedit2.Text);
  j:=strtoint(dbedit3.Text);
  total:=i * j;
  dbedit4.Text:=IntToStr(total);
  if (total > 100000) and (total < 250000) then
  begin
    diskon:=0.5*total;
    dbedit5.Text:=FloatToStr(diskon);
  end
  else if (total > 250000) and (total < 500000) then
  begin
    diskon:=0.1*total;
    dbedit5.Text:=FloatToStr(diskon);
  end
else if (total > 500000) and (total <1000000) then
  begin
    diskon:=0.15*total;
    dbedit5.Text:=FloatToStr(diskon);
  end
else if (total > 1000000) then
begin
   diskon:=0.2*total;
    dbedit5.Text:=FloatToStr(diskon);
end;
    totbayar:=total-diskon;
    dbedit6.Text:=FloatToStr(totbayar);
end;
end.

FORM 4


procedure TForm5.Button1Click(Sender: TObject);
var
  kunci : string;
begin
  kunci := edit1.Text;
  if radiogroup1.ItemIndex = 0 then
  adotable1.IndexName:=''
  else if radiogroup1.ItemIndex=1 then
  adotable1.IndexName:= 'Nama barang';
if not adotable1.FindKey([kunci]) then
begin
MessageDlg(‘yang anda cari tidak ada’,mtinformation,[mbOK],0);
End;
adotable1.Refresh;
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
close;
end;
end.



 
 




Tidak ada komentar:

Posting Komentar