From 7e6dc75538187fa6123a168e1a4073c5ec2147d3 Mon Sep 17 00:00:00 2001 From: fomichev Date: Wed, 19 Feb 2025 18:09:13 +0300 Subject: [PATCH] =?utf8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B0?= =?utf8?q?=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/YandexMarketController.php | 152 +++++++++++++++++- .../MarketplaceOrderDeliveryController.php | 134 +++++++++++++++ ...arketplaceOrderStatusHistoryController.php | 134 +++++++++++++++ .../MarketplaceOrderStatusTypesController.php | 134 +++++++++++++++ .../MarketplaceOrdersController.php | 134 +++++++++++++++ .../yandex_market_api/Model/OrderVatType.php | 3 + ...062708_create_marketplace_orders_table.php | 50 ++++++ ...e_marketplace_order_status_types_table.php | 33 ++++ ...marketplace_order_status_history_table.php | 67 ++++++++ ...reate_marketplace_order_delivery_table.php | 59 +++++++ erp24/records/MarketplaceOrderDelivery.php | 105 ++++++++++++ .../MarketplaceOrderDeliverySearch.php | 88 ++++++++++ .../records/MarketplaceOrderStatusHistory.php | 101 ++++++++++++ .../MarketplaceOrderStatusHistorySearch.php | 75 +++++++++ erp24/records/MarketplaceOrderStatusTypes.php | 76 +++++++++ .../MarketplaceOrderStatusTypesSearch.php | 71 ++++++++ erp24/records/MarketplaceOrders.php | 109 +++++++++++++ erp24/records/MarketplaceOrdersSearch.php | 84 ++++++++++ .../marketplace-order-delivery/_search.php | 65 ++++++++ .../marketplace-order-delivery/index.php | 62 +++++++ .../views/marketplace-order-delivery/view.php | 55 +++++++ .../_search.php | 41 +++++ .../index.php | 50 ++++++ .../marketplace-order-status-history/view.php | 43 +++++ .../marketplace-order-status-types/_form.php | 27 ++++ .../_search.php | 33 ++++ .../marketplace-order-status-types/create.php | 20 +++ .../marketplace-order-status-types/index.php | 46 ++++++ .../marketplace-order-status-types/update.php | 21 +++ .../marketplace-order-status-types/view.php | 39 +++++ erp24/views/marketplace-orders/_search.php | 57 +++++++ erp24/views/marketplace-orders/index.php | 58 +++++++ erp24/views/marketplace-orders/view.php | 51 ++++++ 33 files changed, 2276 insertions(+), 1 deletion(-) create mode 100644 erp24/controllers/MarketplaceOrderDeliveryController.php create mode 100644 erp24/controllers/MarketplaceOrderStatusHistoryController.php create mode 100644 erp24/controllers/MarketplaceOrderStatusTypesController.php create mode 100644 erp24/controllers/MarketplaceOrdersController.php create mode 100644 erp24/migrations/m250219_062708_create_marketplace_orders_table.php create mode 100644 erp24/migrations/m250219_081610_create_marketplace_order_status_types_table.php create mode 100644 erp24/migrations/m250219_081716_create_marketplace_order_status_history_table.php create mode 100644 erp24/migrations/m250219_082141_create_marketplace_order_delivery_table.php create mode 100644 erp24/records/MarketplaceOrderDelivery.php create mode 100644 erp24/records/MarketplaceOrderDeliverySearch.php create mode 100644 erp24/records/MarketplaceOrderStatusHistory.php create mode 100644 erp24/records/MarketplaceOrderStatusHistorySearch.php create mode 100644 erp24/records/MarketplaceOrderStatusTypes.php create mode 100644 erp24/records/MarketplaceOrderStatusTypesSearch.php create mode 100644 erp24/records/MarketplaceOrders.php create mode 100644 erp24/records/MarketplaceOrdersSearch.php create mode 100644 erp24/views/marketplace-order-delivery/_search.php create mode 100644 erp24/views/marketplace-order-delivery/index.php create mode 100644 erp24/views/marketplace-order-delivery/view.php create mode 100644 erp24/views/marketplace-order-status-history/_search.php create mode 100644 erp24/views/marketplace-order-status-history/index.php create mode 100644 erp24/views/marketplace-order-status-history/view.php create mode 100644 erp24/views/marketplace-order-status-types/_form.php create mode 100644 erp24/views/marketplace-order-status-types/_search.php create mode 100644 erp24/views/marketplace-order-status-types/create.php create mode 100644 erp24/views/marketplace-order-status-types/index.php create mode 100644 erp24/views/marketplace-order-status-types/update.php create mode 100644 erp24/views/marketplace-order-status-types/view.php create mode 100644 erp24/views/marketplace-orders/_search.php create mode 100644 erp24/views/marketplace-orders/index.php create mode 100644 erp24/views/marketplace-orders/view.php diff --git a/erp24/api2/controllers/YandexMarketController.php b/erp24/api2/controllers/YandexMarketController.php index ec1e5634..a065e0f4 100644 --- a/erp24/api2/controllers/YandexMarketController.php +++ b/erp24/api2/controllers/YandexMarketController.php @@ -9,6 +9,11 @@ use OpenAPI\Client\Configuration; use OpenAPI\Client\Api; use OpenAPI\Client\Model; use GuzzleHttp; +use yii\web\Response; +use yii_app\records\MarketplaceOrders; +use yii_app\records\MarketplaceOrderStatusHistory; +use yii_app\records\MarketplaceOrderStatusTypes; +use yii_app\records\MarketplaceStore; use yii_app\records\MatrixErp; use yii_app\records\Products1c; use yii_app\services\MarketplaceService; @@ -167,4 +172,149 @@ class YandexMarketController extends Controller return "
" . $output . "
"; } -} \ No newline at end of file + + public function actionGetOrders() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $config = Configuration::getDefaultConfiguration() + ->setApiKey('Api-Key', Yii::$app->params['YANDEX_MARKET_API_KEY']); + + $campaignIds = MarketplaceStore::find() + ->select(['warehouse_guid']) + ->where(['warehouse_id' => 2]) + ->column(); + + $statuses = MarketplaceOrderStatusTypes::find() + ->select(['id', 'code']) + ->indexBy('code') + ->asArray()->all(); + + $statuses = ArrayHelper::map($statuses, 'code', 'id'); + $statusCodes = array_unique(array_keys($statuses)); + // var_dump($statusCodes);die(); + + + $apiInstance = new Api\OrdersApi(new GuzzleHttp\Client(), $config); + //$apiModel = new Model\GetOrdersResponse(); + + foreach ($campaignIds as $campaignId) { + $result = $apiInstance->getOrdersWithHttpInfo($campaignId); + $pager = $result[0]->getPager(); + if (empty($pager->getTotal())) { + continue; + } + + $orders = $result[0]->getOrders(); + foreach ($orders as $order) { + // var_dump($statusCodes);die(); + // Установка и сохранение статусов + $status = $statuses[$order->getStatus()] ?? null; + $substatus = $statuses[$order->getSubstatus()] ?? null; + if (!in_array($order->getStatus(), $statusCodes)) { + $newStatus = new MarketplaceOrderStatusTypes(); + $newStatus->code = $order->getStatus(); + if ($newStatus->save()) { + $status = $newStatus->id; + $statusCodes[] = $order->getStatus(); + $statuses[$order->getStatus()] = $newStatus->id; + } else { + Yii::error('Ошибка сохранения' . json_encode($newStatus->getErrors(), JSON_UNESCAPED_UNICODE)); + } + } + if (!in_array($order->getSubstatus(), $statusCodes)) { + $newSubstatus = new MarketplaceOrderStatusTypes(); + $newSubstatus->code = $order->getSubstatus(); + if ($newSubstatus->save()) { + $substatus = $newSubstatus->id; + $statusCodes[] = $order->getSubstatus(); + $statuses[$order->getSubstatus()] = $newStatus->id; + } else { + Yii::error('Ошибка сохранения' . json_encode($newSubstatus->getErrors(), JSON_UNESCAPED_UNICODE)); + } + } + $marketplaceOrder = MarketplaceOrders::find()->where(['marketplace_id' => (string)$order->getId()])->one(); + + if (!empty($marketplaceOrder)) { + $statusHistoryRecord = MarketplaceOrderStatusHistory::find() + ->where(['id' => $marketplaceOrder->status_history_id]) + ->one(); + if(!empty($statusHistoryRecord) && ($statusHistoryRecord->status_id !== $status || $statusHistoryRecord->substatus_id !== $substatus)) { + $statusHistoryRecord->active = 0; + $statusHistoryRecord->date_to = date(); + $statusHistoryRecord->save(); + + $newStatusHistoryRecord = new MarketplaceOrderStatusHistory(); + $newStatusHistoryRecord->order_id = $marketplaceOrder->id; + $newStatusHistoryRecord->status_id = (int)$status; + $newStatusHistoryRecord->substatus_id = (int)$substatus; + $newStatusHistoryRecord->active = 1; + $newStatusHistoryRecord->initiator = "ERP"; + $newStatusHistoryRecord->date_from = date(); + $newStatusHistoryRecord->date_end = date('Y-m-d H:i:s',strtotime("2100-01-01")); + if (!$newStatusHistoryRecord->save()) { + Yii::error('Ошибка сохранения' . json_encode($newStatusHistoryRecord->getErrors(), JSON_UNESCAPED_UNICODE)); + } else { + $marketplaceOrder->status_history_id = $newStatusHistoryRecord->id; + } + } + } else { + $marketplaceOrder = new MarketplaceOrders(); + $marketplaceOrder->marketplace_id = (string)$order->getId(); + //var_dump((int)$order->getCancelRequested()); die(); + $creationDate = strtotime($order->getCreationDate()); + if ($creationDate !== false) { + $marketplaceOrder->creation_date = date('Y-m-d H:i:s', $creationDate); + } else { + Yii::error("Неверный формат даты: " . $order->getCreationDate()); + } + $updatedAt = strtotime($order->getUpdatedAt()); + if ($updatedAt !== false) { + $marketplaceOrder->updated_at = date('Y-m-d H:i:s', $updatedAt); + } else { + Yii::error("Неверный формат даты: " . $order->getUpdatedAt()); + } + $marketplaceOrder->total = $order->getBuyerTotal(); + $marketplaceOrder->delivery_total = $order->getDeliveryTotal(); + $marketplaceOrder->buyer_total_before_discount = $order->getBuyerTotalBeforeDiscount(); + $marketplaceOrder->tax_system = $order->getTaxSystem(); + $marketplaceOrder->payment_type = $order->getPaymentType(); + $marketplaceOrder->payment_method = $order->getPaymentMethod(); + $marketplaceOrder->cancel_requested = (int)$order->getCancelRequested(); + $marketplaceOrder->store_id = (string)$campaignId; + $marketplaceOrder->raw_data = json_encode($order); + + if (!$marketplaceOrder->save()) { + Yii::error( + "Ошибка сохранения заказа с marketplace_id: " . $order->getId() . ". Ошибки: " . json_encode( + $marketplaceOrder->getErrors(), JSON_UNESCAPED_UNICODE + ) + ); + } else { + $newStatusHistoryRecord = new MarketplaceOrderStatusHistory(); + $newStatusHistoryRecord->order_id = $marketplaceOrder->id; + $newStatusHistoryRecord->status_id = (int)$status; + $newStatusHistoryRecord->substatus_id = (int)$substatus; + $newStatusHistoryRecord->active = 1; + $newStatusHistoryRecord->initiator = "ERP"; + $newStatusHistoryRecord->date_from = date('Y-m-d H:i:s'); + $newStatusHistoryRecord->date_end = date('Y-m-d H:i:s',strtotime("2100-01-01")); + if (!$newStatusHistoryRecord->save()) { + Yii::error('Ошибка сохранения' . json_encode($newStatusHistoryRecord->getErrors(), JSON_UNESCAPED_UNICODE)); + } else { + $marketplaceOrder->status_history_id = $newStatusHistoryRecord->id; + if (!$marketplaceOrder->save()) { + Yii::error( + "Ошибка сохранения заказа с marketplace_id: " . $order->getId() . ". Ошибки: " . json_encode( + $marketplaceOrder->getErrors(), JSON_UNESCAPED_UNICODE + ) + ); + } + } + } + } + } + } + return json_encode(["response" => "OK"]); + } + +} diff --git a/erp24/controllers/MarketplaceOrderDeliveryController.php b/erp24/controllers/MarketplaceOrderDeliveryController.php new file mode 100644 index 00000000..c3fe9d12 --- /dev/null +++ b/erp24/controllers/MarketplaceOrderDeliveryController.php @@ -0,0 +1,134 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ] + ); + } + + /** + * Lists all MarketplaceOrderDelivery models. + * + * @return string + */ + public function actionIndex() + { + $searchModel = new MarketplaceOrderDeliverySearch(); + $dataProvider = $searchModel->search($this->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single MarketplaceOrderDelivery model. + * @param int $id ID записи + * @return string + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new MarketplaceOrderDelivery model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return string|\yii\web\Response + */ + public function actionCreate() + { + $model = new MarketplaceOrderDelivery(); + + if ($this->request->isPost) { + if ($model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + } else { + $model->loadDefaultValues(); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing MarketplaceOrderDelivery model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param int $id ID записи + * @return string|\yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing MarketplaceOrderDelivery model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param int $id ID записи + * @return \yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the MarketplaceOrderDelivery model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param int $id ID записи + * @return MarketplaceOrderDelivery the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = MarketplaceOrderDelivery::findOne(['id' => $id])) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} diff --git a/erp24/controllers/MarketplaceOrderStatusHistoryController.php b/erp24/controllers/MarketplaceOrderStatusHistoryController.php new file mode 100644 index 00000000..d39e4824 --- /dev/null +++ b/erp24/controllers/MarketplaceOrderStatusHistoryController.php @@ -0,0 +1,134 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ] + ); + } + + /** + * Lists all MarketplaceOrderStatusHistory models. + * + * @return string + */ + public function actionIndex() + { + $searchModel = new MarketplaceOrderStatusHistorySearch(); + $dataProvider = $searchModel->search($this->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single MarketplaceOrderStatusHistory model. + * @param int $id ID записи + * @return string + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new MarketplaceOrderStatusHistory model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return string|\yii\web\Response + */ + public function actionCreate() + { + $model = new MarketplaceOrderStatusHistory(); + + if ($this->request->isPost) { + if ($model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + } else { + $model->loadDefaultValues(); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing MarketplaceOrderStatusHistory model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param int $id ID записи + * @return string|\yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing MarketplaceOrderStatusHistory model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param int $id ID записи + * @return \yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the MarketplaceOrderStatusHistory model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param int $id ID записи + * @return MarketplaceOrderStatusHistory the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = MarketplaceOrderStatusHistory::findOne(['id' => $id])) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} diff --git a/erp24/controllers/MarketplaceOrderStatusTypesController.php b/erp24/controllers/MarketplaceOrderStatusTypesController.php new file mode 100644 index 00000000..ca9f1974 --- /dev/null +++ b/erp24/controllers/MarketplaceOrderStatusTypesController.php @@ -0,0 +1,134 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ] + ); + } + + /** + * Lists all MarketplaceOrderStatusTypes models. + * + * @return string + */ + public function actionIndex() + { + $searchModel = new MarketplaceOrderStatusTypesSearch(); + $dataProvider = $searchModel->search($this->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single MarketplaceOrderStatusTypes model. + * @param int $id ID статуса + * @return string + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new MarketplaceOrderStatusTypes model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return string|\yii\web\Response + */ + public function actionCreate() + { + $model = new MarketplaceOrderStatusTypes(); + + if ($this->request->isPost) { + if ($model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + } else { + $model->loadDefaultValues(); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing MarketplaceOrderStatusTypes model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param int $id ID статуса + * @return string|\yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing MarketplaceOrderStatusTypes model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param int $id ID статуса + * @return \yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the MarketplaceOrderStatusTypes model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param int $id ID статуса + * @return MarketplaceOrderStatusTypes the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = MarketplaceOrderStatusTypes::findOne(['id' => $id])) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} diff --git a/erp24/controllers/MarketplaceOrdersController.php b/erp24/controllers/MarketplaceOrdersController.php new file mode 100644 index 00000000..c8e1353d --- /dev/null +++ b/erp24/controllers/MarketplaceOrdersController.php @@ -0,0 +1,134 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ] + ); + } + + /** + * Lists all MarketplaceOrders models. + * + * @return string + */ + public function actionIndex() + { + $searchModel = new MarketplaceOrdersSearch(); + $dataProvider = $searchModel->search($this->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single MarketplaceOrders model. + * @param int $id ID заказа + * @return string + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new MarketplaceOrders model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return string|\yii\web\Response + */ + public function actionCreate() + { + $model = new MarketplaceOrders(); + + if ($this->request->isPost) { + if ($model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + } else { + $model->loadDefaultValues(); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing MarketplaceOrders model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param int $id ID заказа + * @return string|\yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing MarketplaceOrders model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param int $id ID заказа + * @return \yii\web\Response + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the MarketplaceOrders model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param int $id ID заказа + * @return MarketplaceOrders the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = MarketplaceOrders::findOne(['id' => $id])) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} diff --git a/erp24/lib/yandex_market_api/Model/OrderVatType.php b/erp24/lib/yandex_market_api/Model/OrderVatType.php index 53d49733..b1f09ded 100644 --- a/erp24/lib/yandex_market_api/Model/OrderVatType.php +++ b/erp24/lib/yandex_market_api/Model/OrderVatType.php @@ -47,6 +47,8 @@ class OrderVatType public const VAT_0 = 'VAT_0'; + public const VAT_05 = 'VAT_05'; + public const VAT_10 = 'VAT_10'; public const VAT_10_110 = 'VAT_10_110'; @@ -70,6 +72,7 @@ class OrderVatType return [ self::NO_VAT, self::VAT_0, + self::VAT_05, self::VAT_10, self::VAT_10_110, self::VAT_20, diff --git a/erp24/migrations/m250219_062708_create_marketplace_orders_table.php b/erp24/migrations/m250219_062708_create_marketplace_orders_table.php new file mode 100644 index 00000000..a54bd4f4 --- /dev/null +++ b/erp24/migrations/m250219_062708_create_marketplace_orders_table.php @@ -0,0 +1,50 @@ +db->getTableSchema(self::TABLE_NAME); + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->bigPrimaryKey()->comment('ID заказа'), + 'marketplace_id' => $this->string(64)->notNull()->unique()->comment('ID заказа в системе маркетплейса'), + 'store_id' => $this->string(36)->comment('Идентификатор склада/магазина'), + 'status_history_id' => $this->bigInteger()->comment('Ссылка на текущий активный статус'), + 'creation_date' => $this->dateTime()->notNull()->comment('Дата создания заказа'), + 'updated_at' => $this->dateTime()->notNull()->comment('Время последнего обновления'), + 'total' => $this->decimal(15, 2)->notNull()->comment('Итоговая сумма к оплате'), + 'delivery_total' => $this->decimal(15, 2)->notNull()->comment('Стоимость доставки'), + 'buyer_total_before_discount' => $this->decimal(15, 2)->notNull()->comment('Сумма до скидок'), + 'tax_system' => $this->string(32)->notNull()->comment('Система налогообложения'), + 'payment_type' => $this->string(32)->notNull()->comment('Тип платежа'), + 'payment_method' => $this->string(32)->notNull()->comment('Метод оплаты'), + 'cancel_requested' => $this->tinyInteger()->notNull()->defaultValue(0)->comment('Флаг запроса отмены'), + 'raw_data' => $this->text()->comment('Полный сырой ответ API'), + 'guid' => $this->string(36)->null()->comment('GUID заказа в 1С'), + 'status_1c' => $this->integer()->defaultValue(1)->comment('Статус заказа в 1С'), + ]); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema)) { + $this->dropTable(self::TABLE_NAME); + } + } +} diff --git a/erp24/migrations/m250219_081610_create_marketplace_order_status_types_table.php b/erp24/migrations/m250219_081610_create_marketplace_order_status_types_table.php new file mode 100644 index 00000000..7ed87fb1 --- /dev/null +++ b/erp24/migrations/m250219_081610_create_marketplace_order_status_types_table.php @@ -0,0 +1,33 @@ +db->getTableSchema(self::TABLE_NAME); + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->primaryKey()->comment('ID статуса'), + 'code' => $this->string(64)->notNull()->comment('Код статуса'), + 'name' => $this->string(255)->null()->comment('Название статуса'), + 'description' => $this->string()->null()->comment('Описание статуса'), + ]); + } + } + + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema)) { + $this->dropTable(self::TABLE_NAME); + } + } +} diff --git a/erp24/migrations/m250219_081716_create_marketplace_order_status_history_table.php b/erp24/migrations/m250219_081716_create_marketplace_order_status_history_table.php new file mode 100644 index 00000000..664e9d39 --- /dev/null +++ b/erp24/migrations/m250219_081716_create_marketplace_order_status_history_table.php @@ -0,0 +1,67 @@ +db->getTableSchema(self::TABLE_NAME); + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->bigPrimaryKey()->comment('ID записи'), + 'order_id' => $this->bigInteger()->notNull()->comment('Ссылка на заказ'), + 'status_id' => $this->integer()->notNull()->comment('Ссылка на тип статуса'), + 'substatus_id' => $this->integer()->notNull()->comment('Ссылка на подстатус'), + 'active' => $this->integer(1)->notNull()->defaultValue(1)->comment('Активность записи'), + 'date_from' => $this->dateTime()->notNull()->comment('Дата и время начала активности'), + 'date_end' => $this->dateTime()->null()->comment('Дата и время окончания активности'), + 'initiator' => $this->text()->comment('Инициатор изменения'), + ]); + + $this->addForeignKey( + 'fk_order_status_history_order', + self::TABLE_NAME, + 'order_id', + 'marketplace_orders', + 'id', + 'SET NULL', + 'CASCADE' + ); + + $this->addForeignKey( + 'fk_order_status_history_status', + self::TABLE_NAME, + 'status_id', + 'marketplace_order_status_types', + 'id', + 'RESTRICT', + 'CASCADE' + ); + + $this->addForeignKey( + 'fk_order_status_history_substatus', + self::TABLE_NAME, + 'substatus_id', + 'marketplace_order_status_types', + 'id', + 'SET NULL', + 'CASCADE' + ); + } + } + + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema)) { + $this->dropTable(self::TABLE_NAME); + } + } +} diff --git a/erp24/migrations/m250219_082141_create_marketplace_order_delivery_table.php b/erp24/migrations/m250219_082141_create_marketplace_order_delivery_table.php new file mode 100644 index 00000000..6c1e0f18 --- /dev/null +++ b/erp24/migrations/m250219_082141_create_marketplace_order_delivery_table.php @@ -0,0 +1,59 @@ +db->getTableSchema(self::TABLE_NAME); + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->bigPrimaryKey()->comment('ID записи'), + 'order_id' => $this->bigInteger()->notNull()->comment('Ссылка на заказ'), + 'type' => $this->string(32)->notNull()->comment('Тип доставки'), + 'service_name' => $this->string(64)->notNull()->comment('Название службы доставки'), + 'partner_type' => $this->string(32)->notNull()->comment('Тип партнера доставки'), + 'country' => $this->string(64)->notNull()->comment('Страна'), + 'postcode' => $this->string(16)->notNull()->comment('Индекс'), + 'city' => $this->string(128)->notNull()->comment('Город'), + 'street' => $this->string(255)->notNull()->comment('Улица'), + 'house' => $this->string(16)->notNull()->comment('Дом'), + 'apartment' => $this->string(16)->null()->comment('Квартира'), + 'latitude' => $this->decimal(10, 6)->notNull()->comment('Широта'), + 'longitude' => $this->decimal(10, 6)->notNull()->comment('Долгота'), + 'delivery_start' => $this->dateTime()->null()->comment('Начало периода доставки'), + 'delivery_end' => $this->dateTime()->null()->comment('Конец периода доставки'), + 'courier_full_name' => $this->string(255)->null()->comment('ФИО курьера'), + 'courier_phone' => $this->string(32)->null()->comment('Телефон курьера'), + 'courier_extension' => $this->string(16)->null()->comment('Дополнительный номер курьера'), + 'courier_vehicle_number' => $this->string(32)->null()->comment('Номер автомобиля курьера'), + 'courier_vehicle_description' => $this->string(255)->null()->comment('Описание автомобиля курьера'), + ]); + + $this->addForeignKey( + 'fk_order_delivery_order', + self::TABLE_NAME, + 'order_id', + 'marketplace_orders', + 'id', + 'SET NULL', + 'CASCADE' + ); + } + } + + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema)) { + $this->dropTable(self::TABLE_NAME); + } + } +} diff --git a/erp24/records/MarketplaceOrderDelivery.php b/erp24/records/MarketplaceOrderDelivery.php new file mode 100644 index 00000000..2562101c --- /dev/null +++ b/erp24/records/MarketplaceOrderDelivery.php @@ -0,0 +1,105 @@ + null], + [['order_id', 'type', 'service_name', 'partner_type', 'country', 'postcode', 'city', 'street', 'house', 'latitude', 'longitude'], 'required'], + [['order_id'], 'default', 'value' => null], + [['order_id'], 'integer'], + [['latitude', 'longitude'], 'number'], + [['delivery_start', 'delivery_end'], 'safe'], + [['type', 'partner_type', 'courier_phone', 'courier_vehicle_number'], 'string', 'max' => 32], + [['service_name', 'country'], 'string', 'max' => 64], + [['postcode', 'house', 'apartment', 'courier_extension'], 'string', 'max' => 16], + [['city'], 'string', 'max' => 128], + [['street', 'courier_full_name', 'courier_vehicle_description'], 'string', 'max' => 255], + [['order_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrders::class, 'targetAttribute' => ['order_id' => 'id']], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID записи', + 'order_id' => 'Ссылка на заказ', + 'type' => 'Тип доставки', + 'service_name' => 'Название службы доставки', + 'partner_type' => 'Тип партнера доставки', + 'country' => 'Страна', + 'postcode' => 'Индекс', + 'city' => 'Город', + 'street' => 'Улица', + 'house' => 'Дом', + 'apartment' => 'Квартира', + 'latitude' => 'Широта', + 'longitude' => 'Долгота', + 'delivery_start' => 'Начало периода доставки', + 'delivery_end' => 'Конец периода доставки', + 'courier_full_name' => 'ФИО курьера', + 'courier_phone' => 'Телефон курьера', + 'courier_extension' => 'Дополнительный номер курьера', + 'courier_vehicle_number' => 'Номер автомобиля курьера', + 'courier_vehicle_description' => 'Описание автомобиля курьера', + ]; + } + + /** + * Gets query for [[Order]]. + * + * @return \yii\db\ActiveQuery + */ + public function getOrder() + { + return $this->hasOne(MarketplaceOrders::class, ['id' => 'order_id']); + } + +} diff --git a/erp24/records/MarketplaceOrderDeliverySearch.php b/erp24/records/MarketplaceOrderDeliverySearch.php new file mode 100644 index 00000000..c95d0c7b --- /dev/null +++ b/erp24/records/MarketplaceOrderDeliverySearch.php @@ -0,0 +1,88 @@ +load()` method. + * + * @return ActiveDataProvider + */ + public function search($params, $formName = null) + { + $query = MarketplaceOrderDelivery::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params, $formName); + + 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; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'order_id' => $this->order_id, + 'latitude' => $this->latitude, + 'longitude' => $this->longitude, + 'delivery_start' => $this->delivery_start, + 'delivery_end' => $this->delivery_end, + ]); + + $query->andFilterWhere(['ilike', 'type', $this->type]) + ->andFilterWhere(['ilike', 'service_name', $this->service_name]) + ->andFilterWhere(['ilike', 'partner_type', $this->partner_type]) + ->andFilterWhere(['ilike', 'country', $this->country]) + ->andFilterWhere(['ilike', 'postcode', $this->postcode]) + ->andFilterWhere(['ilike', 'city', $this->city]) + ->andFilterWhere(['ilike', 'street', $this->street]) + ->andFilterWhere(['ilike', 'house', $this->house]) + ->andFilterWhere(['ilike', 'apartment', $this->apartment]) + ->andFilterWhere(['ilike', 'courier_full_name', $this->courier_full_name]) + ->andFilterWhere(['ilike', 'courier_phone', $this->courier_phone]) + ->andFilterWhere(['ilike', 'courier_extension', $this->courier_extension]) + ->andFilterWhere(['ilike', 'courier_vehicle_number', $this->courier_vehicle_number]) + ->andFilterWhere(['ilike', 'courier_vehicle_description', $this->courier_vehicle_description]); + + return $dataProvider; + } +} diff --git a/erp24/records/MarketplaceOrderStatusHistory.php b/erp24/records/MarketplaceOrderStatusHistory.php new file mode 100644 index 00000000..91230b82 --- /dev/null +++ b/erp24/records/MarketplaceOrderStatusHistory.php @@ -0,0 +1,101 @@ + null], + [['active'], 'default', 'value' => 1], + [['order_id', 'status_id', 'substatus_id', 'date_from'], 'required'], + [['order_id', 'status_id', 'substatus_id', 'active'], 'default', 'value' => null], + [['order_id', 'status_id', 'substatus_id', 'active'], 'integer'], + [['date_from', 'date_end'], 'safe'], + [['initiator'], 'string'], + [['status_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrderStatusTypes::class, 'targetAttribute' => ['status_id' => 'id']], + [['substatus_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrderStatusTypes::class, 'targetAttribute' => ['substatus_id' => 'id']], + [['order_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrders::class, 'targetAttribute' => ['order_id' => 'id']], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID записи', + 'order_id' => 'Ссылка на заказ', + 'status_id' => 'Ссылка на тип статуса', + 'substatus_id' => 'Ссылка на подстатус', + 'active' => 'Активность записи', + 'date_from' => 'Дата и время начала активности', + 'date_end' => 'Дата и время окончания активности', + 'initiator' => 'Инициатор изменения', + ]; + } + + /** + * Gets query for [[Order]]. + * + * @return \yii\db\ActiveQuery + */ + public function getOrder() + { + return $this->hasOne(MarketplaceOrders::class, ['id' => 'order_id']); + } + + /** + * Gets query for [[Status]]. + * + * @return \yii\db\ActiveQuery + */ + public function getStatus() + { + return $this->hasOne(MarketplaceOrderStatusTypes::class, ['id' => 'status_id']); + } + + /** + * Gets query for [[Substatus]]. + * + * @return \yii\db\ActiveQuery + */ + public function getSubstatus() + { + return $this->hasOne(MarketplaceOrderStatusTypes::class, ['id' => 'substatus_id']); + } + +} diff --git a/erp24/records/MarketplaceOrderStatusHistorySearch.php b/erp24/records/MarketplaceOrderStatusHistorySearch.php new file mode 100644 index 00000000..779c9f7f --- /dev/null +++ b/erp24/records/MarketplaceOrderStatusHistorySearch.php @@ -0,0 +1,75 @@ +load()` method. + * + * @return ActiveDataProvider + */ + public function search($params, $formName = null) + { + $query = MarketplaceOrderStatusHistory::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params, $formName); + + 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; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'order_id' => $this->order_id, + 'status_id' => $this->status_id, + 'substatus_id' => $this->substatus_id, + 'active' => $this->active, + 'date_from' => $this->date_from, + 'date_end' => $this->date_end, + ]); + + $query->andFilterWhere(['ilike', 'initiator', $this->initiator]); + + return $dataProvider; + } +} diff --git a/erp24/records/MarketplaceOrderStatusTypes.php b/erp24/records/MarketplaceOrderStatusTypes.php new file mode 100644 index 00000000..94076309 --- /dev/null +++ b/erp24/records/MarketplaceOrderStatusTypes.php @@ -0,0 +1,76 @@ + null], + [['code'], 'required'], + [['code'], 'string', 'max' => 64], + [['name', 'description'], 'string', 'max' => 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID статуса', + 'code' => 'Код статуса', + 'name' => 'Название статуса', + 'description' => 'Описание статуса', + ]; + } + + /** + * Gets query for [[MarketplaceOrderStatusHistories]]. + * + * @return \yii\db\ActiveQuery + */ + public function getMarketplaceOrderStatusHistories() + { + return $this->hasMany(MarketplaceOrderStatusHistory::class, ['status_id' => 'id']); + } + + /** + * Gets query for [[MarketplaceOrderStatusHistories0]]. + * + * @return \yii\db\ActiveQuery + */ + public function getMarketplaceOrderStatusHistories0() + { + return $this->hasMany(MarketplaceOrderStatusHistory::class, ['substatus_id' => 'id']); + } + +} diff --git a/erp24/records/MarketplaceOrderStatusTypesSearch.php b/erp24/records/MarketplaceOrderStatusTypesSearch.php new file mode 100644 index 00000000..5c59b197 --- /dev/null +++ b/erp24/records/MarketplaceOrderStatusTypesSearch.php @@ -0,0 +1,71 @@ +load()` method. + * + * @return ActiveDataProvider + */ + public function search($params, $formName = null) + { + $query = MarketplaceOrderStatusTypes::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params, $formName); + + 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; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['ilike', 'code', $this->code]) + ->andFilterWhere(['ilike', 'name', $this->name]) + ->andFilterWhere(['ilike', 'description', $this->description]); + + return $dataProvider; + } +} diff --git a/erp24/records/MarketplaceOrders.php b/erp24/records/MarketplaceOrders.php new file mode 100644 index 00000000..626c5e60 --- /dev/null +++ b/erp24/records/MarketplaceOrders.php @@ -0,0 +1,109 @@ + null], + [['cancel_requested'], 'default', 'value' => 0], + [['status_1c'], 'default', 'value' => 1], + [['marketplace_id', 'creation_date', 'updated_at', 'total', 'delivery_total', 'buyer_total_before_discount', 'tax_system', 'payment_type', 'payment_method'], 'required'], + [['status_history_id', 'cancel_requested', 'status_1c'], 'default', 'value' => null], + [['status_history_id', 'cancel_requested', 'status_1c'], 'integer'], + [['creation_date', 'updated_at'], 'safe'], + [['total', 'delivery_total', 'buyer_total_before_discount'], 'number'], + [['raw_data'], 'string'], + [['marketplace_id'], 'string', 'max' => 64], + [['store_id', 'guid'], 'string', 'max' => 36], + [['tax_system', 'payment_type', 'payment_method'], 'string', 'max' => 32], + [['marketplace_id'], 'unique'], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID заказа', + 'marketplace_id' => 'ID заказа в системе маркетплейса', + 'store_id' => 'Идентификатор склада/магазина', + 'status_history_id' => 'Ссылка на текущий активный статус', + 'creation_date' => 'Дата создания заказа', + 'updated_at' => 'Время последнего обновления', + 'total' => 'Итоговая сумма к оплате', + 'delivery_total' => 'Стоимость доставки', + 'buyer_total_before_discount' => 'Сумма до скидок', + 'tax_system' => 'Система налогообложения', + 'payment_type' => 'Тип платежа', + 'payment_method' => 'Метод оплаты', + 'cancel_requested' => 'Флаг запроса отмены', + 'raw_data' => 'Полный сырой ответ API', + 'guid' => 'GUID заказа в 1С', + 'status_1c' => 'Статус заказа в 1С', + ]; + } + + /** + * Gets query for [[MarketplaceOrderDeliveries]]. + * + * @return \yii\db\ActiveQuery + */ + public function getMarketplaceOrderDeliveries() + { + return $this->hasMany(MarketplaceOrderDelivery::class, ['order_id' => 'id']); + } + + /** + * Gets query for [[MarketplaceOrderStatusHistories]]. + * + * @return \yii\db\ActiveQuery + */ + public function getMarketplaceOrderStatusHistories() + { + return $this->hasMany(MarketplaceOrderStatusHistory::class, ['order_id' => 'id']); + } + +} diff --git a/erp24/records/MarketplaceOrdersSearch.php b/erp24/records/MarketplaceOrdersSearch.php new file mode 100644 index 00000000..2f0a0f85 --- /dev/null +++ b/erp24/records/MarketplaceOrdersSearch.php @@ -0,0 +1,84 @@ +load()` method. + * + * @return ActiveDataProvider + */ + public function search($params, $formName = null) + { + $query = MarketplaceOrders::find(); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params, $formName); + + 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; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'status_history_id' => $this->status_history_id, + 'creation_date' => $this->creation_date, + 'updated_at' => $this->updated_at, + 'total' => $this->total, + 'delivery_total' => $this->delivery_total, + 'buyer_total_before_discount' => $this->buyer_total_before_discount, + 'cancel_requested' => $this->cancel_requested, + 'status_1c' => $this->status_1c, + ]); + + $query->andFilterWhere(['ilike', 'marketplace_id', $this->marketplace_id]) + ->andFilterWhere(['ilike', 'store_id', $this->store_id]) + ->andFilterWhere(['ilike', 'tax_system', $this->tax_system]) + ->andFilterWhere(['ilike', 'payment_type', $this->payment_type]) + ->andFilterWhere(['ilike', 'payment_method', $this->payment_method]) + ->andFilterWhere(['ilike', 'raw_data', $this->raw_data]) + ->andFilterWhere(['ilike', 'guid', $this->guid]); + + return $dataProvider; + } +} diff --git a/erp24/views/marketplace-order-delivery/_search.php b/erp24/views/marketplace-order-delivery/_search.php new file mode 100644 index 00000000..827e30df --- /dev/null +++ b/erp24/views/marketplace-order-delivery/_search.php @@ -0,0 +1,65 @@ + + + diff --git a/erp24/views/marketplace-order-delivery/index.php b/erp24/views/marketplace-order-delivery/index.php new file mode 100644 index 00000000..600faef4 --- /dev/null +++ b/erp24/views/marketplace-order-delivery/index.php @@ -0,0 +1,62 @@ +title = 'Marketplace Order Deliveries'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ 'btn btn-success']) ?> +

