]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
store plan page
authorpavlikov_maxim <truobleblyat@yandex.ru>
Mon, 6 May 2024 11:50:30 +0000 (14:50 +0300)
committerpavlikov_maxim <truobleblyat@yandex.ru>
Mon, 6 May 2024 11:50:30 +0000 (14:50 +0300)
erp24/modul/shipment/store_plan.php

index dacae64d1f81afab40da69e07b6fce349941a1c5..13578f2e5ada0e371f22f69db93a6b98d9fbcae5 100644 (file)
@@ -37,21 +37,19 @@ foreach ($data as $row) {
 }
 
 echo '<h1>План продаж и закупки по магазинам</h1>';
-$array = [2019, 2020, 2021, 2022];
-
-
-foreach ($array as $y) {
-    echo "<a href=\"/shipment/store-plan/?year=$y\" class=\"btn btn-";
-    if ($year == $y) {
+$current_year = date('Y');
+for ($i = $current_year - 5; $i <= $current_year + 1; $i++) {
+    echo "<a href=\"/shipment/store-plan/?year=$i\" class=\"btn btn-";
+    if ($year == $i) {
         echo "success";
 
     } else echo "warning";
-    echo " btn-sm m-1\">$y ";
+    echo " btn-sm m-1\">$i ";
     echo "</a> ";
 }
 
 
-$array = array(
+$array = [
     1 => 'Январь',
     2 => 'Февраль',
     3 => 'Март',
@@ -64,7 +62,7 @@ $array = array(
     10 => 'Октябрь',
     11 => 'Ноябрь',
     12 => 'Декабрь'
-);
+];
 
 
 echo "<br>";
@@ -90,12 +88,10 @@ echo '<form method=post action="/shipment/store-plan/?year=' . $year . '&month='
 
 <tbody>';
 foreach ($stores as $strid => $namestore) {
-    if ($values_data[$strid] ?? false) {
-        echo "<tr><td class=\"text-right\">$namestore</td><td><input  value=\"" . $values_data[$strid]["summ"] . "\"  type=text class=\"form-control\" name=summ[$strid]></td>
-<td><input type=text class=\"form-control\" value=\"" . $values_data[$strid]["summ_week"] . "\" name=summ_week[$strid]></td>
-<td><input type=text class=\"form-control\"  value=\"" . $values_data[$strid]["summ_fact"] . "\"  name=summ_fact[$strid]></td>
+    echo "<tr><td class=\"text-right\">$namestore</td><td><input  value=\"" . ($values_data[$strid]["summ"] ?? 0) . "\"  type=text class=\"form-control\" name=summ[$strid]></td>
+<td><input type=text class=\"form-control\" value=\"" . ($values_data[$strid]["summ_week"] ?? 0) . "\" name=summ_week[$strid]></td>
+<td><input type=text class=\"form-control\"  value=\"" . ($values_data[$strid]["summ_fact"] ?? 0) . "\"  name=summ_fact[$strid]></td>
 </tr>";
-    }
 }
 echo '</tbody></table>