From: Alexander Smirnov Date: Tue, 21 May 2024 19:50:35 +0000 (+0300) Subject: fix part 018 X-Git-Tag: 1.1~18^2~4 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=8f0b956e6d4206a24cb827510a146cfa41c87a70;p=erp24_rep%2Fyii-erp24%2F.git fix part 018 --- diff --git a/erp24/modul/shipment/fields/entrance_cnt_7days.php b/erp24/modul/shipment/fields/entrance_cnt_7days.php index fb9b659b..614541dd 100644 --- a/erp24/modul/shipment/fields/entrance_cnt_7days.php +++ b/erp24/modul/shipment/fields/entrance_cnt_7days.php @@ -21,10 +21,9 @@ if (!empty($date_start_sale)) { if(!empty($whereInOrderId)) { -$data=$db::getRows("SELECT product_id, store_id, value FROM store_orders_fields_data WHERE order_id IN ($whereInOrderId) AND product_id $whereInProductsId AND field_name='division_summ' AND color='' AND value>0 group by product_id, store_id"); - foreach($data as $row) { - $data_up[$row["product_id"]][$row["store_id"]]["0"]=$row["value"]; - $data_up[$row["product_id"]][0]["0"] +=$row["value"]; - - } + $data=$db::getRows("SELECT product_id, store_id, value FROM store_orders_fields_data WHERE order_id IN ($whereInOrderId) AND product_id $whereInProductsId AND field_name='division_summ' AND color='' AND value>0 group by product_id, store_id"); + foreach($data as $row) { + $data_up[$row["product_id"]][$row["store_id"]]["0"] = $row["value"]; + $data_up[$row["product_id"]][0]["0"] = ($data_up[$row["product_id"]][0]["0"] ?? 0) + $row["value"]; + } } diff --git a/erp24/modul/shipment/fields/write_offs_4week_cnt_avg.php b/erp24/modul/shipment/fields/write_offs_4week_cnt_avg.php index 8f4d18f5..4453c0dd 100644 --- a/erp24/modul/shipment/fields/write_offs_4week_cnt_avg.php +++ b/erp24/modul/shipment/fields/write_offs_4week_cnt_avg.php @@ -1,24 +1,24 @@ ='$date_start_sale'::date -interval '$periodDaysStats day' group BY p.product_id,w.store_id"); - foreach($data2 as $row2) { - $a=round($row2["cnt"]/4); - if(!empty($a)) { - $data_up[$row2["product_id"]][$row2["store_id"]][0]=$a; - $data_up[$row2["product_id"]][0][0] = ($data_up[$row2["product_id"]][0][0] ?? 0) + $a; - } - } - +AND w.date>='$date_start_sale'::date -interval '$periodDaysStats day' group BY p.product_id,w.store_id"; + $data2=$db::getRows($sql); + foreach($data2 as $row2) { + $a = round($row2["cnt"]/4); + if(!empty($a)) { + $data_up[$row2["product_id"]][$row2["store_id"]][0] = $a; + $data_up[$row2["product_id"]][0][0] = ($data_up[$row2["product_id"]][0][0] ?? 0) + $a; + } + } } \ No newline at end of file