</div> <div class="col-md-4 col-sm-6"> <?php $this->beginWidget('TbPanel', array('header' => Yii::t('app', "Item Financial Details"))); ?> <?php echo $form->textFieldRow($model, 'purchaseprice', array('maxlength' => 8)); ?> <?php echo $form->textFieldRow($model, 'profit'); ?> <?php echo $form->dropDownListRow($model, 'itemVatCat_id', CHtml::listData(ItemVatCat::model()->findAll(), 'id', 'name')); ?> <?php echo $form->textFieldRow($model, 'saleprice', array('maxlength' => 8)); ?> <?php echo $form->dropDownListRow($model, 'currency_id', CHtml::listData(Currates::model()->GetRateList(), 'currency_id', 'name')); ?> <?php $this->endWidget(); ?> </div> <div class="col-md-4 col-sm-6">
private function compSave() { $catagories = ItemVatCat::model()->findAll(); foreach ($catagories as $catagory) { if (!UserIncomeMap::model()->findByPk(array('user_id' => $this->id, 'itemVatCat_id' => $catagory->id))) { //'user_id', 'itemVatCat_id' $model = new UserIncomeMap(); $attr = array("user_id" => $this->id, "itemVatCat_id" => $catagory->id, "account_id" => 100); $model->attributes = $attr; if (!$model->save()) { return false; } } } Yii::log('user save catagory', 'info', 'app'); $tmps = CUploadedFile::getInstanceByName('User[certfile]'); if ($tmps) { Yii::log('saved', 'info', 'app'); if ($tmps->saveAs($this->getCertFilePath($this->id))) { // add it to the main model now } else { echo 'Cannot upload!'; } //} } }
/** * 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 = ItemVatCat::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<tr> <td> <?php echo ItemVatCat::model()->findByPk($model->itemVatCat_id)->name; //echo $form->hiddenField($model, "[$i]itemVatCat_id"); ?> </td> <td> <?php echo Accounts::model()->findByPk($model->account_id)->name; //echo $form->dropDownList($model, "[$i]account_id", CHtml::listData(Accounts::model()->AutoComplete('',3), 'value', 'label'),array('class'=>'currSelect')); ?> </td> </tr>