]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix part 002
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 20 May 2024 14:32:51 +0000 (17:32 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 20 May 2024 14:32:51 +0000 (17:32 +0300)
erp24/modul/shipment/fields/quantity_fact.php

index acd21eace7385617c8a1a110cfddeda20ed79d74..5b8bafbdfd1f8434a24c8206ac6a507ea10d063b 100644 (file)
@@ -1,11 +1,17 @@
-<?
+<?php
+
+global $orderStoresArrayRelation_in, $whereInProductsId, $data_up;
+
 $date_id=$db::getValue("SELECT date_id FROM store_products_fact order by date_id DESC LIMIT 1");
 
-$store_products_fact=$db::getRows("SELECT product_id,quantity, store_id,color FROM store_products_fact WHERE quantity>0 
+if ($whereInProductsId != " in ()") {
+    $store_products_fact = $db::getRows("SELECT product_id,quantity, store_id,color FROM store_products_fact WHERE quantity>0 
 AND date_id=? 
 AND store_id $orderStoresArrayRelation_in
-AND product_id $whereInProductsId",[$date_id]);
-foreach($store_products_fact as $row) {
-   $data_up[$row["product_id"]][$row["store_id"]][$row["color"]] +=$row["quantity"];
-    $data_up[$row["product_id"]][0][$row["color"]] +=$row["quantity"];    
+AND product_id $whereInProductsId", [$date_id]);
+
+    foreach ($store_products_fact 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