+ + render('_search', ['model' => $searchModel]); ?> + + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'order_id', + 'type', + 'service_name', + 'partner_type', + //'country', + //'postcode', + //'city', + //'street', + //'house', + //'apartment', + //'latitude', + //'longitude', + //'delivery_start', + //'delivery_end', + //'courier_full_name', + //'courier_phone', + //'courier_extension', + //'courier_vehicle_number', + //'courier_vehicle_description', + [ + 'class' => ActionColumn::className(), + 'urlCreator' => function ($action, MarketplaceOrderDelivery $model, $key, $index, $column) { + return Url::toRoute([$action, 'id' => $model->id]); + } + ], + ], + ]); ?> + + +
diff --git a/erp24/views/marketplace-order-delivery/view.php b/erp24/views/marketplace-order-delivery/view.php new file mode 100644 index 00000000..91a90ae6 --- /dev/null +++ b/erp24/views/marketplace-order-delivery/view.php @@ -0,0 +1,55 @@ +title = $model->id; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Deliveries', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'order_id', + 'type', + 'service_name', + 'partner_type', + 'country', + 'postcode', + 'city', + 'street', + 'house', + 'apartment', + 'latitude', + 'longitude', + 'delivery_start', + 'delivery_end', + 'courier_full_name', + 'courier_phone', + 'courier_extension', + 'courier_vehicle_number', + 'courier_vehicle_description', + ], + ]) ?> + +
diff --git a/erp24/views/marketplace-order-status-history/_search.php b/erp24/views/marketplace-order-status-history/_search.php new file mode 100644 index 00000000..52126764 --- /dev/null +++ b/erp24/views/marketplace-order-status-history/_search.php @@ -0,0 +1,41 @@ + + + diff --git a/erp24/views/marketplace-order-status-history/index.php b/erp24/views/marketplace-order-status-history/index.php new file mode 100644 index 00000000..9be5c4dd --- /dev/null +++ b/erp24/views/marketplace-order-status-history/index.php @@ -0,0 +1,50 @@ +title = 'Marketplace Order Status Histories'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ 'btn btn-success']) ?> +

