Esempio n. 1
0
 /**
  * Determine whether loan is due for recovery.
  * 
  * @param \LoanApplications $loan Loan application
  * @param date $dateDue Loan repayment date
  * @return boolean TRUE - $loan is due. FALSE - $loan is not due.
  */
 public function loanIsDue($loan, $dateDue)
 {
     $effectiveRepaymentDate = $this->dayBefore($this->repaymentDate($loan->borrowingDate($loan), $this->recoverLoanAfterLoanRepaymentPeriod() == true ? $loan->repayment_period : $loan->max_repayment_period));
     if ($effectiveRepaymentDate < $dateDue && $dateDue <= date('Y') . '-' . date('m') . '-' . date('d')) {
         return true;
     }
 }
Esempio n. 2
0
 /**
  * If loan repayment date exceeds repayment date due,
  * then we adopt the repayment date as the date due.
  * 
  * @param \LoanRepayments $repayment Loan repayment
  * @param \LoanApplications $loanApplicationDue Loan application
  * @return date Date up to which to execute loan recovery.
  */
 public function repaymentDate($repayment, $loanApplicationDue)
 {
     $repaymentDate = LoanApplications::model()->repaymentDate($loanApplicationDue->borrowingDate($loanApplicationDue), LoanApplications::model()->recoverLoanAfterLoanRepaymentPeriod() == true ? $loanApplicationDue->repayment_period : $loanApplicationDue->max_repayment_period);
     return $repayment->recoverydate > $repaymentDate ? $repayment->recoverydate : $repaymentDate;
 }