home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / TP-LA1.LBR / LAINPUT.IQC / LAINPUT.INC
Text File  |  2000-06-30  |  7KB  |  193 lines

  1.  
  2. {LAINPUT.INC - Input procedures used in program LA.PAS.}
  3.  
  4. PROCEDURE Get_Principal;
  5.     Var
  6.         Principal_OK : Boolean;
  7.     Begin
  8.         Principal_OK := false;
  9.         Repeat
  10.             Show_Header;
  11.             GotoXY(01,Line_Number);
  12.             Write('Enter AMOUNT borrowed (enter 0 to exit)            : ');
  13.             Read(Principal);
  14.             If Principal = 0 then
  15.                 Halt
  16.             Else
  17.                 If Principal < 0 then
  18.                     Error_Msg('Principal','amount',Line_Number + 2)
  19.                 Else
  20.                     Principal_OK := true;
  21.         Until Principal_OK;
  22.     end; (* Get_Principal *)
  23.  
  24. PROCEDURE Get_Interest;
  25.     Var
  26.         Interest_OK : Boolean;
  27.     Begin
  28.         Interest_Ok := false;
  29.         Repeat
  30.             Show_Header;
  31.             GotoXY(01,Line_Number);
  32.             Write('Enter yearly INTEREST rate (i.e. 12 for 12%)       : ');
  33.             Read(Interest_Rate);
  34.             If Interest_Rate > 0 then
  35.                 If Interest_Rate < 100.001 then
  36.                     Interest_OK := true
  37.                 else
  38.                     Error_Msg('Interest','Interest rate',Line_Number + 2)
  39.             else
  40.                 Error_Msg('Interest','Interest rate',Line_Number +2);
  41.         Until Interest_OK;
  42.         Print_Interest := Interest_Rate;
  43.         Interest_Rate  := Interest_Rate / 100.00;
  44.     end; (* Get_Interest *)
  45.  
  46. PROCEDURE Get_Number_Of_Payments;
  47.     Var
  48.         Number_Payments_OK : Boolean;
  49.     Begin
  50.         Number_Payments_OK := false;
  51.         Repeat
  52.             Show_Header;
  53.             GotoXY(01,Line_Number);
  54.             Write('Enter total TERM of loan.                          : ');
  55.             Read(Number_Of_Payments);
  56.             If Number_Of_Payments < 1 then
  57.                 Error_Msg('Term','term',Line_Number + 2)
  58.             else
  59.                 Number_Payments_OK := true;
  60.         Until Number_Payments_OK;
  61.     end; (* Get_Number_Of_Payments *)
  62.  
  63. PROCEDURE Get_Loan_Date;
  64.     Var
  65.         Date_OK : Boolean;
  66.     Begin
  67.         Date_OK := false;
  68.         Repeat
  69.             Show_Header;
  70.             GotoXY(01,Line_Number);
  71.             Write('Enter DATE of first payment (MM/DD/YY)             : ');
  72.             Read(Date);
  73.             Date_Edit(Date, Result);
  74.             If Result = 0 then
  75.                 Date_OK := true;
  76.         Until Date_OK;
  77.         Print_Date := Date;
  78.     end; (* Get_Loan_Date *)
  79.  
  80. PROCEDURE Get_Tax;
  81.     Var
  82.         Taxes_OK : Boolean;
  83.     Begin
  84.         Taxes_OK := false;
  85.         Repeat
  86.             Show_Header;
  87.             GotoXY(01,Line_Number);
  88.             Write('Enter amount of NON EQUITY payment (Taxes, etc.)  : ');
  89.             Read(Property_Tax);
  90.             If Property_Tax < 0 then
  91.                 Error_Msg('NON EQUITY','non equity',Line_Number + 2)
  92.             Else
  93.                 Taxes_OK := true;
  94.         Until Taxes_OK;
  95.     end; (* Get_Tax *)
  96.  
  97. PROCEDURE Get_Extra;
  98.     Var
  99.         Extra_OK : Boolean;
  100.     Begin
  101.         Extra_OK := false;
  102.         Repeat
  103.             Show_Header;
  104.             GotoXY(01,Line_Number);
  105.             Write('Enter any extra amount you plan to pay             : ');
  106.             Read(Extra);
  107.             If Extra < 0 then
  108.                 Error_Msg('Extra payment','extra amount',Line_Number + 2)
  109.             Else
  110.                 Begin
  111.                     Extra_OK := true;
  112.                     If Extra = 0 then
  113.                         Start_Extra := 999
  114.                     Else
  115.                         Start_Extra := 1;
  116.                 end;
  117.         Until Extra_OK;
  118.     end; (* Get_Extra *)
  119.  
  120. PROCEDURE Get_Extra_Start;
  121.     Var
  122.         Start_Month, Start_Day, Start_Year  : Integer;
  123.         Date_OK                             : Boolean;
  124.     Begin
  125.         Date_OK  := false;
  126.         Start_Extra := 0;
  127.         Repeat
  128.             Show_Header;
  129.             GotoXY(01,Line_Number);
  130.             Write('Enter DATE you will begin paying extra (MM/DD/YY)  : ');
  131.             Read(Print_Date2);
  132.             Date_Edit(Print_Date2, Result);
  133.             If Result = 0 then
  134.                 Begin
  135.                     Date_Ok := true;
  136.                     DD := Copy(Print_Date2,1,2);
  137.                     Val(DD, Start_Month, Result);
  138.                     DD := Copy(Print_Date2,4,2);
  139.                     Val(DD, Start_Day, Result);
  140.                     DD := Copy(Print_Date2,7,8);
  141.                     Val(DD, Start_Year, Result);
  142.                     If Start_Year < 50 then
  143.                         Result := Start_Year + 100
  144.                     Else
  145.                         Result := Start_Year;
  146.                     Start_Extra := ((Result - Year) * 12) + Start_Month - Month + 1;
  147.                 end; (* Begin *)
  148.             If Start_Extra >= Number_Of_Payments then
  149.                 Begin
  150.                     Error_Msg('Start date of Extra payment','start date',Line_Number + 2);
  151.                     Date_OK := false;
  152.                 end; (* Begin *)
  153.         Until Date_OK;
  154.     end; (* Get_Extra_Start *)
  155.  
  156. PROCEDURE Get_Balloon_Date;
  157.     Var
  158.         Balloon_Month, Balloon_Day, Balloon_Year  : Integer;
  159.         Date_OK, Balloon_OK                       : Boolean;
  160.     Begin
  161.         Date_OK := false;
  162.         Balloon_OK := false;
  163.         Repeat
  164.             Show_Header;
  165.             GotoXY(01,Line_Number);
  166.             Write('Enter DATE the balloon payment is due (MM/DD/YY)   : ');
  167.             Read(Balloon_Date);
  168.             Date_Edit(Balloon_Date, Result);
  169.             If Result = 0 then
  170.                 Begin
  171.                     DD := Copy(Balloon_Date,1,2);
  172.                     Val(DD,Balloon_Month,Result);
  173.                     DD := Copy(Balloon_Date,4,2);
  174.                     Val(DD,Balloon_Day,Result);
  175.                     DD := Copy(Balloon_Date,7,2);
  176.                     Val(DD,Balloon_Year,Result);
  177.                     Date_OK := true;
  178.                     If Balloon_Year < 50 then
  179.                         Result := Balloon_Year + 100
  180.                     Else
  181.                         Result := Balloon_Year;
  182.                     Balloon_Number := ((Result - Year) * 12) + Balloon_Month - Month + 1;
  183.                     If Balloon_Number < Number_Of_Payments then
  184.                         Balloon_Ok := true
  185.                     Else
  186.                         If Balloon_Number = Number_Of_Payments then
  187.                             If Balloon_Day <= Day then
  188.                                 Balloon_OK := true;
  189.                     If NOT Balloon_OK then
  190.                         Error_Msg('Balloon date','balloon date',Line_Number + 2);
  191.                 end; (* Begin *)
  192.         Until Balloon_OK;
  193.     end; (* Get_Balloon_Date *)