<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'expenditures-form', 'enableAjaxValidation' => true, 'action' => $this->createUrl('expenditures/whichJournal'), 'htmlOptions' => array('target' => '_blank'))); ?> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title">Payment Journals</h3></div> <div class="panel-body"> <div class="col-md-8 col-sm-12" style="width: 100%"> <table style="width: 100%"> <tr> <td><b>Journal :</b></td> <td><?php echo CHtml::dropDownList('type', $type, Voteheads::incomeOrExpenditure()); ?> </td> <td><b>Since :</b></td> <td> <?php echo CHtml::textField('since', $since, array('readonly' => true, 'style' => 'text-align: center')); $this->widget('application.extensions.calendar.SCalendar', array('inputField' => 'since', 'ifFormat' => '%Y-%m-%d')); ?> </td> <td><b>Till :</b></td> <td> <?php echo CHtml::textField('till', $till, array('readonly' => true, 'style' => 'text-align: center')); $this->widget('application.extensions.calendar.SCalendar', array('inputField' => 'till', 'ifFormat' => '%Y-%m-%d'));
<?php if (count($deleteVoteheads = Voteheads::model()->voteHeadsForType($field)) > 0) { ?> You may want to remove some vote heads: <div style="height: 120px; overflow-x: hidden"> <table style="width: 100%"> <tr><td colspan="3"> </td></tr> <?php $d = 0; foreach ($deleteVoteheads as $deleteVotehead) { if ($deleteVotehead->votehead != Expenditures::DEPOSIT_TO_BANK && $deleteVotehead->votehead != Incomes::WITHDRAWAL_FROM_BANK) { ?> <tr id="<?php echo "row{$deleteVotehead->primaryKey}"; ?> "> <?php $this->renderPartial('application.views.expenditures.deleteRow', array('deleteVotehead' => $deleteVotehead, 'field' => $field, 'd' => ++$d)); ?> </tr> <?php } } ?> </table> </div> <?php }
<?php $ajax = array('type' => 'POST', 'url' => CController::createUrl('voteheads/votehead', array('type' => $field)), 'update' => "#id{$field}"); if ($fieldType == Voteheads::SELECT && count($voteHeads = Voteheads::model()->voteHeadDropDowns($field)) > 1) { echo $form->dropDownList($model, 'votehead', $voteHeads, array('prompt' => '-- Select Item --', 'style' => 'text-align:center', 'ajax' => $ajax)); } else { $fieldType = Voteheads::TEXT; echo $form->textField($model, 'votehead', array('size' => 20, 'maxlength' => 30, 'placeholder' => Voteheads::NEW_VOTEHEAD, 'style' => 'text-align:center', 'ajax' => $ajax)); } echo CHtml::hiddenField($field, $fieldType);
/** * 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 Voteheads the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Voteheads::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }