Example #1
0
 public static function findName($id)
 {
     $account = ItemVatCat::findOne(['id' => $id]);
     if ($account == null) {
         return \Yii::t('app', 'NA');
     }
     return $account->name;
 }
Example #2
0
 private function compSave()
 {
     $catagories = ItemVatCat::find()->All();
     foreach ($catagories as $catagory) {
         if (!UserIncomeMap::findOne(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()) {
                 Yii::error('fatel error unable to save cat');
                 return false;
             }
         }
     }
     Yii::info('user save catagory');
     $tmps = \yii\web\UploadedFile::getInstanceByName('User[certfile]');
     if ($tmps) {
         Yii::info('cert file loaded');
         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::findOne($id);
     if ($model === null) {
         throw new \yii\web\HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #4
0
<tr>
    <td>
        <?php 
use app\models\ItemVatCat;
use app\models\Accounts;
echo ItemVatCat::findName($model->itemVatCat_id);
//echo $form->hiddenField($model, "[$i]itemVatCat_id");
?>
    </td>
    <td>
        <?php 
echo Accounts::findName($model->account_id);
?>
    </td> 
</tr>
Example #5
0
            
          </div>
        <div class="col-md-4 col-sm-6">   
  
            
            <?php 
TbPanel::begin(array('header' => Yii::t('app', "Item Financial Details")));
?>
                <?php 
echo $form->field($model, 'purchaseprice');
?>
                <?php 
echo $form->field($model, 'profit');
?>
                <?php 
echo $form->field($model, 'itemVatCat_id')->dropDownList(ArrayHelper::map(ItemVatCat::find()->asArray()->all(), 'id', 'name'));
?>
            
                <?php 
echo $form->field($model, 'saleprice');
?>
	
                <?php 
echo $form->field($model, 'currency_id')->dropDownList(ArrayHelper::map(Currates::GetRateList(), 'currency_id', 'name'));
?>
            <?php 
TbPanel::end();
?>
            
        </div>
        <div class="col-md-4 col-sm-6">