- Beranda
- Programmer Forum
Need Help Master Delphi
...
TS
dimitlah
Need Help Master Delphi
Gan, tolong bantuin cr membatasi nilai tarik simpanan tidak boleh melebihi nilai simpanan sukarela biar totalnya ga jd minus 
contoh di dalam edibox1 ada angka 1 dan editbox 2 ada angka 2..nah pas saya tekan tombol hitung supaya tidak -1 hasilnya codingnya gmn gan?
berikut gambarnya :
berikut coding ane pada tombol "Tambah"
procedure Tfrmtariksimpanan.Button1Click(Sender: TObject);
var sisa,tr,ss:real;
i:integer;
sis:currency;
begin
if Edit16.Text='' then
begin
ShowMessage('No Tarik Tidak Boleh Kosong');
Edit16.SetFocus;
Exit;
end;
if DBLookupcombobox1.Text='' then
begin
ShowMessage('Pilih No Anggota');
DBLookupcombobox1.SetFocus;
Exit;
end;
if Edit4.Text='' then
begin
ShowMessage('Silahkan Isi Nilai Tarik Simpanan!');
Edit4.SetFocus;
Exit;
end;
sg.RowCount:=sg.RowCount+1;
sg.Cells[1,sg.RowCount-1]:=Edit16.Text;
sg.Cells[2,sg.RowCount-1]:=DateToStr(Datetimepicker1.date);
sg.Cells[3,sg.RowCount-1]:=DBLookupcombobox1.text;
sg.Cells[4,sg.RowCount-1]:=DBEdit1.Text;
sg.Cells[5,sg.RowCount-1]:=DBEdit2.Text;
sg.Cells[6,sg.RowCount-1]:=Edit4.Text;
ss:=strtofloat(DBEdit2.Text);
tr:=strtofloat(edit4.Text);
sisa:=ss-tr;
sg.Cells[7,sg.RowCount-1]:=floattostr(sisa);
for i:=1 to sg.RowCount-1 do
begin
sis:=sis+strtocurr(sg.Cells[7,i]);
sg.Cells[0,i]:=inttostr(i);
end;
edit2.Text:=currtostr(sis);
end;

contoh di dalam edibox1 ada angka 1 dan editbox 2 ada angka 2..nah pas saya tekan tombol hitung supaya tidak -1 hasilnya codingnya gmn gan?
berikut gambarnya :
Spoiler for Preview:
berikut coding ane pada tombol "Tambah"
procedure Tfrmtariksimpanan.Button1Click(Sender: TObject);
var sisa,tr,ss:real;
i:integer;
sis:currency;
begin
if Edit16.Text='' then
begin
ShowMessage('No Tarik Tidak Boleh Kosong');
Edit16.SetFocus;
Exit;
end;
if DBLookupcombobox1.Text='' then
begin
ShowMessage('Pilih No Anggota');
DBLookupcombobox1.SetFocus;
Exit;
end;
if Edit4.Text='' then
begin
ShowMessage('Silahkan Isi Nilai Tarik Simpanan!');
Edit4.SetFocus;
Exit;
end;
sg.RowCount:=sg.RowCount+1;
sg.Cells[1,sg.RowCount-1]:=Edit16.Text;
sg.Cells[2,sg.RowCount-1]:=DateToStr(Datetimepicker1.date);
sg.Cells[3,sg.RowCount-1]:=DBLookupcombobox1.text;
sg.Cells[4,sg.RowCount-1]:=DBEdit1.Text;
sg.Cells[5,sg.RowCount-1]:=DBEdit2.Text;
sg.Cells[6,sg.RowCount-1]:=Edit4.Text;
ss:=strtofloat(DBEdit2.Text);
tr:=strtofloat(edit4.Text);
sisa:=ss-tr;
sg.Cells[7,sg.RowCount-1]:=floattostr(sisa);
for i:=1 to sg.RowCount-1 do
begin
sis:=sis+strtocurr(sg.Cells[7,i]);
sg.Cells[0,i]:=inttostr(i);
end;
edit2.Text:=currtostr(sis);
end;
Diubah oleh dimitlah 02-05-2013 15:02
0
689
1
Komentar yang asik ya
Mari bergabung, dapatkan informasi dan teman baru!
Programmer Forum
20.2KThread•4.9KAnggota
Urutkan
Terlama
Komentar yang asik ya