江湖告急:请救民于水火(100分)

  • 主题发起人 Delphi刘
  • 开始时间
序号 时间 优惠价额 汇入金额 期限(天) 利息
1 2003-1-1 8000 5000 30
2 2003-1-5 3000 2000 30
这时应该还欠1000元吧,如果2003-2-6他又买了3000的东东,不过没有给钱!!
序号 时间 优惠价额 汇入金额 期限(天) 利息
1 2003-1-1 8000 5000 30
2 2003-1-5 3000 2000 30
3 2003-2-6 3000 0 30
一个月之后还了3000元
序号 时间 优惠价额 汇入金额 期限(天) 利息
1 2003-1-1 8000 5000 30
2 2003-1-5 3000 2000 30
3 2003-2-6 3000 0 30
4 2003-3-6 0 3000

明白了吗??
我把我的源码贴上来,你看看
procedure TForm_Main.SB_Calculate_InterestClick(Sender: TObject);
var
I:integer;
G_qixian,Sum_G_qixian:integer;
Interest:real;
FirstDate:TDate;
Rec:Integer;
Cal_Interest,Cal_Int2:array of TCalculate;
payoff,payoff1:Real;
place,hr_Place,yh_Place:Integer;
hr_No:integer;
begin
with DM.Table_Basicdo
begin
First;
while not Eofdo
begin
with DM.Table_Interestdo
begin
Active:=True;
Rec:=RecordCount;
SetLength(Cal_Interest,Rec);
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=0;
Cal_Interest.yh_Price:=0;
Cal_Interest.hr_Money:=0;
end;
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=FieldByName('Date_Time').AsDateTime;
Cal_Interest.yh_Price:=FieldByName('Optimal_Price').AsCurrency;
Cal_Interest.hr_Money:=FieldByName('Remittance').AsCurrency;
Next;
end;


//--------------------------------------------------------
//Calculate Interest
//--------------------------------------------------------
case Rec of
//---------------------------------------------------------
//if only have one record
//---------------------------------------------------------
1:
begin
Interest:=0;
payoff:=Cal_Interest[0].yh_Price-Cal_Interest[0].hr_Money;
G_qixian:=Trunc(Date-Cal_Interest[0].DateTime)-30;
if G_qixian>0 then
begin
Interest:=Interest+payoff*G_qixian*0.01/30;
end
else
Interest:=Interest+0;
if Interest<0 then
Interest:=0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
end;