+ + render('_search', ['model' => $searchModel]); ?> + + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'order_id', + 'status_id', + 'substatus_id', + 'active', + //'date_from', + //'date_end', + //'initiator:ntext', + [ + 'class' => ActionColumn::className(), + 'urlCreator' => function ($action, MarketplaceOrderStatusHistory $model, $key, $index, $column) { + return Url::toRoute([$action, 'id' => $model->id]); + } + ], + ], + ]); ?> + + +
diff --git a/erp24/views/marketplace-order-status-history/view.php b/erp24/views/marketplace-order-status-history/view.php new file mode 100644 index 00000000..77911149 --- /dev/null +++ b/erp24/views/marketplace-order-status-history/view.php @@ -0,0 +1,43 @@ +title = $model->id; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Histories', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'order_id', + 'status_id', + 'substatus_id', + 'active', + 'date_from', + 'date_end', + 'initiator:ntext', + ], + ]) ?> + +
diff --git a/erp24/views/marketplace-order-status-types/_form.php b/erp24/views/marketplace-order-status-types/_form.php new file mode 100644 index 00000000..0bd8e41b --- /dev/null +++ b/erp24/views/marketplace-order-status-types/_form.php @@ -0,0 +1,27 @@ + + +
+ + + + field($model, 'code')->textInput(['maxlength' => true]) ?> + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'description')->textInput(['maxlength' => true]) ?> + +
+ 'btn btn-success']) ?> +
+ + + +
diff --git a/erp24/views/marketplace-order-status-types/_search.php b/erp24/views/marketplace-order-status-types/_search.php new file mode 100644 index 00000000..3095edd6 --- /dev/null +++ b/erp24/views/marketplace-order-status-types/_search.php @@ -0,0 +1,33 @@ + + + diff --git a/erp24/views/marketplace-order-status-types/create.php b/erp24/views/marketplace-order-status-types/create.php new file mode 100644 index 00000000..b1e08818 --- /dev/null +++ b/erp24/views/marketplace-order-status-types/create.php @@ -0,0 +1,20 @@ +title = 'Создание статуса заказа'; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ 'btn btn-primary m-5']) ?> +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/erp24/views/marketplace-order-status-types/index.php b/erp24/views/marketplace-order-status-types/index.php new file mode 100644 index 00000000..e52728e0 --- /dev/null +++ b/erp24/views/marketplace-order-status-types/index.php @@ -0,0 +1,46 @@ +title = 'Статусы заказов Яндекс Маркет'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ 'btn btn-success']) ?> +

