Tuesday, September 4, 2012

Script Form Penjualan dengan Stok

Berikut adalah contoh script form penjualan yang akan langsung memotong stok yang ada.

<!--04047d954f298406c70f609d6a8301d5-->
procedure TPenjualan.Edit2KeyPress(Sender: TObject; var Key: Char);
var
edi1:real;
edi2,edi3,edi4 :string;
begin
datamodule2.ADOQuery1.Active:=true;
if key = #13 then
begin
if (datamodule2.ADOQuerypart['stok']<0) or (datamodule2.ADOQuerypart['stok']<(strtoint(edit2.Text))) then
begin
showmessage('Stok Tidak Cukup');
exit;
end
else
datamodule2.ADOQuerypart.Edit;
datamodule2.ADOQuerypart.FieldValues['stok']:=datamodule2.ADOQuerypart.FieldValues['stok']-(strtoint(edit2.Text));
datamodule2.ADOQuerypart.Post;

datamodule2.ADOQuery1.Active:=true;

datamodule2.ADOQuery1.Append;
datamodule2.ADOQuery1['kd_brng']:=edit5.Text;

datamodule2.ADOQuery1['nm_brng']:=dbedit11.Text;

datamodule2.ADOQuery1['hrg_jual']:=edit1.text;

datamodule2.ADOQuery1['qty']:=edit2.text;

datamodule2.ADOQuery1['hrg_beli']:=dbedit3.Text;

edi2:=floattostr((strtofloat(Edit1.Text))*(strtofloat(edit2.Text)));
datamodule2.ADOQuery1['total']:=Edi2;

edi3:=floattostr((strtofloat(Edit2.Text))*(strtofloat(dbedit3.Text)));
datamodule2.ADOQuery1['total2']:=Edi3;



datamodule2.ADOQuery1.Post;
datamodule2.ADOQuery1['total']:=edi1;
edit6.Text:=floattostr(edi1+(strtofloat(edit6.Text)));


  edit5.Text:='';
  dbedit11.Text:='';
    edit1.Text:='';
      edit2.Text:='';
        dbedit3.Text:='';
        edit10.Text:='';
  Penjualan1.ActiveControl:=Edit5;


end;
end;

Demikian scriptnya semoga bermanfaat.

1 comment:

  1. kita juga punya nih artikel mengenai delphi, berikut linknya semoga bermanfaat ya :D
    http://repository.gunadarma.ac.id/bitstream/123456789/2320/1/Sinusoidal%20Scrolling%20OpenGL%20project%20in%20Delphi.pdf

    ReplyDelete