//-----------------------------------------------
//if there are two records
//-----------------------------------------------
2:
begin
First;
Interest:=0;
payoff:=Cal_Interest[0].yh_Price-Cal_Interest[0].hr_Money;
if Cal_Interest[1].hr_Money>0 then
//if have remittance
begin
G_qixian:=Trunc(Cal_Interest[1].DateTime-Cal_Interest[0].DateTime)-30;
if G_qixian>0 then
//if the second remittance excess 30 days
begin
Interest:=Interest+payoff*G_qixian*0.01/30;
payoff:=payoff-Cal_Interest[1].hr_Money;
if payoff>0 then
//if not pay off
begin
G_qixian:=Trunc(Date-Cal_Interest[1].DateTime);
Interest:=Interest+payoff*G_qixian*0.01/30;
payoff1:=-1;
end;
if payoff=0 then
begin
G_qixian:=Trunc(Cal_Interest[1].DateTime-Cal_Interest[0].DateTime);
Interest:=Interest+payoff*G_qixian*0.01/30;
payoff1:=-1;
end;
if payoff<0 then
begin
payoff1:=payoff;
end;
end
else
//if the second remittance havn't excess 30 days
begin
payoff:=payoff-Cal_Interest[1].hr_Money;
if payoff>0 then
//if not pay off
begin
G_qixian:=Trunc(Date-Cal_Interest[0].DateTime)-30;
if G_qixian>0 then
Interest:=Interest+payoff*G_qixian*0.01/30
else
Interest:=0;
payoff1:=0;
end;
if payoff=0 then
begin
G_qixian:=Trunc(Date-Cal_Interest[0].DateTime)-30;
if G_qixian>0 then
Interest:=Interest+payoff*G_qixian*0.01/30
else
Interest:=0;
payoff1:=0;
end;
if payoff<0 then
begin
payoff1:=payoff;
end;
end;
//end else
G_qixian<30
end
else
//if have no hr_Money
begin
G_qixian:=Trunc(Date-Cal_Interest[0].DateTime)-30;
if G_qixian>0 then
Interest:=payoff*G_qixian*0.01/30
else
Interest:=0;
end;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
begin
if (Cal_Interest[1].yh_Price>0) then
begin
G_qixian:=Trunc(Date-Cal_Interest[1].DateTime)-30;
if G_qixian>0 then
begin
if (payoff1<0) then
payoff:=Cal_Interest[1].yh_Price+payoff1
else
payoff:=Cal_Interest[1].yh_Price;
Interest:=payoff*G_qixian*0.01/30;
end
else
Interest:=0;
end
else
Interest:=0;
end;
if Interest<0 then
Interest:=0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
end;
//end case 2
end;
//end case
//----------------------------------------------------
//if there are three records
//----------------------------------------------------
if rec>2 then
begin
First;
FirstDate:=Cal_Interest[0].DateTime;
place:=0;
hr_No:=0;
For I:=1 to Rec-1do
begin
if Cal_Interest.hr_Money>0 then
hr_No:=hr_No+1;
end;
SetLength(Cal_Int2,hr_No);
For I:=1 to Rec-1do
begin
if Cal_Interest.hr_Money>0 then
begin
Cal_Int2[place].DateTime:=Cal_Interest.DateTime;
Cal_Int2[place].yh_Price:=Cal_Interest.yh_Price;
Cal_Int2[place].hr_Money:=Cal_Interest.hr_Money;
place:=Place+1;
end;
end;


//--------------------------------------------------------------------
//Calculate the first record's Interest
//Cyc to find the pay off place then
save the place and payoff value
//to Calculate the second record:
// 1: payoff > 0 not pay off
// 2: payoff = 0 just pay off
// 3: payoff < 0 pay more
//---------------------------------------------------------------------
hr_Place:=0;
yh_Place:=0;
G_qixian:=0;
Sum_G_qixian:=0;
Interest:=0;
payoff:=Cal_Interest[yh_Place].yh_Price-Cal_Interest[hr_Place].hr_Money;
if payoff<=0 then
Interest:=0;
while not eofdo
begin

while (payoff>0) and (hr_Place<place)do
begin
if Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)<=0 then
G_qixian:=Trunc(Cal_Interest[yh_Place+1].DateTime-FirstDate)-30-Sum_G_qixian
else
G_qixian:=Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)-30-Sum_G_qixian;
if G_qixian>0 then
begin
Sum_G_qixian:=Sum_G_qixian+G_qixian;
Interest:=Interest+payoff*G_qixian*0.01/30;
end
else
begin
Interest:=0;
G_qixian:=0;
Sum_G_qixian:=0;
end;
if Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)<=0 then
payoff:=payoff
else
payoff:=payoff-Cal_Int2[hr_Place].hr_Money;
hr_Place:=hr_Place+1;
if Interest<0 then
Interest:=0;
end;
//end if while payoff>0
//1: haven't pay off
if payoff>0 then
begin
if Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)<=0 then
G_qixian:=Trunc(Date-Cal_Interest[yh_Place+1].DateTime)
else
G_qixian:=Trunc(Date-Cal_Int2[hr_Place-1].DateTime);
if G_qixian>0 then
begin
Interest:=Interest+payoff*G_qixian*0.01/30;
end
else
begin
Interest:=Interest+0;
end;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;

while yh_Place<Rec-1do
begin
Next;
yh_Place:=yh_Place+1;
payoff:=Cal_Interest[yh_Place].yh_Price;
G_qixian:=Trunc(Date-Cal_Interest[yh_Place].DateTime)-30;
if G_qixian>0 then
Interest:=Payoff*G_qixian*0.01/30
else
Interest:=0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
end;

