<?php
+use yii_app\records\Products1c;
+use yii\helpers\ArrayHelper;
+use yii_app\records\StorePlanogram;
+use yii_app\records\StorePlanogramLogi;
+
include_once(dirname(__DIR__, 2) . "/startup.php");
include_once(dirname(__DIR__, 2) . "/inc/db.php");
include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
</p><div id=editDiv></div>';
-
-$storesAll=$db::mapping("SELECT name,id FROM products_1c WHERE tip='city_store' order by name ASC");
+$storesAll = ArrayHelper::map(Products1c::find()->select(['name', 'id'])->where(['tip' => 'city_store'])
+ ->orderBy(['name' => SORT_ASC])->all(), 'id', 'name');
+//$storesAll=$db::mapping("SELECT name,id FROM products_1c WHERE tip='city_store' order by name ASC");
<table class="table">';
echo'<tbody>';
-
- $dataRow=$db::getRow("SELECT * FROM store_planogram WHERE store_id=? AND product_id=? AND color=''",[$store_id,$product_id]);
+ $dataRow = StorePlanogram::find()->where(['store_id' => $store_id, 'product_id' => $product_id, 'color' => ''])->one();
+// $dataRow=$db::getRow("SELECT * FROM store_planogram WHERE store_id=? AND product_id=? AND color=''",[$store_id,$product_id]);
echo'<tr><td>сейчас</td><td>'.$dataRow["quantity"].'</td><td>'.$dataRow["quantity_max"].'</td><td>'.$dataRow["color"].'</td></tr>';
- $data=$db::getRows("SELECT * FROM store_planogram_logi WHERE store_id=? AND product_id=? order by date_id DESC, color ASC",[$store_id,$product_id]);
+ $data = StorePlanogramLogi::find()->where(['store_id' => $store_id, 'product_id' => $product_id])
+ ->orderBy(['date_id' => SORT_DESC, 'color' => SORT_ASC])->asArray()->all();
+// $data=$db::getRows("SELECT * FROM store_planogram_logi WHERE store_id=? AND product_id=? order by date_id DESC, color ASC",[$store_id,$product_id]);
foreach($data as $row) {