Skipping records if the Balance is less than zero

asemberengasembereng Member Posts: 220
I have written some codes to process loan deductions every month but when the balance of a particular loan it should skip that record and process the others. Below is my code, can you help me identify what is wrong with it?
IF loan.FINDSET THEN BEGIN
 IF (loan.balance >0.00) THEN BEGIN
  REPEAT
    MESSAGE('%1',loan.balance);
      op_bal := loan.balance;
      MESSAGE('op %1',op_bal);
      cl_bal := loan.balance - loan.monthly_pay;
      paidoff := loan.loan_amount - cl_bal;
      loan.paidoffamount := paidoff;
      loan.MODIFY;
      loan.balance := cl_bal;
      loan.MODIFY;
    //insert into loan history table.
     // history.op_balance:= op_bal;
     // history.cl_balance:=cl_bal;
    //  history.ded_amount := loan.monthly_pay;
    //  history.int_amount := loan.monthly_int;
     // history.loan_id := loan.id;
     // history.MODIFY;
  UNTIL loan.NEXT = 0;
  END;
END;

//display result on a report
view.RUN;

Comments

Sign In or Register to comment.