end;
//end if payoff>0
//-----------------------------------------------------
//2:payoff=0 first write the Interest to the Datebase
//There are two condition:
// (1): hr_place>place (2)hr_Place<place
//------------------------------------------------------
if payoff=0 then
begin
Interest:=Interest+0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
//----------------------------------------------------
//(1):hr_Place>=place
//The Last Remittance just pay off the First yh_Price
//----------------------------------------------------
if hr_Place>=Place then
begin

while yh_Place<Rec-1do
begin

yh_Place:=yh_Place+1;
payoff:=Cal_Interest[yh_Place].yh_Price;
G_qixian:=Trunc(Date-Cal_Interest[yh_Place].DateTime)-30;
if G_qixian>0 then
Interest:=Payoff*G_qixian*0.01/30
else
Interest:=0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
end;
//end while yh_Place<Rec-1
end;
//end if hr_Place>=Place
//-----------------------------------------------------------------------
//(1):hr_Place<place
//The hr_Place Remittance just pay off the First yh_Price
//must save the hr_place and payoff information then
handle the next record
//-----------------------------------------------------------------------
if hr_Place<Place then
begin
yh_Place:=yh_Place+1;
FirstDate:=Cal_Interest[yh_Place].DateTime;
G_qixian:=0;
Sum_G_qixian:=0;
Interest:=0;
payoff:=Cal_Interest[yh_Place].yh_Price;
//if the next hr_Money excess 30 days
G_qixian:=Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)-30-Sum_G_qixian;
if G_qixian>0 then
begin
Sum_G_qixian:=Sum_G_qixian+G_qixian;
Interest:=Interest+payoff*G_qixian*0.01/30;
end
else
begin
Interest:=0;
G_qixian:=0;
Sum_G_qixian:=0;
end;
payoff:=payoff-Cal_Int2[hr_Place].hr_Money;
if payoff<=0 then
begin
Interest:=Interest+0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
end;
if payoff>0 then
Next;
end;
//end if hr_Place<Place
end;
//end if payoff=0
//-------------------------------
//if pay more and hr_place<Place
//-------------------------------
if payoff<0 then
begin
Interest:=Interest+0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
yh_Place:=yh_Place+1;
FirstDate:=Cal_Interest[yh_Place].DateTime;
G_qixian:=0;
Sum_G_qixian:=0;
Interest:=0;
payoff:=payoff+Cal_Interest[yh_Place].yh_Price;
if Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)<=0 then
G_qixian:=Trunc(Cal_Interest[yh_Place+1].DateTime-FirstDate)-30-Sum_G_qixian
else
G_qixian:=Trunc(Cal_Int2[hr_Place].DateTime-FirstDate)-30-Sum_G_qixian;
if G_qixian>0 then
begin
Sum_G_qixian:=Sum_G_qixian+G_qixian;
Interest:=Interest+payoff*G_qixian*0.01/30;
end
else
begin
Interest:=0;
G_qixian:=0;
Sum_G_qixian:=0;
end;
payoff:=payoff-Cal_Int2[hr_Place].hr_Money;
if payoff<=0 then
begin
Interest:=Interest+0;
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
end;
if payoff>0 then
Next;
end;
//end payoff<0
end;
//end while not eof
end;
//end if rec>2



end;
//end with Table_Interest
Next;
end;
// end while Table_Basic
end;
//end with Table_Basic
end;
 
我更糊涂了,请你仔细看我提出的问题,我先问个简单的问题吧
第二条记录中的 3000 是用户又买了东西所值的钱 ,还是第一笔生意中用户还欠的钱??、
 
第二条记录中的 3000 是用户又买了东西所值的钱,欠的钱是去算的不是通过这个记录表现
出来的。这个记录知识忠实的记录跟某个公司发生的一些业务。什么时候买了什么东西,付
了多少钱。明白了吗????
 
唉,那你举的例子也太极端了吧,每一次买 的东西正好是上次还欠的钱!!!!
这样我再想想
你的算法太复杂了,比较敬佩你的抽象能力,不过我想你的思路可能不对,我再想想
 