+ + render('_search', ['model' => $searchModel]); ?> + + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'code', + 'name', + 'description', + [ + 'class' => ActionColumn::class, + 'urlCreator' => function ($action, MarketplaceOrderStatusTypes $model, $key, $index, $column) { + return Url::toRoute([$action, 'id' => $model->id]); + } + ], + ], + ]); ?> + + +
diff --git a/erp24/views/marketplace-order-status-types/update.php b/erp24/views/marketplace-order-status-types/update.php new file mode 100644 index 00000000..468fe5e3 --- /dev/null +++ b/erp24/views/marketplace-order-status-types/update.php @@ -0,0 +1,21 @@ +title = 'Изменение статуса заказа: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update'; +?> +
+ 'btn btn-primary m-5']) ?> +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/erp24/views/marketplace-order-status-types/view.php b/erp24/views/marketplace-order-status-types/view.php new file mode 100644 index 00000000..95976e06 --- /dev/null +++ b/erp24/views/marketplace-order-status-types/view.php @@ -0,0 +1,39 @@ +title = 'Статусы заказа' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ 'btn btn-primary m-5']) ?> +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Удалить статус?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'code', + 'name', + 'description', + ], + ]) ?> + +
diff --git a/erp24/views/marketplace-orders/_search.php b/erp24/views/marketplace-orders/_search.php new file mode 100644 index 00000000..6765db5e --- /dev/null +++ b/erp24/views/marketplace-orders/_search.php @@ -0,0 +1,57 @@ + + + diff --git a/erp24/views/marketplace-orders/index.php b/erp24/views/marketplace-orders/index.php new file mode 100644 index 00000000..6702300f --- /dev/null +++ b/erp24/views/marketplace-orders/index.php @@ -0,0 +1,58 @@ +title = 'Marketplace Orders'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ 'btn btn-success']) ?> +

