Darkc0der
20th November 2011, 09:57 AM
ceritanya ane pengen buat program tentang pembelian barang secara kredit..
nah sekarang ane sudah berhasil untuk membuat form transaksinya..
dan skarang lagi buat form pembayaran kredit/B]
disini ada permasalah tentang menentukan [B]berapa hari keterlabatan
misal : tgl_trans = 4 januari 2011
terus semestinya kan dia bayar kredit pertama tgl 4 februari 2011...
klo dia bayar tgl 10 februari kan bisa dengan pemisahan dd/mm/yyyy ..
tapi klo dia transaksi tgl 29 januari 2011 dan bayar 4 maret 2011 ...
gimana jadi solusinya dengan menggunakan borland delphi..
mohon bantuannya, baik berupa logika nya , sukur2 ada contoh nya..
nih yg udah coba saya buat..
PHP Code:
procedure TF_Kredit.btncektelatClick(Sender: TObject);
var
telatbln,telattahun:integer;
bulantrans,bulanbayar,tahun1,tahun2:string;
a,b,c,d,e,f,x:string;
begin
bulantrans:=MidStr(DateToStr(DateTimePicker1.Date) ,4,2);
if LeftStr(bulantrans,1)='0' then
begin
bulantrans:=RightStr(bulantrans,1);
ShowMessage(bulantrans);
end
else
begin
ShowMessage(bulantrans);
end;
tahun1:=RightStr(DateToStr(DateTimePicker1.date),4 );
tahun2:=RightStr(DateToStr(DateTimePicker2.date),4 );
bulanbayar:=MidStr(DateToStr(DateTimePicker2.Date) ,4,2);
if LeftStr(bulanbayar,1)='0' then
begin
bulanbayar:=RightStr(bulanbayar,1);
ShowMessage(bulanbayar);
end
else
begin
ShowMessage(bulanbayar);
end;
telatbln:=0;
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=0 then
begin
telatbln:=-30;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=1 then
begin
telatbln:=0;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=2 then
begin
telatbln:=30;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=3 then
begin
telatbln:=60;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=4 then
begin
telatbln:=90;
end;
a:=LeftStr(DateToStr(DateTimePicker1.Date),3); //tgl date 1
b:=MidStr(DateToStr(DateTimePicker2.Date),4,3); //bulan date 2
c:=RightStr(DateToStr(DateTimePicker2.Date),4); //tahun date 2
d:=a+b+c;
x:=VarToStr(ceil(StrToDate(d) - DateTimePicker1.Date));
f:=x;
e:=VarToStr(ceil(DateTimePicker2.Date-DateTimePicker1.Date));
edttelat.Text:=IntToStr((StrToInt(e)-StrToInt(f)+telatbln));
end;
</div>
nah sekarang ane sudah berhasil untuk membuat form transaksinya..
dan skarang lagi buat form pembayaran kredit/B]
disini ada permasalah tentang menentukan [B]berapa hari keterlabatan
misal : tgl_trans = 4 januari 2011
terus semestinya kan dia bayar kredit pertama tgl 4 februari 2011...
klo dia bayar tgl 10 februari kan bisa dengan pemisahan dd/mm/yyyy ..
tapi klo dia transaksi tgl 29 januari 2011 dan bayar 4 maret 2011 ...
gimana jadi solusinya dengan menggunakan borland delphi..
mohon bantuannya, baik berupa logika nya , sukur2 ada contoh nya..
nih yg udah coba saya buat..
PHP Code:
procedure TF_Kredit.btncektelatClick(Sender: TObject);
var
telatbln,telattahun:integer;
bulantrans,bulanbayar,tahun1,tahun2:string;
a,b,c,d,e,f,x:string;
begin
bulantrans:=MidStr(DateToStr(DateTimePicker1.Date) ,4,2);
if LeftStr(bulantrans,1)='0' then
begin
bulantrans:=RightStr(bulantrans,1);
ShowMessage(bulantrans);
end
else
begin
ShowMessage(bulantrans);
end;
tahun1:=RightStr(DateToStr(DateTimePicker1.date),4 );
tahun2:=RightStr(DateToStr(DateTimePicker2.date),4 );
bulanbayar:=MidStr(DateToStr(DateTimePicker2.Date) ,4,2);
if LeftStr(bulanbayar,1)='0' then
begin
bulanbayar:=RightStr(bulanbayar,1);
ShowMessage(bulanbayar);
end
else
begin
ShowMessage(bulanbayar);
end;
telatbln:=0;
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=0 then
begin
telatbln:=-30;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=1 then
begin
telatbln:=0;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=2 then
begin
telatbln:=30;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=3 then
begin
telatbln:=60;
end
else
if (StrToInt(bulanbayar)-StrToInt(bulantrans))=4 then
begin
telatbln:=90;
end;
a:=LeftStr(DateToStr(DateTimePicker1.Date),3); //tgl date 1
b:=MidStr(DateToStr(DateTimePicker2.Date),4,3); //bulan date 2
c:=RightStr(DateToStr(DateTimePicker2.Date),4); //tahun date 2
d:=a+b+c;
x:=VarToStr(ceil(StrToDate(d) - DateTimePicker1.Date));
f:=x;
e:=VarToStr(ceil(DateTimePicker2.Date-DateTimePicker1.Date));
edttelat.Text:=IntToStr((StrToInt(e)-StrToInt(f)+telatbln));
end;
</div>