public function search($params) { $query = Transfers::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 20]]); // load the search form data and validate if (!($this->load($params) && $this->validate())) { return $dataProvider; } // adjust the query by adding the filters $query->filterWhere(['like', 'number', $this->number])->andFilterWhere(['like', 'declaration', $this->declaration])->andFilterWhere(['=', 'from_id', $this->from_id])->andFilterWhere(['=', 'to_id', $this->to_id])->andFilterWhere(['like', 'ship_date', $this->ship_date])->andFilterWhere(['=', 'status', $this->status]); return $dataProvider; }
echo $k == 'warehouse_big' ? "<br />Большой склад:" . Transfers::warehouseArray()[$val] : ''; ?> <?php echo $k == 'warehouse_small' ? "<br />Малый склад:" . Transfers::warehouseArray()[$val] : ''; ?> <?php echo $k == 'mark_delete' ? "<br />Помечен на удаление:" . Transfers::boolArray()[$val] : ''; ?> <?php echo $k == 'status' ? "<br />Статус:" . Transfers::statusArray()[$val] : ''; ?> <?php echo $k == 'declaration' ? "<br />Декларация:{$val}" : ''; ?> <?php echo $k == 'express' ? "<br />Срочный:" . Transfers::boolArray()[$val] : ''; ?> <?php echo $k == 'moved' ? "" : ''; ?> <?php echo $k == 'moved_count' ? "" : ''; ?> <?php } ?> <?php $ar = null; ?> </P>
public function actionReport() { $today = Transfers::find()->where('ship_date = CURDATE()')->all(); $tomorrow = Transfers::find()->where('ship_date = DATE_ADD(CURDATE(), INTERVAL +1 DAY)')->all(); $uncompleted = Transfers::find()->where('ship_date < CURDATE()')->andWhere(['!=', 'status', Transfers::STATUS_SHIPPED])->all(); return $this->render('report', ['uncompleted' => $uncompleted, 'today' => $today, 'tomorrow' => $tomorrow, 'title' => 'Отчет']); }
?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'formatter' => ['class' => 'yii\\i18n\\Formatter', 'nullDisplay' => ''], 'tableOptions' => ['class' => 'table table-bordered table-hover'], 'rowOptions' => function ($model, $index, $widget, $grid) { return $model->mark_delete ? ['class' => 'marked-delete'] : ""; }, 'columns' => [['attribute' => ' ', 'value' => function ($data) { $c = $data->comment ? 'K' : ''; $e = $data->express ? '<i class = "glyphicon glyphicon-plane"></i>' : ''; $m = $data->moved ? '<i class = "glyphicon glyphicon-arrow-right"></i>' . "({$data->moved_count})" : ''; return $c . $e . $m; }, 'format' => 'html'], ['attribute' => 'number'], ['attribute' => 'declaration'], ['attribute' => 'from_id', 'value' => 'branchesFrom.name', 'filter' => \app\models\Branches::branchesArray()], ['attribute' => 'to_id', 'value' => 'branchesTo.name', 'filter' => \app\models\Branches::branchesArray()], ['attribute' => 'ship_date', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'ship_date'])], ['attribute' => 'Склад', 'value' => function ($data) { $b = $data->warehouse_big > 0 ? 'Б' : ''; $s = $data->warehouse_small > 0 ? 'М' : ''; return $b . ' ' . $s; }], ['attribute' => 'status', 'value' => function ($data) { return Transfers::statusArray()[$data->status]; }, 'filter' => Transfers::statusArray()], ['attribute' => 'author_id', 'value' => 'user.full_name'], ['attribute' => 'Создано / Отредактировано ', 'value' => function ($data) { return $data->created_at . '<br />' . $data->updated_at; }, 'format' => 'raw', 'contentOptions' => ['style' => 'font-size:12px']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{mark-delete}{delete}', 'buttons' => ['mark-delete' => function ($url) { return Html::a('<i class=" glyphicon glyphicon-remove-sign"></i>', $url, ['title' => 'Пометить на удаление', 'data-method' => 'post']); }]]]]); Pjax::end(); ?> <div> <b>К</b> - Комментарий <i class = "glyphicon glyphicon-plane"></i> - Срочный <i class = "glyphicon glyphicon-arrow-right"></i> - Перенесен (n - раз) </div> </div>
?> <?php if ($item->express) { ?> <i class = "glyphicon glyphicon-plane"></i> <?php } ?> <?php if ($item->moved) { ?> <i class = "glyphicon glyphicon-arrow-right"></i>(<?php echo $item->moved_count; ?> ) <?php } ?> </td> <td><?php echo Transfers::statusArray()[$item->status]; ?> </td> </tr> <?php } ?> </table> </div> </div>