public function actionTest() { $data = array(); $paid_amt = JaheratAvakTable::model()->findAll(array('condition' => 'bill_no_of_jaharat="' . $_REQUEST['JaheratAvakTable']['bill_no_of_jaharat'] . '"')); $data = Jaharat::model()->findByAttributes(array('jaharat_biil_no' => $_REQUEST['JaheratAvakTable']['bill_no_of_jaharat'])); $paid_amount = 0; if ($paid_amt) { foreach ($paid_amt as $p) { $paid_amount += $p['amount']; } } else { $paid_amount = 0; } if ($data) { $name = PartyMaster::model()->findByPk($data['party_no'])->party_name; $bill_date = $data->jaharat_bill_date; $net_amount = $data->jaharat_net_amount - $paid_amount; } else { $net_amount = ''; } if ($data['jaharat_net_amount'] == $paid_amount) { $net_amount = 'No Unpaid Amount'; } echo CJSON::encode(array('unpaid_amt' => $net_amount, 'paid_amt' => $paid_amount, 'bdate' => $bill_date, 'pname' => $data['party_no'] . " " . $name)); }
?> <span class="status"> </span> <?php echo $form->error($model, 'member_no'); ?> </div> <div class="row-right"> <?php echo $form->labelEx($model, 'party_no'); ?> <?php //echo $form->dropDownList($model,'party_no',CHtml::listData(PartyMaster::model()->findAll(),'id','party_name'),array('empty' => 'Select Party')); ?> <?php echo $form->dropDownList($model, 'party_no', PartyMaster::items(), array('empty' => '----Select----')); ?> <span class="status"> </span> <?php echo $form->error($model, 'party_no'); ?> </div> </div> <div class="row"> <div class="row-left"> <?php echo $form->labelEx($model, 'jaharat_from_date'); ?> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'jaharat_from_date', 'language' => 'en', 'options' => array('dateFormat' => 'yy-mm-dd', 'changeMonth' => 'true', 'changeYear' => 'true', 'duration' => 'fast', 'showAnim' => 'slide'), 'htmlOptions' => array('style' => 'height:18px;
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = PartyMaster::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
private static function loadItems() { self::$_items = array(); $models = self::model()->findAll(); foreach ($models as $model) { self::$_items[$model->id] = $model->id . " " . $model->party_name; } }