Monday, 15 April 2013

Contoh program delphi 7 penjualan di toko


untuk komponen yang di butuhkan:

atau mau download langsung filenya disini

TForm1 = class(TForm)
    Label12: TLabel;
    Panel9: TPanel;
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Edit1: TEdit;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    ComboBox1: TComboBox;
    Panel5: TPanel;
    Panel6: TPanel;
    Panel7: TPanel;
    Panel8: TPanel;

source codenya


procedure TForm1.ComboBox1Change(Sender: TObject);

begin

if ComboBox1.Text='Ps-01' then
  begin
    label9.Caption:='Processor amd phenom x2';
    label10.Caption:='1100000';
  end else
if ComboBox1.Text='Ps-02' then
  begin
    label9.Caption:='Processor intel core i3';
    label10.Caption:='850000';
  end else
if ComboBox1.Text='Nb-01' then
  begin
    label9.Caption:='Notebook toshiba c 600';
    label10.Caption:='3750000';
  end else
  begin
    label9.Caption:='Printer Canon IP 2770i';
    label10.Caption:='375000';
  end
end;

procedure TForm1.Panel7Click(Sender: TObject);
var beli,harga,subtotal:integer;
  diskon, total:real;
begin
beli:=StrToInt(edit1.Text);
harga:=StrToInt(label10.Caption);
subtotal:=harga*beli;
panel2.Caption:=floatToStr(subtotal);


if edit1.Text>'2' then
  begin
    diskon:=(10/100)*subtotal;
    panel3.Caption:=FloatToStr(diskon);
  end
  else
  begin
    panel3.Caption:='Tidak dapat';
  end;

  total:=subtotal-diskon;
  panel4.Caption:=FloatToStr(total);

  if (panel2.Caption >='1000000')  and (panel2.Caption <= '2400000') then
      begin
      label11.Caption:='Mouse Optic'
      end
 else if panel2.Caption > '2500000' then
        begin
       label11.Caption:='Mouse wireless'
       end
   else
   label11.Caption:='Mouse pad'
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not(key in['0'..'9'] )then
 key:=#0;

end;

procedure TForm1.Panel8Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TForm1.Panel6Click(Sender: TObject);
begin
Edit1.Clear;
Label9.Caption:='---------';
Label10.Caption:='---------';
Label11.Caption:='---------';
Panel2.Caption:='panel2';
Panel3.Caption:='if beli > 2';
Panel4.Caption:='panel4';
end;

end.