<?php $id = Yii::app()->user->id; ?> <?php $true = false; foreach (ContributionTypes::model()->findAll('id>1') as $type) { if ($type->primaryKey == 4) { $true = $true || LoanApplications::model()->memberHasALoan($id); } else { $true = $true || ContributionsByMembers::model()->memberHasAContribution($id, $type->primaryKey); } } ?> <?php if ($true) { ?> <li class="<?php echo isset($_REQUEST['active']) && $_REQUEST['active'] == 'papulo' ? 'active' : ''; ?> "> <a <?php if (isset($_REQUEST['active']) && $_REQUEST['active'] == 'papulo') { ?> <?php } else { ?>
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'contributions-by-members-form', 'enableAjaxValidation' => true)); $types = ContributionTypes::model()->findAll('id>1'); ?> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title">Statements of Accounts</h3></div> <div class="panel-body"> <div class="col-md-8 col-sm-12" style="width: 100%"> <div style="width: 100%"> <div style="width: 30%; float: left"> <table> <?php foreach ($types as $type) { ?> <?php if ($type->primaryKey != 4 && ContributionsByMembers::model()->memberHasAContribution($user->id, $type->primaryKey) || $type->primaryKey == 4 && LoanApplications::model()->memberHasALoan($user->id)) { ?> <tr> <td> <?php if ($type->primaryKey != 4) { ?> <a class="btn btn-sm btn-primary" href="<?php echo $this->createUrl('whichStatement', array('id' => $user->id, 'type' => $type->primaryKey)); ?> " target="_blank"><i class="icon-ok bigger-110"></i><?php echo Lang::t($type->contribution_type);
</tr> <tr> <td style="display:table-cell; text-align:center; width:300px; height: 12px; border: 2px solid #000000"> <font style="font-family: sans-serif; font-weight: bold; line-height: 1" size="11">DESCRIPTION</font> </td> <td style="display:table-cell; text-align:center; width:200px; height: 12px; border: 2px solid #000000"> <font style="font-family: sans-serif; font-weight: bold; line-height: 1" size="11">AMOUNT, KShs.</font> </td> </tr> <?php foreach ($contributions as $contribution) { ?> <?php $contributionType = ContributionTypes::model()->findByPk($contribution->contribution_type); ?> <tr> <td style="display:table-cell; text-align:justify; width:300px; height: 12px; border-left: 2px solid #000000; border-right: 1px solid #000000"> <font style="font-family: sans-serif; font-weight: normal; line-height: 1" size="10"> <?php echo $contributionType->contribution_type; ?> </font> </td> <td style="display:table-cell; text-align:center; width:200px; height: 12px; border-left: 1px solid #000000; border-right: 2px solid #000000"> <font style="font-family: sans-serif; font-weight: normal; line-height: 1" size="10"> <?php echo $contribution->amount; ?> </font>
<td><?php echo $form->error($model, 'member'); ?> </td> </tr> <tr><td> </td></tr> <tr> <td><?php echo $form->labelEx($model, 'contribution_type'); ?> </td> <td> </td> <td> <?php echo $form->dropDownList($model, 'contribution_type', CHtml::listData(ContributionTypes::model()->findAllByPk($model->contribution_type), 'id', 'contribution_type'), array('prompt' => $model->getAttributeLabel('contribution_type'), 'required' => true, 'style' => 'text-align:center', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('loanApplications/loansMemberIsServicing', array('date' => $model->date)), 'update' => '#loanBalances'))); ?> </td> <td><?php echo $form->error($model, 'contribution_type'); ?> </td> </tr> <tr><td> </td></tr> <tr> <td colspan="4" id="loanBalances"> <?php if ($model->contribution_type == 4) { $this->renderPartial('application.views.loanApplications.servicingLoans', array('model' => $others['loanRepayment'], 'loansMemberIsServicing' => $others['loansMemberIsServicing'], 'date' => $model->date)); } else {
/** * Determine which types of contributions a member can make * * @param int $member person id * @return \ContributionTypes models */ public function contributionType($member) { $cri = new CDbCriteria(); if ($this->registrationFees($member) < RegistrationAndMonthlyContributionAmounts::model()->amount(1)) { $cri->condition = 'id=1'; } else { $cri->condition = 'id>1'; } $cri->order = 'contribution_type ASC'; return ContributionTypes::model()->findAll($cri); }
/** * dropDownList for contribution */ public function actionContributionType() { $data = ContributionsByMembers::model()->contributionType($_POST['ContributionsByMembers']['member']); $data = CHtml::listData($data, 'id', 'contribution_type'); $prompt = ContributionTypes::model()->getAttributeLabel('contribution_type'); echo "<option value=''>-- {$prompt} --</option>"; foreach ($data as $value => $type) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($type), true); } }