]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
fix
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 20 May 2024 09:52:46 +0000 (12:52 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 20 May 2024 09:52:46 +0000 (12:52 +0300)
12 files changed:
erp24/controllers/ShipmentController.php
erp24/modul/shipment/fields/auto_purchase_formula.php
erp24/modul/shipment/fields/price_zakup_summ.php
erp24/modul/shipment/fields/purchase_price.php
erp24/modul/shipment/fields/purchase_summ.php
erp24/modul/shipment/fields/quantity.php
erp24/modul/shipment/fields/quantity_storage.php
erp24/modul/shipment/fields/scheduled_delivery_cnt.php
erp24/modul/shipment/fields/storehouse_balance.php
erp24/modul/shipment/shipment.php
erp24/modul/shipment/statusFieldsSort.php
erp24/views/shipment/status-fields-sort.php [new file with mode: 0644]

index 188e20c75247d8fcc49142679a0863d6df3944fa..b4998cee552f2e7c148e7c5cd1a0f56f4d6e4e59 100755 (executable)
@@ -32,4 +32,5 @@ class ShipmentController extends Controller
     public function actionPolnogramm() { return $this->render('polnogramm'); }
     public function actionAjaxUpdateStoreZakup() { return $this->renderPartial('ajax-update-store-zakup'); }
     public function actionAjaxUpdateStep() { return $this->renderPartial('ajax-update-step'); }
+    public function actionStatusFieldsSort() { return $this->render('status-fields-sort'); }
 }