+ + render('_search', ['model' => $searchModel]); ?> + + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'marketplace_id', + 'store_id', + 'status_history_id', + 'creation_date', + //'updated_at', + //'total', + //'delivery_total', + //'buyer_total_before_discount', + //'tax_system', + //'payment_type', + //'payment_method', + //'cancel_requested', + //'raw_data:ntext', + //'guid', + //'status_1c', + [ + 'class' => ActionColumn::className(), + 'urlCreator' => function ($action, MarketplaceOrders $model, $key, $index, $column) { + return Url::toRoute([$action, 'id' => $model->id]); + } + ], + ], + ]); ?> + + +
diff --git a/erp24/views/marketplace-orders/view.php b/erp24/views/marketplace-orders/view.php new file mode 100644 index 00000000..9781711b --- /dev/null +++ b/erp24/views/marketplace-orders/view.php @@ -0,0 +1,51 @@ +title = $model->id; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Orders', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'marketplace_id', + 'store_id', + 'status_history_id', + 'creation_date', + 'updated_at', + 'total', + 'delivery_total', + 'buyer_total_before_discount', + 'tax_system', + 'payment_type', + 'payment_method', + 'cancel_requested', + 'raw_data:ntext', + 'guid', + 'status_1c', + ], + ]) ?> + +
-- 2.39.5