예제 #1
0
파일: _form.php 프로젝트: wanyos2005/hsbf
                                </td>
                            </tr>

                            <tr><td>&nbsp;</td></tr>

                            <tr>
                                <td>
                                    <?php 
    echo $form->labelEx($model, 'effected_by_treasurer');
    echo CHtml::hiddenField('treasurer_date', $model->treasurer_date);
    echo CHtml::hiddenField('effected_by_treasurer', $model->effected_by_treasurer);
    ?>
                                </td>
                                <td>
                                    <?php 
    echo $officio != 'treasurer' || $model->effected_by_treasurer == CashWithdrawals::YES || $model->received_by_secretary != CashWithdrawals::YES || $model->approved_by_chairman != CashWithdrawals::YES || empty($model->secretary_date) || empty($model->chairman_date) ? true : false ? $form->textField($model, 'effected_by_treasurer', array('readonly' => true, 'style' => 'text-align:center')) : $form->dropDownList($model, 'effected_by_treasurer', CashWithdrawals::model()->approveOrOtherwise(), array('required' => true, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('cashWithdrawals/pesaDate'), 'update' => '#pesaDate')));
    ?>
                                </td>
                                <td id="pesaDate">
                                    <?php 
    if (!empty($model->treasurer_date)) {
        echo $form->textField($model, 'treasurer_date', array('readonly' => true, 'style' => 'text-align:center'));
    }
    ?>
                                </td>
                            </tr>

                            <tr><td>&nbsp;</td></tr>
                        <?php 
}
?>
예제 #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return CashWithdrawals the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = CashWithdrawals::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #3
0
}
?>


<?php 
$currentTreasurer = Maofficio::model()->returnCurrentPostHolder(3);
if (!empty($currentTreasurer) && $currentTreasurer->member == $id) {
    $model = CashWithdrawals::model()->find("effected_by_treasurer!='Yes' && received_by_secretary='Yes' && secretary_date IS NOT NULL && approved_by_chairman='Yes' && chairman_date IS NOT NULL");
} else {
    $currentSecretary = Maofficio::model()->returnCurrentPostHolder(2);
    if (!empty($currentSecretary) && $currentSecretary->member == $id) {
        $model = CashWithdrawals::model()->find("approved_by_chairman='Pending' && chairman_date IS NULL && effected_by_treasurer='Pending' && treasurer_date IS NULL");
    } else {
        $currentChairman = Maofficio::model()->returnCurrentPostHolder(1);
        if (!empty($currentChairman) && $currentChairman->member == $id) {
            $model = CashWithdrawals::model()->find("received_by_secretary='Yes' && secretary_date IS NOT NULL && effected_by_treasurer='Pending' && treasurer_date IS NULL");
        }
    }
}
if (!empty($model)) {
    ?>
    <li class="<?php 
    echo isset($_REQUEST['active']) && $_REQUEST['active'] == 'towachi' ? 'active' : '';
    ?>
">
        <a
        <?php 
    if (isset($_REQUEST['active']) && $_REQUEST['active'] == 'towachi') {
        ?>

                <?php 
예제 #4
0
 /**
  * 
  * @param id $pk
  * @return \CashWithdrawals
  */
 public function returnAWithdrawal($pk)
 {
     return CashWithdrawals::model()->findByPk($pk);
 }
 /**
  * 
  * @param \Savings $savingsModels models
  * @param \Savings $depositsAndReinvestments savings isolated into deposits or reinvestments
  * @param \Savings $notWithdrawns savings that have not been withdrawn to date
  * @param array $evaluationDates dates when amounts are required 
  * @return array
  */
 public function savingsTransactions($savingsModels, $depositsAndReinvestments, $notWithdrawns, $evaluationDates)
 {
     $transactions = array();
     foreach ($evaluationDates as $evaluationDate) {
         $notWithdrawnsByThisDate = $this->savingsNotWithdrawnbyThisDate($savingsModels, $evaluationDate);
         $depositsMadeOnThisDate = $this->depositsOnThisDate($depositsAndReinvestments[ContributionsByMembers::DEPOSIT], $evaluationDate);
         $withdrawalsOnThisDate = $this->withdrawalsOnThisDate($savingsModels, $evaluationDate);
         $balanceCarriedForward = Savings::model()->computeTotalForOpenInvestments($notWithdrawnsByThisDate, $evaluationDate);
         $totalPrincipals = Savings::model()->totalDeposits($notWithdrawnsByThisDate);
         $totalDeposits = Savings::model()->totalDeposits($depositsMadeOnThisDate);
         $totalToDeductFrom = $balanceCarriedForward + $totalDeposits;
         $interest = round(isset($previousBalanceCarriedForward) ? $balanceCarriedForward - $previousBalanceCarriedForward : $balanceCarriedForward - $totalPrincipals, 3);
         if (isset($previousDate) && substr($previousDate, 0, 4) != substr($evaluationDate, 0, 4)) {
             $transactions[$count = count($transactions)] = $this->buildRow(null, null, null, null, null, null, null, null);
             $style = true;
         }
         if ($balanceCarriedForward > 0) {
             $transactions[$count = count($transactions)] = $this->buildRow(null, null, $increasingAmount = $previousBalanceCarriedForward = $balanceCarriedForward, $interest, null, null, Savings::INSTEAD_OF_RECEIPT, $evaluationDate);
             if (isset($style)) {
                 $transactions[$count - 2][Savings::STYLE] = true;
                 unset($style);
             }
         }
         foreach ($depositsMadeOnThisDate as $depositMadeOnThisDate) {
             $contribution = ContributionsByMembers::model()->findByPk($depositMadeOnThisDate->savings_id);
             $transactions[$count = count($transactions)] = $this->buildRow($depositMadeOnThisDate->principal, $depositMadeOnThisDate->interest_rate_per_annum, $increasingAmount = isset($increasingAmount) ? $increasingAmount + $depositMadeOnThisDate->principal : $depositMadeOnThisDate->principal, null, null, null, $contribution->receiptno, $evaluationDate);
         }
         if (!empty($withdrawalsOnThisDate)) {
             foreach ($withdrawalsOnThisDate as $withdrawalOnThisDate) {
                 $cashWithdrawal = CashWithdrawals::model()->findByPk($withdrawalOnThisDate->amount_withdrawn);
                 $transactions[$count = count($transactions)] = $this->buildRow(null, null, null, null, $previousBalanceCarriedForward = $totalToDeductFrom = $totalToDeductFrom - ($amountWithdrawn = $withdrawalOnThisDate->accumulated_amount - $withdrawalOnThisDate->balance), $amountWithdrawn, $cashWithdrawal->cash_or_cheque, $evaluationDate);
             }
             $transactions[$count = count($transactions)] = $this->buildRow(null, null, $transactions[$count - 1][Loanrepayments::REDUCING_BALANCE], null, null, null, null, null);
         }
         $previousDate = $evaluationDate;
     }
     if (!empty($transactions)) {
         $transactions[$count][Savings::STYLE] = true;
     }
     return $transactions;
 }