From 5e9d94c949eb4dfb6ab751f5206b2e49201344ad Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 18 Apr 2024 13:45:07 +0300 Subject: [PATCH] shipment shipment fix2 --- .../shipment/fields/sales_division_4weeks_cnt_avg.php | 9 ++++++--- erp24/modul/shipment/functionsShipment.php | 6 +++--- erp24/modul/shipment/shipment.php | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/erp24/modul/shipment/fields/sales_division_4weeks_cnt_avg.php b/erp24/modul/shipment/fields/sales_division_4weeks_cnt_avg.php index 56db81f2..bfccf8dd 100644 --- a/erp24/modul/shipment/fields/sales_division_4weeks_cnt_avg.php +++ b/erp24/modul/shipment/fields/sales_division_4weeks_cnt_avg.php @@ -1,11 +1,14 @@ -='$date_start_division' -interval $day_sales day group BY i.product_id, s.store_id "); +AND s.date<='$date_start_division 00:00:00' AND s.date>='$date_start_division' -interval '$day_sales day' group BY i.product_id, s.store_id "); foreach($data2 as $row2) { $cnt=round(($row2["sale_cnt"]-$row2["vozvr_cnt"])/4); if(!empty($cnt)) { diff --git a/erp24/modul/shipment/functionsShipment.php b/erp24/modul/shipment/functionsShipment.php index d9fb2ade..951cf523 100644 --- a/erp24/modul/shipment/functionsShipment.php +++ b/erp24/modul/shipment/functionsShipment.php @@ -525,9 +525,9 @@ $value=$FiledsData[$field_name][$productId][$storeId][$color]??''; } -$value_title=$FiledsData["title__".$field_name][$productId][$storeId][$color] ?? ''; -if(empty($value_title)) $value_title=$FiledsData["title__".$field_name][$productId][$storeId]["NULL"] ?? ''; -if(empty($value_title)) $value_title=$FiledsData["title__".$field_name][$productId]["NULL"]["NULL"] ?? ''; +$value_title=$FiledsData["title__".$field_name][$productId][$storeId][$color] ?? 0; +if(empty($value_title)) $value_title=$FiledsData["title__".$field_name][$productId][$storeId]["NULL"] ?? 0; +if(empty($value_title)) $value_title=$FiledsData["title__".$field_name][$productId]["NULL"]["NULL"] ?? 0; //$value_title=" $field_name $productId $storeId $color "; if($tip!="string" and $tip!="double" ) $value=round($value); diff --git a/erp24/modul/shipment/shipment.php b/erp24/modul/shipment/shipment.php index 973b56f7..0283450e 100644 --- a/erp24/modul/shipment/shipment.php +++ b/erp24/modul/shipment/shipment.php @@ -76,7 +76,7 @@ if(!empty($group_id)) { $sort=$db::getValue("SELECT fields_sort FROM store_orders_statuses WHERE id=?",[$status_order_id]); if(!empty($sort)) $sort="ORDER BY FIELD(`id`, $sort) "; -$sql="SELECT id,name_eng,name,name_full FROM store_orders_fields"; +$sql="SELECT id,name_eng,name,name_full FROM store_orders_fields"; // TODO: реализовать сортировку на postgresql //var_dump($sql); die; $data=$db::getRows($sql); // получаем массив с данными по полям из таблицы store_orders_fields_data @@ -206,7 +206,7 @@ $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"]=="avg") $s=round($rowArraySum[$row["id"]]/$rowArraySum["cnt__".$row["id"]]); +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''.$s.''; } -- 2.39.5