Пример #1
0
 /**
  * Deletes an existing Inventory model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     $models = \app\models\Inventorydetail::find()->where(['inventory_id' => $id])->all();
     foreach ($models as $key) {
         $key->delete();
     }
     Yii::$app->getSession()->setFlash('alert', ['body' => 'ลบข้อมูลเรียนร้อยแล้ว..', 'options' => ['class' => 'alert-success']]);
     return $this->redirect(['index']);
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Inventorydetail::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'product_id' => $this->product_id, 'price' => $this->price, 'qty' => $this->qty]);
     $query->andFilterWhere(['like', 'inventory_id', $this->inventory_id]);
     return $dataProvider;
 }
Пример #3
0
                    </tr>
                </table>
                <table class="table table-bordered" style="font-size:15pt;">
                    <tr align="center">
                        <td align="center">ยอดเงินที่ได้รับจัดสรร</td>
                        <td align="center">ยอดเงินที่จัดสรรแล้ว</td>
                        <td align="center">ยอดเงินที่จัดสรรครั้งนี้</td>
                        <td align="center">ยอดเงินคงเหลือ</td>
                    </tr>
                    <tr>
                        <td align="center"><?php 
echo $cart->format_number(Budget::find()->where(['id' => $model->budget_id])->one()->name);
?>
</td>
                        <td align="center"><?php 
echo $cart->format_number(Inventorydetail::find()->sum('price'));
?>
</td>
                        <td align="center"><?php 
echo $cart->format_number(1800);
?>
</td>
                        <td align="center"><?php 
echo $cart->format_number(1800);
?>
</td>
                    </tr>
                </table>
                จึงเรียนมาเพื่อโปรดพิจารณาอนุมัติ<br><br>
                <table class="table" style="font-size:15pt;">
                    <tr>
Пример #4
0
echo Html::encode($this->title);
?>
        </div>
        <div class="panel-body">
            วันที่ <?php 
echo Yii::$app->thaiFormatter->asDate($model->d_date, 'short');
?>
           
             เลขที่ใบส่งของ :<?php 
echo $model->bill_no;
?>
 
       
            
           

            <?php 
$dataProvider = new ActiveDataProvider(['query' => Inventorydetail::find()->where(['inventory_id' => $model->id])->orderBy('id DESC'), 'pagination' => ['pageSize' => 20]]);
?>



            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'panel' => ['before' => ' '], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'productname', 'width' => '1000px'], 'price', 'qty']]);
?>


        </div>
    </div>
</div>
Пример #5
0
use app\models\Category;
use app\models\Productmain;
use app\models\Unit;
/* @var $this yii\web\View */
/* @var $searchModel app\models\ProductsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Products';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="products-index">

    <h1><?php 
Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('เพิ่มรายการใหม่', ['create'], ['class' => 'btn btn-success fa fa-plus']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['before' => ' '], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'หมวดหมู่หลัก', 'format' => 'raw', 'value' => 'productmainname', 'filter' => Html::activeDropDownList($searchModel, 'productmain_id', ArrayHelper::map(Productmain::find()->asArray()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['label' => 'หมวดหมู่รอง', 'format' => 'raw', 'value' => 'Categoryname', 'filter' => Html::activeDropDownList($searchModel, 'category_id', ArrayHelper::map(Category::find()->asArray()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'sub_qty', ['label' => 'ชื่อหน่วยนับ', 'format' => 'raw', 'value' => 'unitname', 'filter' => Html::activeDropDownList($searchModel, 'productmain_id', ArrayHelper::map(Unit::find()->asArray()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['label' => 'จำนวนคงเหลือ', 'format' => 'raw', 'value' => 'unitname', 'filter' => \app\models\Inventorydetail::find()->where(['product_id' => $dataProvider->id])->sum('qty')], 'name', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
 /**
  * Finds the Inventorydetail model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Inventorydetail the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Inventorydetail::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }