Table of Content
HAL Forum
function boolean IsLeapYear (
integer Year)
Description:
Determines if the specified year has the extra day (29th) in February.
Parameters:
Year The year to check
procedure StraightDepr_Dayly(val svp,val dprprc,Integer deprrnd,Integer LifecycleYears,Integer LifecycleDays,Integer DeprCalc,Date sd,Date ed,Boolean yearprcf,var val res)
BEGIN
  LongInt nm;
  Integer sm,em;
  val nmv,ymv,t;

  nm = DateDiff(ed,sd)+1;      
  nmv = nm;
  res = svp;
  if (IsLeapYear(GetYear(ed))) then begin
    ymv = 366.00;
  end else begin
    ymv = 365.00;
  end;  
  if (LifecycleYears>0) and ((yearprcf==false) or (dprprc==0)) then begin
    t = LifecycleYears;
    res = res * (100/t);
    res = res/100;
    res = res / ymv;
    res = Round(res,SetRoundModeD(deprrnd));//per day , round , multiply per day, to get rid of round of problems
    res = res * nmv;
  end else begin
    res = res * dprprc;
    res = res/100;
    res = res / ymv;
    res = Round(res,SetRoundModeD(deprrnd));//per day , round , multiply per day, to get rid of round of problems
    res = res * nmv;
  end;
  RETURN;
END;
Related topics:
««