<!--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.