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
Wrap
Text File
|
2000-06-30
|
7KB
|
193 lines
{LAINPUT.INC - Input procedures used in program LA.PAS.}
PROCEDURE Get_Principal;
Var
Principal_OK : Boolean;
Begin
Principal_OK := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter AMOUNT borrowed (enter 0 to exit) : ');
Read(Principal);
If Principal = 0 then
Halt
Else
If Principal < 0 then
Error_Msg('Principal','amount',Line_Number + 2)
Else
Principal_OK := true;
Until Principal_OK;
end; (* Get_Principal *)
PROCEDURE Get_Interest;
Var
Interest_OK : Boolean;
Begin
Interest_Ok := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter yearly INTEREST rate (i.e. 12 for 12%) : ');
Read(Interest_Rate);
If Interest_Rate > 0 then
If Interest_Rate < 100.001 then
Interest_OK := true
else
Error_Msg('Interest','Interest rate',Line_Number + 2)
else
Error_Msg('Interest','Interest rate',Line_Number +2);
Until Interest_OK;
Print_Interest := Interest_Rate;
Interest_Rate := Interest_Rate / 100.00;
end; (* Get_Interest *)
PROCEDURE Get_Number_Of_Payments;
Var
Number_Payments_OK : Boolean;
Begin
Number_Payments_OK := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter total TERM of loan. : ');
Read(Number_Of_Payments);
If Number_Of_Payments < 1 then
Error_Msg('Term','term',Line_Number + 2)
else
Number_Payments_OK := true;
Until Number_Payments_OK;
end; (* Get_Number_Of_Payments *)
PROCEDURE Get_Loan_Date;
Var
Date_OK : Boolean;
Begin
Date_OK := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter DATE of first payment (MM/DD/YY) : ');
Read(Date);
Date_Edit(Date, Result);
If Result = 0 then
Date_OK := true;
Until Date_OK;
Print_Date := Date;
end; (* Get_Loan_Date *)
PROCEDURE Get_Tax;
Var
Taxes_OK : Boolean;
Begin
Taxes_OK := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter amount of NON EQUITY payment (Taxes, etc.) : ');
Read(Property_Tax);
If Property_Tax < 0 then
Error_Msg('NON EQUITY','non equity',Line_Number + 2)
Else
Taxes_OK := true;
Until Taxes_OK;
end; (* Get_Tax *)
PROCEDURE Get_Extra;
Var
Extra_OK : Boolean;
Begin
Extra_OK := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter any extra amount you plan to pay : ');
Read(Extra);
If Extra < 0 then
Error_Msg('Extra payment','extra amount',Line_Number + 2)
Else
Begin
Extra_OK := true;
If Extra = 0 then
Start_Extra := 999
Else
Start_Extra := 1;
end;
Until Extra_OK;
end; (* Get_Extra *)
PROCEDURE Get_Extra_Start;
Var
Start_Month, Start_Day, Start_Year : Integer;
Date_OK : Boolean;
Begin
Date_OK := false;
Start_Extra := 0;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter DATE you will begin paying extra (MM/DD/YY) : ');
Read(Print_Date2);
Date_Edit(Print_Date2, Result);
If Result = 0 then
Begin
Date_Ok := true;
DD := Copy(Print_Date2,1,2);
Val(DD, Start_Month, Result);
DD := Copy(Print_Date2,4,2);
Val(DD, Start_Day, Result);
DD := Copy(Print_Date2,7,8);
Val(DD, Start_Year, Result);
If Start_Year < 50 then
Result := Start_Year + 100
Else
Result := Start_Year;
Start_Extra := ((Result - Year) * 12) + Start_Month - Month + 1;
end; (* Begin *)
If Start_Extra >= Number_Of_Payments then
Begin
Error_Msg('Start date of Extra payment','start date',Line_Number + 2);
Date_OK := false;
end; (* Begin *)
Until Date_OK;
end; (* Get_Extra_Start *)
PROCEDURE Get_Balloon_Date;
Var
Balloon_Month, Balloon_Day, Balloon_Year : Integer;
Date_OK, Balloon_OK : Boolean;
Begin
Date_OK := false;
Balloon_OK := false;
Repeat
Show_Header;
GotoXY(01,Line_Number);
Write('Enter DATE the balloon payment is due (MM/DD/YY) : ');
Read(Balloon_Date);
Date_Edit(Balloon_Date, Result);
If Result = 0 then
Begin
DD := Copy(Balloon_Date,1,2);
Val(DD,Balloon_Month,Result);
DD := Copy(Balloon_Date,4,2);
Val(DD,Balloon_Day,Result);
DD := Copy(Balloon_Date,7,2);
Val(DD,Balloon_Year,Result);
Date_OK := true;
If Balloon_Year < 50 then
Result := Balloon_Year + 100
Else
Result := Balloon_Year;
Balloon_Number := ((Result - Year) * 12) + Balloon_Month - Month + 1;
If Balloon_Number < Number_Of_Payments then
Balloon_Ok := true
Else
If Balloon_Number = Number_Of_Payments then
If Balloon_Day <= Day then
Balloon_OK := true;
If NOT Balloon_OK then
Error_Msg('Balloon date','balloon date',Line_Number + 2);
end; (* Begin *)
Until Balloon_OK;
end; (* Get_Balloon_Date *)