]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
move /shipment/fields to erp
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 7 Dec 2023 16:12:44 +0000 (19:12 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 7 Dec 2023 16:12:44 +0000 (19:12 +0300)
erp24/actions/shipment/FieldsAction.php [new file with mode: 0644]
erp24/controllers/ShipmentController.php
erp24/inc/db.php
erp24/views/shipment/fields.php [new file with mode: 0644]

diff --git a/erp24/actions/shipment/FieldsAction.php b/erp24/actions/shipment/FieldsAction.php
new file mode 100644 (file)
index 0000000..8bbd1ba
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+namespace yii_app\actions\shipment;
+
+use yii\base\Action;
+
+class FieldsAction extends Action
+{
+    public function run() {
+        return $this->controller->render('fields');
+    }
+}
\ No newline at end of file
index 25db9563e790f0840c312b65eb760c17a1bcb23d..2d968c7322698643cec8a5871722a66bd92b994d 100755 (executable)
@@ -11,6 +11,7 @@ class ShipmentController extends \yii\web\Controller
         return [
             'index' => \yii_app\actions\shipment\IndexAction::class,
             'add' => \yii_app\actions\shipment\AddAction::class,
+            'fields' => \yii_app\actions\shipment\FieldsAction::class,
             'fields-data' => \yii_app\actions\shipment\FieldsDataAction::class,
             'ajax-update-fields-data-test' => \yii_app\actions\shipment\AjaxUpdateFieldsDataTestAction::class,
             'division-print-edit' => \yii_app\actions\shipment\DivisionPrintEditAction::class,
index 46f2701e52c58d1bc1cd106f670fb9ba6e394904..4f56a612a8e777a1c7bdf705a502146b903527b5 100644 (file)
@@ -144,19 +144,20 @@ protected $config = '';
    * @return array
    */
   public static function getColumn($query, $args = [])  {
-       $GLOBALS["sql_cnt"]++;
+      $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;
     return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
   }
   
  public static function getCol($query, $args = [])  {
-      $GLOBALS["sql_cnt"]++;
+     $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;
     return self::run($query, $args)->fetch(PDO::FETCH_NAMED);
   }  
   
 
   
   public static function sql($query, $args = [])
-  { $GLOBALS["sql_cnt"]++;
+  {
+      $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;
     self::run($query, $args);
   }
   
@@ -179,7 +180,7 @@ protected $config = '';
   {  
       $ret_arr=array();
       $data= self::run($query, $args)->fetchAll();
-      $GLOBALS["sql_cnt"]++;
+      $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;;
       foreach($data as $row) $ret_arr[$row["id"]]=$row["name"];  
       return  $ret_arr;  
   }
diff --git a/erp24/views/shipment/fields.php b/erp24/views/shipment/fields.php
new file mode 100644 (file)
index 0000000..b9eb340
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/design_new.php");
+
+//include"templates/top.php";
+
+//if($_SESSION["group_id"]>2) exit("У вас нет доступа");
+
+$roles=$db::mapping("SELECT id, name FROM admin_group WHERE id=7 or id=30 or id=17 or id=70 or id=71  or id=9  or id=51 or id=1 or id=10");
+
+echo "<div class='m-5'>";
+
+echo'<h1 class="page-title mb-0 text-primary">Настройка статусов в заказе у поставщиков кто может ставить статусы</h1>';
+
+
+if(!empty($_POST["save"])){
+
+    foreach($_POST["description"] as $idr => $val) {
+
+        $db::sql("UPDATE store_orders_fields SET description=? WHERE id=?",[$val,$idr]);
+
+    }
+
+
+}
+
+$data=$db::getRows("SELECT id, dostup FROM `store_orders_statuses` WHERE 1");
+foreach($data as $row) {
+    $dostup[$row["id"]] = json_decode($row["dostup"], true);
+
+}
+
+
+echo'<form method=post action="/shipment/fields/">';
+?><input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" /><?php
+
+
+$data=$db::getRows("SELECT * FROM store_orders_fields");
+echo'<table class="table table-hover"><thead><th width=100>название кратко</th>
+<th>name_eng</th>
+<th>SQL таблица сохранения</th>
+
+<th>тип</th>
+<th>тип данных</th>
+
+<th>сумма по столбцу</th>
+<th>сохраняем цвета в ячейке</th>
+
+
+</thead><tbody>';
+foreach($data as $row) {
+
+    echo"
+    <tr><td><b>".$row["name"]."<b><br>
+    <small>".$row["name_full"]."</small></td>
+     
+    
+    <td>".$row["name_eng"]."</td>
+    <td>".$row["sql_table_values"]."</td>
+    <td>".$row["type"]."";
+
+    if(in_array($row["type"],array("multiplication","avg","difference")))
+        echo"   <input type=text class=\"form-control\" name=func_content[".$row["id"]."] value=\"".$row["func_content"]."\">";
+
+    echo"</td>
+     <td>".$row["tip"]."</td>   
+   
+           <td>"; if($row["summ"]) echo"да"; echo"</td> 
+             <td>"; if($row["colors_save"]) echo"да"; echo"</td>   
+    </tr><tr><td colspan=7><textarea class=\"form-control\" name=description[".$row["id"]."] rows=1>".$row["description"]."</textarea></td></tr>";
+    /*
+       echo'<tr><td colspan=7><table>';
+       foreach($statuses as $gid => $name) {
+       if(!empty($roles[$gid])) {
+
+           echo"<tr><td class=\"text-right\">".$name."</td><td style=\"min-width:300px\"> ";
+
+        //   $dostup[$status_id]
+
+         echo' </td></tr>';
+
+
+
+       }
+      }
+      echo'</table></td></tr>';
+      */
+
+}
+echo'</tbody></table><button class="btn btn-success" name="save" value=1>сохранить</button></div></form>';
+
+echo "</div>";
+
+//include"templates/bottom.php";
+
+
+
+
+
+