/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = OrdersTransport::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['attributes' => ['order_id']]]);
     $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, 'employer' => $this->employer, 'order_date_start' => $this->order_date_start, 'order_date_end' => $this->order_date_end, 'truck1' => $this->truck1, 'truck2' => $this->truck2, 'driver1' => $this->driver1, 'driver2' => $this->driver2, 'create_date' => $this->create_date]);
     $query->andFilterWhere(['like', 'order_id', $this->order_id]);
     $query->andWhere(['delete_flag' => 0]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrder()
 {
     return $this->hasOne(OrdersTransport::className(), ['order_id' => 'order_id']);
 }
 public function actionReportall($id = null)
 {
     $order_id = OrdersTransport::find()->where(['id' => $id])->one()->order_id;
     $assign_model = new \app\models\Assign();
     $assign = $assign_model->find()->where(['order_id' => $order_id])->all();
     $content = $this->renderPartial('_reportViewAll', ['model' => $this->findModel($id), 'assigns' => $assign]);
     $mpdf = new \mPDF('th', 'A4-P', '0', 'THSaraban');
     $mpdf->WriteHTML($content);
     $mpdf->SetDisplayMode('fullpage');
     $mpdf->Output($order_id . ".pdf", "I");
 }