Пример #1
0
 public function search($params)
 {
     $query = Comkarupan::find();
     //$query = Comkarupan::find()->groupByStatusName;
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => 'DESC']], 'pagination' => ['pagesize' => 20]]);
     if (isset($_GET['ComkarupanSearch']) && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     /*$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, 'com_hdd_size' => $this->com_hdd_size, 'com_ram_size' => $this->com_ram_size, 'network_type' => $this->network_type, 'warranty' => $this->warranty, 'depart' => $this->depart, 'date' => $this->date, 'price' => $this->price, 'dealer' => $this->dealer, 'status' => $this->status, 'addtosysdate' => $this->addtosysdate, 'editlasttime' => $this->editlasttime, 'ref' => $this->ref]);
     $query->andFilterWhere(['like', 'krp_code', $this->krp_code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'serial', $this->serial])->andFilterWhere(['like', 'ctype', $this->ctype])->andFilterWhere(['like', 'com_ip', $this->com_ip])->andFilterWhere(['like', 'com_macaddr', $this->com_macaddr])->andFilterWhere(['like', 'com_hdd', $this->com_hdd])->andFilterWhere(['like', 'com_cpu', $this->com_cpu])->andFilterWhere(['like', 'com_cpu_detail', $this->com_cpu_detail])->andFilterWhere(['like', 'com_mb', $this->com_mb])->andFilterWhere(['like', 'com_mb_detail', $this->com_mb_detail])->andFilterWhere(['like', 'com_ram', $this->com_ram])->andFilterWhere(['like', 'com_vga', $this->com_vga])->andFilterWhere(['like', 'com_vga_detail', $this->com_vga_detail])->andFilterWhere(['like', 'com_dvd', $this->com_dvd])->andFilterWhere(['like', 'com_os', $this->com_os])->andFilterWhere(['like', 'com_program', $this->com_program])->andFilterWhere(['like', 'com_monitor', $this->com_monitor])->andFilterWhere(['like', 'com_mornitor_detail', $this->com_mornitor_detail])->andFilterWhere(['like', 'com_ups', $this->com_ups])->andFilterWhere(['like', 'com_ups_detail', $this->com_ups_detail])->andFilterWhere(['like', 'com_printer', $this->com_printer])->andFilterWhere(['like', 'com_printer_detail', $this->com_printer_detail])->andFilterWhere(['like', 'brand', $this->brand])->andFilterWhere(['like', 'network_detail', $this->network_detail])->andFilterWhere(['like', 'mornitor', $this->mornitor])->andFilterWhere(['like', 'mornitor_detail', $this->mornitor_detail])->andFilterWhere(['like', 'printer', $this->printer])->andFilterWhere(['like', 'printer_detail', $this->printer_detail])->andFilterWhere(['like', 'ups', $this->ups])->andFilterWhere(['like', 'ups_detail', $this->ups_detail])->andFilterWhere(['like', 'scanner', $this->ups])->andFilterWhere(['like', 'scanner_detail', $this->ups_detail])->andFilterWhere(['like', 'other', $this->other])->andFilterWhere(['like', 'other_detail', $this->other_detail])->andFilterWhere(['like', 'picture', $this->picture])->andFilterWhere(['like', 'docs', $this->docs])->andFilterWhere(['like', 'mod', $this->mod])->andFilterWhere(['like', 'user_rec', $this->user_rec])->andFilterWhere(['like', 'income', $this->income]);
     return $dataProvider;
 }
Пример #2
0
 private function removeUploadDir($dir)
 {
     BaseFileHelper::removeDirectory(Comkarupan::getUploadPath() . $dir);
 }
Пример #3
0
                <div class="box box-warning">
                    <div class="box-header">
                        <h3 class="box-title">20 รายการที่บันทึกล่าสุด</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <tr>
                                <th>#ID</th>
                                <th>วันที่</th>
                                <th>สถานะ</th>
                                <th>ชื่ออุปกรณ์</th>
                                <th>ใช้งานที่</th>
                            </tr>
                            <?php 
$models = \app\models\Comkarupan::find()->limit(20)->orderBy('id desc')->all();
foreach ($models as $model) {
    if ($model->status == 1) {
        $statusLable = "<span class='label label-success'>กำลังใช้งาน</span>";
    } elseif ($model->status == 2) {
        $statusLable = "<span class='label label-info'>พร้อมใช้งาน</span>";
    } elseif ($model->status == 3) {
        $statusLable = "<span class='label label-warning'>อยู่ระหว่างซ่อม</span>";
    } elseif ($model->status == 4) {
        $statusLable = "<span class='label label-primary'>ส่งซ่อม</span>";
    } elseif ($model->status == 5) {
        $statusLable = "<span class='label label-danger'>ส่งซ่อม</span>";
    } elseif ($model->status == 6) {
        $statusLable = "<span class='label label-default'>ส่งซ่อม</span>";
    } else {
        $statusLable = "<span class='label'>ไม่อยู่ในเงื่อนไข</span>";
Пример #4
0
echo Comkarupan::find()->where(['status' => 6])->count();
?>
  รายการ</span>
    </p>

    <?php 
$columns = [['attribute' => 'id', 'width' => '30px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'krp_code', 'width' => '160px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center', 'pageSummary' => 'Page Total'], ['attribute' => 'name', 'headerOptions' => ['style' => 'text-align:center']], ['attribute' => 'ctype', 'filter' => \app\models\Comkarupan::itemsAlias('ctype'), 'value' => function ($model) {
    return $model->ctypeName;
}, 'width' => '150px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'depart', 'value' => function ($data) {
    if (isset($data->depart_role->name)) {
        return $data->depart_role->name;
    } else {
        return 'ไม่ทราบข้อมูล';
        //
    }
}, 'hAlign' => 'center', 'width' => '200px', 'headerOptions' => ['style' => 'text-align:center'], 'filter' => \yii\helpers\ArrayHelper::map(app\models\Section::find()->all(), 'id', 'name')], ['attribute' => 'income', 'filter' => \app\models\Comkarupan::itemsAlias('income'), 'value' => function ($model) {
    return $model->incomeName;
}, 'width' => '120px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'date', 'filterType' => GridView::FILTER_DATE, 'format' => 'raw', 'width' => '170px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['attribute' => 'status', 'filter' => \app\models\Comkarupan::itemsAlias('status'), 'value' => function ($model) {
    return $model->statusName;
}, 'width' => '150px', 'headerOptions' => ['style' => 'text-align:center'], 'hAlign' => 'center'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'template' => '{view} {update} {delete}', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['view', 'id' => $model->id, 'cid' => $model->ctype], ['title' => 'ดูรายละเอียด', 'data-toggle' => 'tooltip']);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['update', 'id' => $model->id, 'cid' => $model->ctype], ['title' => 'แก้ไขรายละเอียด', 'data-toggle' => 'tooltip']);
}, 'delete' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'id' => $model->id], ['title' => 'ลบรายการ', 'data-toggle' => 'tooltip', 'data-method' => 'post', 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?')]);
}]]];
echo DynaGrid::widget(['columns' => $columns, 'storage' => DynaGrid::TYPE_SESSION, 'theme' => 'panel-info', 'enableMultiSort' => false, 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'showPageSummary' => true, 'pjax' => true, 'hover' => true, 'panel' => ['heading' => '<h3 class="panel-title">รายการครุภัณฑ์</h3>', 'before' => '{dynagrid}', 'defaultPageSize' => 20]], 'options' => ['id' => 'dynagrid-1'], 'showSort' => true]);
?>

</div>