问题不是很复杂,实际上就是两个队列,一个是 时间、优惠价格,另一个是时间、汇款;
对吧?
按你的思想我们建一个足够大的数组,每个数组元素存放三个域的内容,
再建立两个记录指针 ,一个是价格指针 用price ,一个是汇款指针 paymoney ,
类型都是integer,用来指定在数组中的位置。再指定一个余款容器 leftmoney ,一般
情况下就是0,如果汇款还了一次欠款后还能再还第二笔欠款时,
leftmoney=还清上一笔钱后还剩的钱

号 时间 优惠价额 汇入金额
1 2003-1-1 8000 5000 <-- price 指针
2 2003-1-5 3000 2000
3 2003-2-6 1000 2000 <---paymoney指针
4 2003-3-9 3000 4000
5 2003-4-6 2000
第一笔价格: 2003-1-1 8000 price=0
第一笔还款: 2003-1-1 5000 paymoney=0 leftmoney=0
第二笔还款: 2003-1-5 2000 paymoney=1 leftmoney=0
第三笔还款: 2003-2-6 2000 paymoney=2 leftmoney=1000 ****
//价格指针下移
第二笔价格: 2003-1-5 3000 price=1
//汇款指针从当前位置开始 ,如果leftmoney=0 说明上次正好还清,paymoney++,
否则计算完leftmoney再paymoney++
第三笔还款: 2003-2-6 2000 paymoney=2 leftmoney=1000 ****
第四笔还款: 2003-3-9 4000 paymoney=3 leftmoney=2000 *****
第三笔价格:.....
你先看看我的思路,我把程序写一下。

 
//没有调试,有语法错误改改吧
procedure TfrmCreateRela.Button1Click(Sender: TObject);
var usemoney:Currency;
newCalDate:Tdate;
begin

....如你所写,此部分略
SetLength(Cal_Interest,Rec);
{ For I:=0 to 0do
begin
Cal_Interest.DateTime:=0;
Cal_Interest.yh_Price:=0;
Cal_Interest.hr_Money:=0;
end;
}
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=FieldByName('Date_Time').AsDateTime;
Cal_Interest.yh_Price:=FieldByName('Optimal_Price').AsCurrency;
Cal_Interest.hr_Money:=FieldByName('Remittance').AsCurrency;
Next;
end;
price:=0;
paymoney:=0;
LeftMoney:=0;
payoff:=Cal_Interset[0].yh_Price;
NewCalDate:=Cal_InterSet[0].DateTime+30;
interest:=0;
while (price<=Rec) and(paymoney<=Rec)do
begin
if Cal_Interset[paymoney].hr_Money=0 then
begin
paymoney:=paymoney+1;
Continue;
end;
if Cal_Interset[price].yh_Price=0 then
begin
Price:=Price+1;
payoff:=Cal_Interset[price].yh_Price;
NewCalDate:=Cal_InterSet[price].DateTime+30;
Continue;
end;

if leftMoney=0 then
//上笔还款没有剩余
usemoney:=Cal_Interest.hr_Money
else
usemoney:=leftmoney;
if Cal_InterSet[paymoney].datatime>NewCaldate
begin
interest:=interest+payoff*(Cal_InterSet[paymoney].DateTime-NewCalDate)*0.01/30;
NewcalDate:=Trunc(Cal_InterSet[paymoney].datatime);
end;
payoff:=payoff-Cal_InterSet[paymoney].hr_Money;
if payoff<=0 then
//还清了
begin
leftMoney:=-payoff;
if leftmoney=0 then
paymoney:=paymoney+1;
Price:=Price+1;
payoff:=Cal_Interset[price].yh_Price;
NewCalDate:=Trunc(Cal_InterSet[price].DateTime+30);
// 将interest 回填数据库 , 代码略。
interest:=0;
end
else
paymoney:=paymoney+1;
end;
while price<=Recdo
//汇款用完了,但还有欠款,没有全还清
begin
if Cal_Interset[price].yh_Price=0 then
begin
Price:=Price+1;
payoff:=Cal_Interset[price].yh_Price;
NewCalDate:=Cal_InterSet[price].DateTime+30;
Continue;
end;

