/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Assign::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, 'order_date_start' => $this->order_date_start, 'order_date_end' => $this->order_date_end, 'car_id' => $this->car_id, 'driver1' => $this->driver1, 'driver2' => $this->driver2, 'oil_set' => $this->oil_set, 'oil' => $this->oil, 'oil_unit' => $this->oil_unit, 'oil_price' => $this->oil_price, 'gas' => $this->gas, 'gas_unit' => $this->gas_unit, 'gas_price' => $this->gas_price, 'product_up' => $this->product_up, 'product_down' => $this->product_down, 'transport_date' => $this->transport_date, 'changwat_start' => $this->changwat_start, 'changwat_end' => $this->changwat_end, 'product_type' => $this->product_type, 'weigh' => $this->weigh, 'type_calculus' => $this->type_calculus, 'unit_price' => $this->unit_price, 'per_times' => $this->per_times, 'income' => $this->income, 'create_date' => $this->create_date]); $query->andFilterWhere(['like', 'order_id', $this->order_id])->andFilterWhere(['like', 'assign_id', $this->assign_id])->andFilterWhere(['like', 'employer', $this->employer])->andFilterWhere(['like', 'old_mile', $this->old_mile])->andFilterWhere(['like', 'now_mile', $this->now_mile])->andFilterWhere(['like', 'distance', $this->distance])->andFilterWhere(['like', 'distance_collect', $this->distance_collect])->andFilterWhere(['like', 'avg_oil', $this->avg_oil])->andFilterWhere(['like', 'compensate', $this->compensate])->andFilterWhere(['like', 'cus_start', $this->cus_start])->andFilterWhere(['like', 'cus_end', $this->cus_end])->andFilterWhere(['like', 'allowance_driver1', $this->allowance_driver1])->andFilterWhere(['like', 'allowance_driver2', $this->allowance_driver2])->andFilterWhere(['like', 'message', $this->message]); return $dataProvider; }
public function actionGet_bill_customer($cus_id = null) { //$searchModel = new AssignSearch(); $query = Assign::find()->where(['employer' => $cus_id, 'flag' => '0']); $provider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $employer = \app\models\OrdersTransportAffiliated::find()->select('orders_transport_affiliated.*')->join('INNER JOIN', 'assign_affiliated', 'assign_affiliated.order_id = orders_transport_affiliated.order_id')->where(['orders_transport_affiliated.employer' => $cus_id, 'flag' => '0']); $provider2 = new ActiveDataProvider(['query' => $employer, 'pagination' => ['pageSize' => 10]]); return $this->render('get_bill_customer', ['dataProvider' => $provider, 'dataProvider2' => $provider2, 'cus_id' => $cus_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"); }
/** * Finds the Assign model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Assign the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Assign::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }