public function actionAutomaticreceiving7() { set_time_limit(0); $model = new Order(); $list = $model->find()->where(['orderStatus' => 2])->all(); //查出所有已发货的订单 $res = []; foreach ($list as $k => $v) { $status = $v->orderExpressInfo->status; $updateTime = null; if (isset($v->orderExpressInfo->updateTime) && !empty($v->orderExpressInfo->updateTime)) { $updateTime = $v->orderExpressInfo->updateTime; } $updateTime = strtotime($updateTime); if ($updateTime && $status == 4) { $interval = strtotime(date('Y-m-d H:i:s', time())) - $updateTime; $day = $interval / 86400; //60s*60min*24h if ($day > 7) { array_push($res, ['id' => $v->id, 'orderStatus' => 3]); } } } $model->updateOrderStatusByBatch($res); //系统自动确认收货(批量) }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Order::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(['HANDPHONE' => $this->HANDPHONE, 'GRANDTOTAL' => $this->GRANDTOTAL, 'CREATE_DATED' => $this->CREATE_DATED]); $query->andFilterWhere(['like', 'G_ORDER', $this->G_ORDER])->andFilterWhere(['like', 'G_RANDOM', $this->G_RANDOM])->andFilterWhere(['like', 'G_PESAN', $this->G_PESAN])->andFilterWhere(['like', 'USER_ID', $this->USER_ID])->andFilterWhere(['like', 'USER_NAME', $this->USER_NAME])->andFilterWhere(['like', 'NAMA_CUSTOMER', $this->NAMA_CUSTOMER])->andFilterWhere(['like', 'ALAMAT_CUSTOMER', $this->ALAMAT_CUSTOMER])->andFilterWhere(['like', 'EMAIL_CUSTOMER', $this->EMAIL_CUSTOMER])->andFilterWhere(['like', 'STATUS', $this->STATUS]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Order::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, 'status' => $this->status ? array_search(mb_convert_case(mb_strtolower($this->status), MB_CASE_TITLE), Order::getStatuses()) : $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_at_date' => $this->created_at_date, 'updated_at_date' => $this->updated_at_date]); $query->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'department', $this->department])->andFilterWhere(['like', 'note', $this->note]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { //$uid = Yii::$app->user->identity->id; $query = Order::find(); //->where(['id' => $uid])->all(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['user_id' => $this->user_id, 'product_id' => $this->product_id, 'id' => $this->id]); $query->andFilterWhere(['username' => $this->username])->andFilterWhere(['like', 'qty', $this->qty])->andFilterWhere(['like', 'date', $this->date])->andFilterWhere(['like', 'Status', $this->Status]); return $dataProvider; }
public static function badgeAllCount($modelName) { $count = 0; switch ($modelName) { case 'Order': $count = Order::find()->count(); break; case 'Call': $count = Call::find()->count(); break; case 'Review': $count = Review::find()->count(); break; default: $count = 0; break; } $options = ['class' => 'badge']; if ($count) { return Html::tag('span', $count, $options); } return Html::tag('span', $count, $options); }
public static function badges($modelName) { $count = 0; switch ($modelName) { case 'Order': $count = Order::find()->where(['status' => Order::STATUS_NEW])->count(); break; case 'Call': $count = Call::find()->where(['status' => Call::STATUS_NEW])->count(); break; case 'Review': $count = Review::find()->where(['status' => Review::STATUS_NEW])->count(); break; default: $count = 0; break; } $options = ['class' => 'label-danger label-as-badge']; if ($count) { return Html::tag('span', $count, $options); } $options = ['class' => 'label-info label-as-badge']; return Html::tag('span', $count, $options); }
public static function search($params, $accountId) { $query = Order::find(); $condition = self::createCondition($params, $accountId); $query->orderBy(self::normalizeOrderBy($params)); $query->where($condition); return new ActiveDataProvider(['query' => $query]); }
/** * Lists all Order models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Order::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionPdf($id) { /* $mpdf=new mPDF(); $mpdf->WriteHTML($this->renderPartial('mpdf',['model' => $this->findModel($id),])); //$mpdf->WriteHTML($this->renderPartial('mpdf')); $mpdf->Output('Expdf.pdf', 'D'); exit; */ // $model = new Order(); // $total = new Chart(); $sql = Order::find()->where(['G_ORDER' => $id])->asArray()->one(); $list = Chart::find()->where(['FAKTUR' => $id])->asArray()->all(); $total = Chart::find()->select('sum(HARGA) as total')->where(['FAKTUR' => $id])->asArray()->all(); $mpdf = new mPDF(); $mpdf->WriteHTML($this->renderPartial('invoice', ['sql' => $sql, 'list' => $list, 'total' => $total])); $mpdf->Output(); exit; //return $this->renderPartial('mpdf'); }
public static function show($state = 0) { return Order::find()->where(['state' => $state])->all(); }