Beispiel #1
0
 /**
  * Analyze parameters that define applied loan
  * 
  * @param type $attribute
  */
 public function respectiveLoanParameters($attribute)
 {
     $this->net_pay_after_loan_repayment = null;
     $loan = Loans::model()->defaultLoanParameters($this->{$attribute});
     if ($this->repayment_period > $loan->repayment_period) {
         $this->addError('repayment_period', $this->getAttributeLabel('repayment_period') . " must not exceed {$loan->repayment_period}");
     }
     if ($this->closed != 'Yes') {
         $this->interest_rate = $loan->interest_rate;
         $this->max_repayment_period = $loan->repayment_period;
     }
     $totalContributions = ContributionsByMembers::model()->netTotalMemberContribution($this->member, $this->borrowingDate($this));
     $available = Loans::model()->availableLoan($loan, $totalContributions);
     if ($this->amout_borrowed > $available) {
         $this->addError('amout_borrowed', "Your available loan amount is KShs. {$available}");
     } else {
         if (!empty($this->amout_borrowed)) {
             if (empty($this->present_net_pay)) {
                 $this->addError('amout_borrowed', $this->getAttributeLabel('present_net_pay') . " is required");
             } else {
                 if (empty($this->repayment_period)) {
                     $this->addError('amout_borrowed', $this->getAttributeLabel('repayment_period') . " is required");
                 } else {
                     $amount = LoanRepayments::model()->amountDue($this->amout_borrowed, $this->interest_rate, $this->borrowingDate($this), $this->repaymentDate($this->borrowingDate($this), $this->repayment_period), 0);
                     $monthlyRepaymentAmount = round($amount / $this->repayment_period, 2);
                     if (Loans::model()->oneThirdRule($monthlyRepaymentAmount, $loan->one_third, $this->basic_pay) == true) {
                         $this->addError('amout_borrowed', $this->getAttributeLabel('amout_borrowed') . " exceeds the One-Third Rule requirement");
                     } else {
                         $this->net_pay_after_loan_repayment = $this->present_net_pay - $monthlyRepaymentAmount;
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
	//[Is this a proper request?] ------------------------------
	if(!isset($_REQUEST['ID'])){
		header("Location: member_browse.php");
		exit();
	}

    //[Get member] ------------------------------
    $id = $_REQUEST['ID'];
    $mem = new Members;
    $row = $mem->getByID($id);


	//[Get loan info] ------------------------------
    require('../classes/Loans.php');
    $loans = new Loans;
    $rsL = $loans->getCurrentLoansByMember($row);
	$rowcountL = mysql_num_rows($rsL);

	$rsLH = $loans->getPastLoansByMember($row);
	$rowcountLH = mysql_num_rows($rsLH);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ULMS Members : Search Results </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/styles.css" rel="stylesheet" type="text/css">
</head>

<body>
Beispiel #3
0
<?php

error_reporting(E_ALL);
ini_set('display_error', 1);
ini_set('memory_limit', '-1');
require_once '../common/config.inc';
require_once 'Loans.class.php';
date_default_timezone_set('UTC');
// create the database object
try {
    $database = new PDO("mysql:host={$db_host};dbname={$db_name}", $db_user, $db_password);
    $database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $statement = $database->prepare("TRUNCATE TABLE kiva_loans");
    $statement->execute();
    $statement = $database->prepare("SET CHARACTER SET 'utf8mb4'");
    $statement->execute();
} catch (PDOException $ex) {
    die("Error : " . $ex->getMessage());
}
$loans = new Loans();
$loans->initialize($database);
$loans->create();
Beispiel #4
0
<?php

$person = Person::model()->findByPk($loan->member);
$address = PersonAddress::model()->addressForPerson($person->primaryKey);
$loanType = Loans::model()->findByPk($loan->loan_type);
?>

<table>
    <tr>
        <td style="display:table-cell; text-align:justify; width:200px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">Member’s Full Names:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:300px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
echo strtoupper("{$person->first_name} {$person->middle_name} {$person->last_name}");
?>
            </font>
        </td>
    </tr>

    <tr>
        <td style="display:table-cell; text-align:justify; width:200px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">National Identity Card Number:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:300px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
echo $person->idno;
?>
            </font>
<?php

$member = Person::model()->findByPk($model->member);
$witness = Person::model()->findByPk($model->witness);
if ($model->loan_type == 4) {
    $guarantor1 = Person::model()->findByPk($model->guarantor1);
    $guarantor2 = Person::model()->findByPk($model->guarantor2);
}
$address = PersonAddress::model()->find('person_id=:id', array(':id' => $model->member));
$loan = Loans::model()->findByPk($model->loan_type);
$contributions = ContributionsByMembers::model()->netTotalMemberContribution($model->member, date('Y') . '-' . date('m') . '-' . date('d'));
?>
<div style="height: 400px; border-right: 3px solid #4f99c6">

    <?php 
if ($model->closed != 'Yes' && empty($model->close_date)) {
    ?>
        <div style="height: 20px; text-align: center">
            <b><?php 
    echo "{$member->last_name} {$member->first_name} {$member->middle_name}";
    ?>
</b>
        </div>

        <div style="height: 360px; overflow-y: scroll">

            <?php 
    $form = $this->beginWidget('CActiveForm', array('id' => 'loan-applications-form', 'enableAjaxValidation' => false));
    ?>

Beispiel #6
0
    echo $form->labelEx($model, 'repayment_period');
    ?>
</td>
        <td>&nbsp;</td>
        <td>
            <?php 
    if ($others['readOnly'] == true) {
        ?>
                <?php 
        echo $form->textField($model, 'repayment_period', array('value' => "{$model->repayment_period} Months", 'required' => true, 'style' => 'text-align:center', 'readonly' => $others['readOnly']));
        ?>
            <?php 
    } else {
        ?>
                <?php 
        $loan = Loans::model()->defaultLoanParameters($model->loan_type);
        for ($i = 1; $i <= $loan->repayment_period; $i++) {
            $months[$i]['id'] = $i;
            $months[$i]['val'] = "{$i} Months";
        }
        $months = CHtml::listData($months, 'id', 'val');
        echo $form->dropDownList($model, 'repayment_period', $months, array('prompt' => '-- Months --', 'required' => true, 'style' => 'text-align:center', 'readonly' => $others['readOnly']));
        ?>
            <?php 
    }
    ?>
        </td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
Beispiel #7
0
 /**
  * Retuen a required loan type
  * 
  * @param int $pk
  * @return \Loans
  */
 public function returnARequiredLoan($pk)
 {
     return Loans::model()->findByPk($pk);
 }
Beispiel #8
0
<?php

$lastDate = $endDate;
$loanType = Loans::model()->findByPk($loanApplication->loan_type);
?>

<table>
    <tr>
        <td style="display:table-cell; text-align:justify; width:50px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">Name:</font>
        </td>
        <td style="display:table-cell; text-align:justify; width:450px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
echo strtoupper("{$person->first_name} {$person->middle_name} {$person->last_name}");
?>
            </font>
        </td>
    </tr>

    <tr>
        <td style="display:table-cell; text-align:justify; width:100px; height: 12px">
            <font style="font-family: sans-serif; font-weight: bold" size="11">National ID. No.: </font>
        </td>
        <td style="display:table-cell; text-align:justify; width:80px; height: 12px">
            <font style="font-family: sans-serif; font-weight: normal" size="11">
            <?php 
echo $person->idno;
?>
            </font>
        </td>
Beispiel #9
0
                        <td style="text-align: center">Loan</td>
                        <td style="text-align: center">Date</td>
                        <td style="text-align: center">Balance</td>
                        <td style="text-align: center">Repayment</td>
                    </tr>
                    <?php 
foreach ($loansMemberIsServicing as $loanApplicationId => $loanMemberIsServicing) {
    ?>
                        <?php 
    if (get_class($loanMemberIsServicing) == 'LoanRepayments') {
        $model = $loanMemberIsServicing;
        $loanMemberIsServicing = LoanApplications::model()->findByPk($loanApplicationId);
    }
    ?>
                        <?php 
    $loan = Loans::model()->findByPk($loanMemberIsServicing->loan_type);
    ?>
                        <?php 
    $amountDue = LoanApplications::model()->computeTotals(array($loanMemberIsServicing), $date);
    ?>
                        <tr>
                            <td><?php 
    echo $loan->loan_type;
    ?>
</td>
                            <td style="text-align: center"><?php 
    echo $loanMemberIsServicing->close_date;
    ?>
</td>
                            <td style="text-align: center"><?php 
    echo $form->textField($model, "[{$loanMemberIsServicing->primaryKey}]balance", array('size' => 8, 'value' => $amountDue, 'readonly' => true, 'style' => 'text-align: center'));