if Date>NewCalDate then
//注意和第一次循环中算了一半的连接
interest:=interest+Trunc(Date-NewCalDate)*payoff*0.01/30;
// 将interest 回填数据库 , 代码略。
Price:=Price+1;
payoff:=Cal_Interset[price].yh_Price;
NewCalDate:=Cal_InterSet[price].DateTime+30;
interest:=0;
end;
end;

应该就是你想要的了,算出结果后回填的部分都没有写,因为我不清楚你的数组和表的联系。
什么地方不对,说,我再想。
 
问题一:没有他还多了的处理机制
问题二:数组有时越界
问题三:优惠价额为0的计不到利息并且写不到数据库里去
if leftMoney=0 then
//上笔还款没有剩余
usemoney:=Cal_Interest.hr_Money
else
usemoney:=leftmoney;
 
问题一:
  你不是只算利息吗,如果他还多了,需要做什么处理吗,你没有说这种要求啊。
问题二:
   我想错了一个地方,所有的while 循环中的 <= 都改成 < (共三个)。
问题三:
优惠价格为0的记录,不是还款吗?他本身就不是一笔生意, 哪会有利息呢? 你可以把这些记录都 UPDATE
成0就行了吧。
  你贴出的那段我的代码有什么问题吗??


 
如果他还多了,就要把还多的算到下一笔记录去,如果是最后一笔记录就不要管它
我把你的程序改成这样子了,还是有些问题
我贴出的那段代码没作用,用一些极端的数据去测试算不准
procedure TForm_Main.SB_Calculate_InterestClick(Sender: TObject);
var
I:integer;
//Cyc variant
Interest:real;
//the variant of Interest
Rec:Integer;
//RecordCount
Cal_Interest:array of TCalculate;
//all record
payoff:Real;
leftmoney:Currency;
newCalDate:Tdate;
//the Date that Calculte the Interest
price,paymoney:Integer;
//price,paymoney:the number of yh_Price,hr_Money
begin

with DM.Table_Interestdo
begin
Active:=True;
Rec:=RecordCount;
SetLength(Cal_Interest,Rec);
//Initial the array
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=0;
Cal_Interest.yh_Price:=0;
Cal_Interest.hr_Money:=0;
end;

//assign the value
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=FieldByName('Date_Time').AsDateTime;
Cal_Interest.yh_Price:=FieldByName('Optimal_Price').AsCurrency;
Cal_Interest.hr_Money:=FieldByName('Remittance').AsCurrency;
Next;
end;

//Calculate the Interest
First;
price:=0;
paymoney:=0;
LeftMoney:=0;
payoff:=Cal_Interest[0].yh_Price;
NewCalDate:=Cal_Interest[0].DateTime+30;
interest:=0;
while (price<Rec) and(paymoney<Rec)do
begin
if Cal_Interest[paymoney].hr_Money=0 then
begin
paymoney:=paymoney+1;
Continue;
end;

if Cal_Interest[paymoney].DateTime>NewCaldate then
begin
interest:=interest+payoff*(Cal_Interest[paymoney].DateTime-NewCalDate)*0.01/30;
NewcalDate:=Trunc(Cal_Interest[paymoney].DateTime);
end;
if leftmoney>0 then
payoff:=payoff-leftmoney
else
payoff:=payoff-Cal_Interest[paymoney].hr_Money;
if payoff<=0 then
//if pay off or pay more
begin
leftMoney:=-payoff;
if leftmoney=0 then
paymoney:=paymoney+1;
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price;
NewCalDate:=Trunc(Cal_Interest[price].DateTime+30);
// save the Interest value to database
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
interest:=0;
end
else
paymoney:=paymoney+1;
end;
while price<Recdo
//if not pay off
begin

if Date>NewCalDate then
//注意和第一次循环中算了一半的连接
interest:=interest+Trunc(Date-NewCalDate)*payoff*0.01/30;
// save the Interest value to database
Edit;
FieldByName('Interest').AsCurrency:=Interest;
Post;
Next;
if payoff<=0 then
//if pay off or pay more
begin
leftMoney:=-payoff;
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price-leftMoney;
NewCalDate:=Trunc(Cal_Interest[price].DateTime+30);
end else
begin
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price;
NewCalDate:=Cal_Interest[price].DateTime+30;
interest:=0;
end;
end;