\ No newline at end of file
index 36de484e46b6081525069a3bfd7f7477fbbed3a4..3c85c0db768174a25a70b488c8f830fe7612e83c 100644 (file)
@@ -1,4 +1,7 @@
-<?
+<?php
+
+global $orderId, $products, $orderStoresArrayRelation, $storesOrderArray;
+
 // округляет до определенного числа
 function ceilCoef($number, $rate = 1)
 {
@@ -21,7 +24,7 @@ $FiledsDataArray[$row["field_name"]][$row["product_id"]][$row["store_id"]]=(int)
 
 //print_r($FiledsData);
 $storesArray[0]="Всего";
-foreach($products as $product_id => $name) {
+foreach($products ?? [] as $product_id => $name) {
     
      $min_order  = $FiledsDataArray["min_order"][$product_id][""];   
      $min_lot=$FiledsDataArray["min_lot"][$product_id][""]; 
index 34b22816cd3bc88573fada36e4a40214a6713950..d3c37b7c9026224f36cc722371c385b06bf35940 100644 (file)
@@ -1,17 +1,20 @@
-<?
+<?php
+
+global $FiledsDataArray, $orderId, $products, $data_up;
+
 $FiledsDataArray=[];
 $dataF=$db::getRows("SELECT field_name, product_id, value
 FROM store_orders_fields_data 
 WHERE order_id=? AND color='' AND store_id=''
 AND field_name IN ('purchase_price_zakup','quantity_zakup_fact')",[$orderId]);
-foreach($dataF as $row) { 
-  $FiledsDataArray[$row["field_name"]][$row["product_id"]]=$row["value"];
-}
 
+foreach($dataF as $row) {
+    $FiledsDataArray[$row["field_name"]][$row["product_id"]]=$row["value"];
+}
 
-foreach($products as $product_id => $name){
-           $data_up[$product_id][0][0] = round($FiledsDataArray["purchase_price_zakup"][$product_id] * $FiledsDataArray["quantity_zakup_fact"][$product_id],2);
 
-}  
+foreach($products ?? [] as $product_id => $name){
+    $data_up[$product_id][0][0] = round($FiledsDataArray["purchase_price_zakup"][$product_id] * $FiledsDataArray["quantity_zakup_fact"][$product_id],2);
+}
 
 
index e2b7cfbdf453e8442ca8db4209033525703ac418..de74b54f08ec94fedb471d1049b51da8007eb073 100644 (file)
@@ -1,7 +1,13 @@
-<?
+<?php
 
-$data=$db::getRows("SELECT product_id, price FROM prices WHERE product_id $whereInProductsId");    
-  foreach($data as $row)  {
-     // $prices[$row["product_id"]]=$row["price"]; 
-      $data_up[$row["product_id"]][0][0]=$row["price"]; 
-  }      
\ No newline at end of file
+global $whereInProductsId, $data_up;
+
+if ($whereInProductsId != " in ()") {
+    $sql = "SELECT product_id, price FROM prices WHERE product_id $whereInProductsId";
+    $data = $db::getRows($sql);
+
+    foreach ($data as $row) {
+        // $prices[$row["product_id"]]=$row["price"];
+        $data_up[$row["product_id"]][0][0] = $row["price"];
+    }
+}
\ No newline at end of file
index e17f955cdf1e067ce56d65ab241b713ff390df68..b129cb235ee8d2bd769d58f847368ae055b8c110 100644 (file)
@@ -12,7 +12,7 @@ foreach($dataF as $row) {
 }
 
 
-foreach($products as $product_id => $name){
+foreach($products ?? [] as $product_id => $name){
      // розничная цена в рублях на сумму закупки по факту закупщиком
            $data_up[$product_id][0][0] = round($FiledsDataArray["purchase_price"][$product_id] * $FiledsDataArray["quantity_zakup_fact"][$product_id]);
 
index 904a22e69feeb19d2d4e8d33b1bed52f7174dcd0..9d067797c72f50cbf9e8ad852fd575f8c089bec9 100644 (file)
@@ -1,9 +1,16 @@
-<?
-$store_planogram=$db::getRows("SELECT product_id,quantity, store_id,color
+<?php
+
+global $whereInProductsId, $orderStoresArrayRelation_in, $data_up;
+
+if ($whereInProductsId != " in ()") {
+    $sql = "SELECT product_id,quantity, store_id,color
 FROM store_planogram WHERE quantity>0 
 AND product_id  $whereInProductsId
-AND store_id $orderStoresArrayRelation_in group by product_id, color, store_id");
- foreach($store_planogram as $row) {
-    $data_up[$row["product_id"]][$row["store_id"]][$row["color"]] +=$row["quantity"];
-    $data_up[$row["product_id"]][0][$row["color"]] +=$row["quantity"];    
-    }
\ No newline at end of file
+AND store_id $orderStoresArrayRelation_in group by product_id, color, store_id, quantity";
+    $store_planogram = $db::getRows($sql);
+
+    foreach ($store_planogram as $row) {
+        $data_up[$row["product_id"]][$row["store_id"]][$row["color"]] = ($data_up[$row["product_id"]][$row["store_id"]][$row["color"]] ?? 0) + $row["quantity"];
+        $data_up[$row["product_id"]][0][$row["color"]] = ($data_up[$row["product_id"]][0][$row["color"]] ?? 0) + $row["quantity"];
+    }
+}
\ No newline at end of file
index b6ffdeb872b6eb312f32f7303762a466dfdfd0b0..f0c1d14822bfcb37ddd27fadf868b044e8c6a451 100644 (file)
@@ -2,10 +2,12 @@
 
 global $whereInProductsId, $orderStoresArrayRelation_in, $data_up;
 
-$data2=$db::getRows("SELECT product_id,store_id,quantity FROM balances WHERE quantity>0 
+if ($whereInProductsId != " in ()") {
+    $data2 = $db::getRows("SELECT product_id,store_id,quantity FROM balances WHERE quantity>0 
 AND  product_id $whereInProductsId 
 AND store_id $orderStoresArrayRelation_in");
-foreach($data2 as $row2) {
-$data_up[$row2["product_id"]][$row2["store_id"]][0] = ($data_up[$row2["product_id"]][$row2["store_id"]][0] ?? 0) + $row2["quantity"];
-$data_up[$row2["product_id"]][0][0] = ($data_up[$row2["product_id"]][0][0] ?? 0) + $row2["quantity"];
+    foreach ($data2 as $row2) {
+        $data_up[$row2["product_id"]][$row2["store_id"]][0] = ($data_up[$row2["product_id"]][$row2["store_id"]][0] ?? 0) + $row2["quantity"];
+        $data_up[$row2["product_id"]][0][0] = ($data_up[$row2["product_id"]][0][0] ?? 0) + $row2["quantity"];
+    }
 }
\ No newline at end of file
index 18047680d393aad29d08acc37f96711a78ab48a4..c6c6ad884163fc51b9c99cc47df64e40e457bc78 100644 (file)
@@ -16,12 +16,11 @@ foreach($data as $row) {
      $i++;   
 }
 
-if(!empty($whereInOrderId)) {
+if(!empty($whereInOrderId) && $whereInProductsId != " in ()") {
 
 $sql = "SELECT product_id, store_id, value FROM store_orders_fields_data WHERE 
 order_id IN ($whereInOrderId) AND product_id $whereInProductsId 
 AND field_name='quantity_zakup_new' AND color='' AND value>0 group by product_id, store_id, value";
-//var_dump($sql); die;
 $data=$db::getRows($sql);
   foreach($data as $row) {
   $data_up[$row["product_id"]][$row["store_id"]]["0"]=$row["value"];
index b4a55a811cef3088b1b8e1e4fc309bb731e167bb..6664e391724a41b42ba582f672e2beba45f438b0 100644 (file)
@@ -17,7 +17,7 @@ foreach($dataF as $row) {
 
 
 //echo"<h1>Storehouse_balance</h1>";
-foreach($products as $productId => $nameProduct) {
+foreach($products ?? [] as $productId => $nameProduct) {
    // echo"<br>$nameProduct ".$FiledsDataArray["quantity_warehouseman_fact"][$productId][0] ." -  ".$FiledsDataArray["division_store_summ"][$productId][0]."";
    $data_up[$productId][0][0]=$FiledsDataArray["quantity_warehouseman_fact"][$productId][0] -  $FiledsDataArray["division_summ"][$productId][0];
          foreach($productsColorsArray[$productId] ?? [] as $color) {
index 76e265259c5509cedd452f8be9e9b3460bb727a4..9d80f9eed5aedf08fc6e9c71e7300ac00a13d193 100644 (file)
@@ -58,7 +58,7 @@ $html='<thead><tr class="zg"><th class="text-right w-10">наименовани
 <span onclick="ajaxUpdateStoreZakup();" class="btn btn-blue btn-sm me-2">пересчитать данные</span>';
 
 if(in_array($_SESSION["group_id"],[1,11,7])) {
-echo'<a href="/shipment/statusFieldsSort/?status_id='.$status_order_id.'" target=new class="btn btn-sm btn-secondary">сортировка столбцов</a>
+echo'<a href="/shipment/status-fields-sort/?status_id='.$status_order_id.'" target=new class="btn btn-sm btn-secondary">сортировка столбцов</a>
 <a href="/shipment/config/?status_id='.$status_order_id.'" target=new class="btn btn-sm btn-grey">настройка столбцов</a>';
 }
 
@@ -205,7 +205,7 @@ foreach($data as $row) {
 $dostup=$dostup_fields[$row["id"]] ?? '';
 if($dostup=="edit" or $dostup=="show") {   
  $s="";   
-if($fieldsRows[$row["name_eng"]]["row_type_sum"]=="amount")   $s=$rowArraySum[$row["id"]]
+if($fieldsRows[$row["name_eng"]]["row_type_sum"]=="amount")   $s=$rowArraySum[$row["id"]] ?? 0;
 if((($rowArraySum["cnt__".$row["id"]] ?? 0) > 0) && $fieldsRows[$row["name_eng"]]["row_type_sum"]=="avg")   $s=round($rowArraySum[$row["id"]]/$rowArraySum["cnt__".$row["id"]]);
   
 echo'<td class="text-center '.$bg.'"><b>'.$s.'</b></td>';
index bd67d3ed8c221410f9b1c26d0c67778e4df30bec..78601e9d1aff4f77c925d9dbe27684513223e334 100644 (file)
@@ -1,11 +1,9 @@
-<?
-include_once("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
+<?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("inc/design_new.php");
 
-include"templates/top.php";
-
 //if($_SESSION["group_id"]>2) exit("У вас нет доступа");
 
 $statuses=$db::mapping("SELECT id, name FROM store_orders_statuses");
@@ -17,7 +15,7 @@ echo'<h1 class="page-title mb-0 text-primary">Сортировка полей н
 
 $id=(int)$_REQUEST["status_id"];
 foreach($statuses as $id2 => $name) {
- echo'<a href="/shipment/statusFieldsSort/?status_id='.$id2.'" class="btn btn-';
+ echo'<a href="/shipment/status-fields-sort/?status_id='.$id2.'" class="btn btn-';
 if($id2==$id) echo'success'; else echo'info';
  
  echo' m-1">'.$name.'</a>';
@@ -25,9 +23,9 @@ if($id2==$id) echo'success'; else echo'info';
 
 }
 
-echo'<form method=post action="/shipment/statusFieldsSort/?status_id='.$id.'">
-
-<div class="table-responsive">
+echo '<form method=post action="/shipment/status-fields-sort/?status_id='.$id.'">';
+echo '<input type="hidden" name="_csrf" value="' . Yii::$app->request->getCsrfToken() . '" />';
+echo '<div class="table-responsive">
 <table class="table" id="recipeTable"><tbody id=draganddropTable>';
 
 
@@ -71,7 +69,7 @@ $row=$db::getRow("SELECT fields_sort, fields_hide FROM store_orders_statuses WHE
 $fields_hide=explode(",",$row["fields_hide"]);
 $sort=$row["fields_sort"];
 
-if(!empty($sort)) $data3=$db::getRows("SELECT * FROM store_orders_fields ORDER BY      FIELD(`id`, $sort)  ");
+if(!empty($sort)) $data3=$db::getRows("SELECT * FROM store_orders_fields "); // TODO: pgsql sort [[ORDER BY    FIELD(`id`, $sort)]]
 else $data3=$db::getRows("SELECT * FROM store_orders_fields  ");
 
 
@@ -221,7 +219,4 @@ $(document).ready(function () {
 ';
 
 
-include"templates/bottom.php"; 
-       
-
-
+include_once dirname(__DIR__, 2) . '/templates/bottom_light.php';
\ No newline at end of file
diff --git a/erp24/views/shipment/status-fields-sort.php b/erp24/views/shipment/status-fields-sort.php
new file mode 100644 (file)
index 0000000..93e3c47
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/shipment/statusFieldsSort.php';
\ No newline at end of file