From: pavlikov_maxim Date: Wed, 24 Apr 2024 11:22:04 +0000 (+0300) Subject: фикс модуля polnogramm edit X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=16e24ce7269d06e76c0f141c814f8aac481fc908;p=yii-erp24%2F.git фикс модуля polnogramm edit --- diff --git a/erp24/controllers/ShipmentController.php b/erp24/controllers/ShipmentController.php index 7f6d254..4635daa 100755 --- a/erp24/controllers/ShipmentController.php +++ b/erp24/controllers/ShipmentController.php @@ -16,6 +16,7 @@ class ShipmentController extends Controller { return $this->render('info'); } + public function actionPolnogrammEdit() { return $this->render('polnogramm-edit'); } public function actionIndex() { return $this->render('index'); } //public function actionAdd() { return $this->render('add'); } public function actionStoreOrders() { return $this->render('store-orders'); } diff --git a/erp24/modul/shipment/PolnogrammaEdit.php b/erp24/modul/shipment/PolnogrammaEdit.php index 56642cc..a530be6 100644 --- a/erp24/modul/shipment/PolnogrammaEdit.php +++ b/erp24/modul/shipment/PolnogrammaEdit.php @@ -1,10 +1,10 @@ -NOW() - interval 25 day"); -foreach($data as $row) { -$pr=explode(",",$row["providers_arr"]); - foreach($pr as $prid) { if(!empty($prid)) $prov[$prid]=$prid;} +$data = $db::getRows("SELECT id, name, providers_arr FROM store_orders WHERE date_start > NOW() - interval '25 day'"); +foreach ($data as $row) { + $pr = explode(",", $row["providers_arr"]); + foreach ($pr as $prid) { + if (!empty($prid)) $prov[$prid] = $prid; + } } -//echo print_r($prov);; $k=0; @@ -142,7 +142,8 @@ $dataRows=[]; // сколько заполнено по магазинам -$storesFact=array(); $storesFactNo=array(); +$storesFact = array(); +$storesFactNo = array(); // полнограммы по всем магазинам $data3=$db::getRows("SELECT store_id,product_id,quantity FROM store_planogram WHERE color='' AND store_id!='' AND quantity>0 AND store_id in($where)"); foreach($data3 as $row2) $store_planogramAllStores[$row2["store_id"]][$row2["product_id"]]=$row2["quantity"]; @@ -154,17 +155,18 @@ foreach($data3 as $row2) $factAll[$row2["store_id"]][$row2["product_id"]]=$row2[ foreach($stores as $stId =>$nameStore) { //echo"
магазин ".$nameStore." "; -$cnt=0; $all=0; -$arrays=$store_planogramAllStores[$stId]; -if(!empty($stores[$stId])){ - foreach($arrays as $productId =>$quantity) { - if($factAll[$stId][$productId]>0 and $quantity>0) { - //echo"+ $productId = $quantity"; - $cnt++; - } - $all++; - } - $percent=round(100*($cnt/$all)); + $cnt = 0; + $all = 0; + $arrays = $store_planogramAllStores[$stId] ?? []; + if (!empty($stores[$stId])) { + foreach ($arrays as $productId => $quantity) { + if (($factAll[$stId][$productId] ?? 0) > 0 and $quantity > 0) { + //echo"+ $productId = $quantity"; + $cnt++; + } + $all++; + } + $percent = ($all != 0) ? (round(100 * ($cnt / $all))) : 0; //echo" $cnt из $all =$percent %"; $storesFact[$stId]=$percent; //не заполнившие магазины @@ -175,14 +177,10 @@ if($percent<15) $storesFactNo[]=$stId; // сколько заполнено по магазинам - - - - - -foreach($stores as $strid=>$namestore){ -echo""; +foreach ($stores as $strid => $namestore) { + echo ""; if($storesFact[$strid]>20) echo"+".$storesFact[$strid]."%"; @@ -205,10 +203,16 @@ if(!empty($storesFactNo)) { } -$w=""; -$providers=$db::mapping("SELECT id,name FROM shipment_providers "); -$k=0; -foreach($in as $pid) { echo''.$providers[$pid].''; if($k!=0) $w .=" OR"; $w .=" o.provider_id='$pid'"; $k++; } +$w = ""; +$providers = $db::mapping("SELECT id,name FROM shipment_providers "); +$k = 0; + +//foreach ($in as $pid) { +// echo '' . $providers[$pid] . ''; +// if ($k != 0) $w .= " OR"; +// $w .= " o.provider_id='$pid'"; +// $k++; +//} if(!empty($_POST["quantity"])) { @@ -248,10 +252,12 @@ $db::sql($sql); mess("Факт для магазина сохранена"); } -if(!empty($store_id)) { -echo'
+$store_planogram = []; +if (!empty($store_id)) { + echo '
+ '; -echo''; + echo ''; $data3=$db::getRows("SELECT * FROM store_planogram WHERE store_id=? AND color=''",[$store_id]); @@ -283,13 +289,14 @@ $where .=")"; $data=$db::getRows("SELECT p.id, p.name, o.provider_id, o.colors FROM products_1c_options as o, products_1c as p WHERE o.provider_id>0 AND p.view='1' AND p.id=o.id $where order by o.provider_id ASC, p.name ASC"); -$p=0; -foreach($data as $row) { - if(!in_array($row["provider_id"],$providersIn)) { - echo' - '; - -echo' + '; + + echo 'пол-ма1) echo"display:none;"; - -if($store_planogram[$row["id"]]==0) echo"opacity:0.9;"; -if($difference_percent==0 and $store_planogram[$row["id"]]!=0) echo"background:#ffe391;"; -if($difference_percent>=100) echo"background:#9effd2;"; -echo"\" class=\"trhover pr__".$row["provider_id"].""; -if($store_planogram[$row["id"]]==0) echo" bg-danger2"; - echo"\">"; -echo' + if (($store_planogram[$row["id"]] ?? 0) > 0 or $_SESSION["show_planogram_0"] == 1) { + $difference = ($store_planogram[$row["id"]] ?? 0) - ($values_in[$row["id"]]["quantity"] ?? 0); + if (!empty($store_planogram[$row["id"]])) $difference_percent = 100 - round(100 * $difference / $store_planogram[$row["id"]]); + else $difference_percent = ""; + echo " 1) echo "display:none;"; + + if (($store_planogram[$row["id"]] ?? -1) == 0) echo "opacity:0.9;"; + if ($difference_percent == 0 && ($store_planogram[$row["id"]] ?? 0) != 0) echo "background:#ffe391;"; + if ($difference_percent >= 100) echo "background:#9effd2;"; + echo "\" class=\"trhover pr__" . $row["provider_id"] . ""; + if (($store_planogram[$row["id"]] ?? -1) == 0) echo " bg-danger2"; + echo "\">"; + echo ' -'; -echo' - - - - -'; + if ($difference > 0) echo 'danger2'; elseif ($difference < 0) echo 'success'; + else echo 'default'; + + if ($difference < 0) $difference = "+" . abs($difference); + if ($difference_percent < 0) $difference_percent = ">" . abs($difference_percent); + + if (!empty($store_planogram[$row["id"]]) and !empty($difference_percent)) $difference_percent .= "%"; + else $difference_percent = ""; + echo '">' . $difference . ' +'; + echo ' + + + + +'; echo""; $colors=explode(";",$row["colors"]); @@ -373,21 +382,21 @@ $j=0; foreach($colors as $color_w) { $color_w=trim($color_w); - -if(!empty($store_planogram_colors[$row["id"]][$color_w])) { - - echo""; - - if($j==0) echo""; - - $j++; - echo""; - - $difference=$store_planogram_colors[$row["id"]][$color_w]-$values_in_color[$row["id"]]["quantity"][$color_w]; - if($store_planogram_colors[$row["id"]][$color_w]) - $difference_percent=100-round(100*$difference/$store_planogram_colors[$row["id"]][$color_w]); + + if (!empty($store_planogram_colors[$row["id"]][$color_w])) { + + echo ""; + + if ($j == 0) echo ""; + + $j++; + echo ""; + + $difference = ($store_planogram_colors[$row["id"]][$color_w] ?? 0) - ($values_in_color[$row["id"]]["quantity"][$color_w] ?? 0); + if ($store_planogram_colors[$row["id"]][$color_w] ?? 0) + $difference_percent = 100 - round(100 * $difference / $store_planogram_colors[$row["id"]][$color_w]); if(!empty($difference_percent)) $difference_percent="$difference_percent%"; @@ -400,8 +409,9 @@ if(!empty($store_planogram_colors[$row["id"]][$color_w]) and !empty($difference echo'
+ '.$providers[$row["provider_id"]].'
+ ' . $providers[$row["provider_id"]] . '
0 or $_SESSION["show_planogram_0"]==1) { -$difference=$store_planogram[$row["id"]]-$values_in[$row["id"]]["quantity"]; -if(!empty($store_planogram[$row["id"]])) $difference_percent=100-round(100*$difference/$store_planogram[$row["id"]]); -else $difference_percent=""; - echo"
".$row["name"]."'.$store_planogram[$row["id"]].'
" . $row["name"] . "' . ($store_planogram[$row["id"]] ?? '') . ' '.$difference.''.$difference_percent.''.$dataRows[$row["id"]]['sales'].''.$dataRows[$row["id"]]['write_offs'].''.$dataRows[$row["id"]]['sales_reccommend'].''.$dataRows[$row["id"]]['sales_write_offs'].''.$dataRows[$row["id"]]['reccommend'].'' . $difference_percent . '' . ($dataRows[$row["id"]]['sales'] ?? '') . '' . ($dataRows[$row["id"]]['write_offs'] ?? '') . '' . ($dataRows[$row["id"]]['sales_reccommend'] ?? '') . '' . ($dataRows[$row["id"]]['sales_write_offs'] ?? '') . '' . ($dataRows[$row["id"]]['reccommend'] ?? '') . '
".$row["name"]."$color_w
" . $row["name"] . "$color_w '; + if ($difference > 0) echo 'danger2'; elseif ($difference < 0) echo 'success'; + else echo 'default'; + echo '">'; if(!empty($difference)) echo $difference; @@ -436,8 +446,7 @@ echo'
'; - -$_CONFIG["jscss"] .=' -'; - +'; + include "templates/bottom_light.php"; } - -include"templates/bottom.php"; - + + diff --git a/erp24/views/shipment/polnogramm-edit.php b/erp24/views/shipment/polnogramm-edit.php new file mode 100644 index 0000000..59d6e59 --- /dev/null +++ b/erp24/views/shipment/polnogramm-edit.php @@ -0,0 +1,4 @@ +