end;
//end with Table_Interest
end;
 
leftMoney我没有用上,是我写错了不好意思,
我没有用过currency ,理解错了,我又改了一下,这里面有个问题,就是实数比较时,等号不
准,所以要trunc 一下吧,我不知道你们的生意,毛、分是不是也要求那么精确??
procedure TForm_Main.SB_Calculate_InterestClick(Sender: TObject);
var
I:integer;
//Cyc variant
Interest:real;
//the variant of Interest
Rec:Integer;
//RecordCount
Cal_Interest:array of TCalculate;
//all record
payoff:Real;
leftmoney:real;
newCalDate:Tdate;
//the Date that Calculte the Interest
price,paymoney:Integer;
//price,paymoney:the number of yh_Price,hr_Money
begin

with DM.Table_Interestdo
begin
Active:=True;
Rec:=RecordCount;
SetLength(Cal_Interest,Rec);
//Initial the array
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=0;
Cal_Interest.yh_Price:=0;
Cal_Interest.hr_Money:=0;
end;

//assign the value
For I:=0 to Rec-1do
begin
Cal_Interest.DateTime:=FieldByName('Date_Time').AsDateTime;
Cal_Interest.yh_Price:=FieldByName('Optimal_Price').AsCurrency;
Cal_Interest.hr_Money:=FieldByName('Remittance').AsCurrency;
Next;
end;

//Calculate the Interest
First;
price:=0;
paymoney:=0;
LeftMoney:=0;
payoff:=Cal_Interest[0].yh_Price;
NewCalDate:=Trunc(Cal_Interest[0].DateTime+30);
interest:=0;
while (price<Rec) and(paymoney<Rec)do
begin
if Cal_Interest[paymoney].hr_Money=0 then
begin
paymoney:=paymoney+1;
Continue;
end;

if Trunc(Cal_Interest[paymoney].DateTime)>NewCaldate then
begin
interest:=interest+payoff*(Trunc(Cal_Interest[paymoney].DateTime)-NewCalDate)*0.01/30;
NewcalDate:=Trunc(Cal_Interest[paymoney].DateTime);
end;
if Trunc(leftmoney)>0 then
payoff:=payoff-leftmoney
else
payoff:=payoff-Cal_Interest[paymoney].hr_Money;
if Trunc(payoff)<=0 then
//if pay off or pay more
begin
leftMoney:=-payoff;
if trunc(leftmoney)=0 then
paymoney:=paymoney+1;
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price;
NewCalDate:=Trunc(Cal_Interest[price].DateTime+30);
// save the Interest value to database
Edit;
FieldByName('Interest').AsCurrency:=Interest;
//Post;
//这句话多余了,next 就会触发 Post;
Next;
interest:=0;
end
else
paymoney:=paymoney+1;
end;

while price<Recdo
//if not pay off
begin

if Date>NewCalDate then
//注意和第一次循环中算了一半的连接
interest:=interest+Trunc(Date-NewCalDate)*payoff*0.01/30;
// save the Interest value to database
Edit;
FieldByName('Interest').AsCurrency:=Interest;
//Post;
Next;
{ if Trunc(payoff)<=0 then
//if pay off or pay more
begin
leftMoney:=-payoff;
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price-leftMoney;
NewCalDate:=Trunc(Cal_Interest[price].DateTime+30);
end else
begin
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price;
NewCalDate:=Cal_Interest[price].DateTime+30;
interest:=0;
end;
}
//这些代码多余,进入这个循环的只有一种情况:
// 汇款已经用完了,但欠款还有,而且从当前 Price 所指的欠款一直到最后都
// 没有还清,而且肯定是还不清了。
Price:=Price+1;
payoff:=Cal_Interest[price].yh_Price;
NewCalDate:=Trunc(Cal_Interest[price].DateTime+30);
interest:=0;
end;

end;
//end with Table_Interest
end;
 
非常感谢您的热心帮助,可以告诉我你的联系方式吗?
 
qq=49148979
 
顶部