Sabtu, 02 Mei 2015

Program Penjualan  :
 
var

  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  if ComboBox1.ItemIndex = 0 then
  begin
  Lnama.Caption := 'Genteng Multiroof';
  Lharga.Caption := '50000';
  end;
   if ComboBox1.ItemIndex = 1 then
  begin
  Lnama.Caption := 'Gypsum Standar';
  Lharga.Caption := '45000';
  end;
   if ComboBox1.ItemIndex = 2 then
  begin
  Lnama.Caption := 'Gypsum WaterProof';
  Lharga.Caption := '85000';
  end;
   if ComboBox1.ItemIndex = 3 then
  begin
  Lnama.Caption := 'Baja Ringan';
  Lharga.Caption := '175000';
  end;
end;
procedure TForm1.NewClick(Sender: TObject);
begin
  ComboBox1.Text := 'Pilih';
  Lnama.Caption := '-';
  Lharga.Caption :='-';
  Lbeli.Caption :='0';
  Lsubtotal.Caption := '-';
  Ldiskon.Caption := '-';
  Ltotal.Caption := '-';
  Lbonus.Caption := '-';
  Lkupon.Caption := '-';
  Memo1.Clear;
  Memo1.Lines.Append('semutjunior.blogspot');
  Memo1.Lines.Append('');
end;
procedure TForm1.ExitClick(Sender: TObject);
begin
  close;
end;
procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
  Lbeli.Caption := IntToStr(UpDown1.Position);
end;
procedure TForm1.ProsesClick(Sender: TObject);
 var harga, beli :integer;
     subtotal, diskon, total, kupon : real;
     bonus : string;
begin
  harga := StrToInt(Lharga.Caption);
  beli := UpDown1.Position;
  subtotal := harga*beli;
  //diskon

  case beli of
  0..15 : diskon := 5/100*subtotal;
  16..25 : diskon := 15/100*subtotal;
  end;
  total := subtotal-diskon;
  //bonus

  if (ComboBox1.ItemIndex = 3) and (StrToInt(Lbeli.Caption) >30) then
  begin
  Lbonus.Caption := '1 kaleng cat tembok 15 L';
  end
  else
  Lbonus.Caption := '-';
  //kupon

  if total > 100000 then
  Lkupon.Caption := '1 kupon'
  else
  Lkupon.Caption := '-';
  //untuk menampilkan

  Lsubtotal.Caption := FloatToStrF(subtotal,ffCurrency, 12,0);
  Ldiskon.Caption := FloatToStrF(diskon,ffCurrency, 12,0);
  Ltotal.Caption := FloatToStrF(total,ffCurrency, 12,0);
  //menampilkan ke memo

  Memo1.Clear;
  Memo1.Lines.Append('semutjunior.blogspot');
  Memo1.Lines.Append('');
  Memo1.Lines.Append('nama ='+Lnama.Caption);
  Memo1.Lines.Append('harga ='+Lharga.Caption);
  Memo1.Lines.Append('beli ='+Lbeli.Caption);
  Memo1.Lines.Append('subtotal ='+Lsubtotal.Caption);
  Memo1.Lines.Append('diskon ='+Ldiskon.Caption);
  Memo1.Lines.Append('total ='+Ltotal.Caption);
  Memo1.Lines.Append('bonus ='+Lbonus.Caption);
  Memo1.Lines.Append('kupon ='+Lkupon.Caption);
end;
end.

0 komentar :

Posting Komentar