]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Поднимаем со дна мусор: /modul/storage, /modul/store/itemmatrix origin/modul_storage_store_itemmatrix
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 15 Aug 2024 14:13:11 +0000 (17:13 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 15 Aug 2024 14:13:11 +0000 (17:13 +0300)
erp24/controllers/StorageController.php [new file with mode: 0644]
erp24/controllers/StoreController.php
erp24/inc/uni.php
erp24/modul/storage/ajax_balances_in_group.php
erp24/modul/storage/index.php
erp24/modul/storage/store.php
erp24/modul/store/itemmatrix.php
erp24/views/storage/ajax-balances-in-group.php [new file with mode: 0644]
erp24/views/storage/index.php [new file with mode: 0644]
erp24/views/storage/store.php [new file with mode: 0644]
erp24/views/store/itemmatrix.php [new file with mode: 0644]

diff --git a/erp24/controllers/StorageController.php b/erp24/controllers/StorageController.php
new file mode 100644 (file)
index 0000000..dc4dda8
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+namespace app\controllers;
+
+use yii\web\Controller;
+
+class StorageController extends Controller
+{
+    public function actionIndex() { return $this->render('index'); }
+    public function actionStore() { return $this->render('store'); }
+    public function actionAjaxBalancesInGroup() { return $this->renderPartial('ajax-balances-in-group'); }
+}
\ No newline at end of file
index a0b49ceca237ae04a9a4b69a93178d82de7f63b0..20666274cd220233aa8854c03db5880ae201a98d 100755 (executable)
@@ -6,8 +6,6 @@ use yii\web\Controller;
 
 class StoreController extends Controller
 {
-    public function actionStats()
-    {
-        return $this->render('stats');
-    }
+    public function actionStats() { return $this->render('stats'); }
+    public function actionItemmatrix() { return $this->render('itemmatrix'); }
 }
\ No newline at end of file
index b55f72612580bfa16539389d4ef4819529ed2e5e..936e14118cfc8fcef0720fc245959585936979b6 100644 (file)
@@ -1,6 +1,6 @@
 <?
 function store_select($form=1,$pole_name="id",$store_all=0) {
-global $db;
+global $db, $id;
 
 if(isset($_GET["store_id"])) $id=(int)$_GET["store_id"];
 if(isset($_GET["id"])) $id=(int)$_GET["id"];
index d81d27543de469d268add0f5fdf3d6b2b0d3f38b..bda22c6c533c2314ef883ee4d7d50f4d61846e0a 100644 (file)
@@ -1,12 +1,13 @@
-<?
-include_once ("startup.php");
-include_once("inc/db.php");
-include_once("inc/db2.php");
-include_once("inc/base_new.php");
-if(!empty($_REQUEST["parent_id"])) { 
+<?php
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+
+if(!empty($_REQUEST["parent_id"])) {
 
 $parent_id=htmlentities($_REQUEST["parent_id"]);
 $store_id=htmlentities($_REQUEST["store_id"]);
+
 $data0 = $db::getRows("SELECT 
 products_1c.name,prices.price,balances.quantity, balances.reserv 
 FROM products_1c, prices,balances WHERE products_1c.tip='products'
index ae436f8dd4879aa8f8819be20a159afd3c45a6cf..a2e49e99767448030e51e985a6ef8d1866c94b55 100644 (file)
@@ -1,24 +1,24 @@
-<?
-include_once ("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
-include_once("inc/design_new.php");
-include_once("inc/uni.php");
-include_once("inc/uni2.php");
+<?php
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/design_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/uni.php");
+include_once(dirname(__DIR__, 2) . "/inc/uni2.php");
 
 
-
-include"templates/top.php";
-
 $modul="storage";
 $sql_table="balances";
 $pole_name="store_id";
 
-
+$id = 0;
+$store_id = 0;
 if(!empty($_REQUEST["$pole_name"])) $store_id=htmlentities($_REQUEST["$pole_name"]);
 $row=$db::getRow("SELECT name, id FROM products_1c WHERE id=?",[$store_id]);
 
-echo'<div class="page-header"><h1 class="page-title m-0 text-primary">Складские остатки '.$row["name"].'';
+if ($row) {
+    echo'<div class="page-header"><h1 class="page-title m-0 text-primary">Складские остатки '.$row["name"].'';
+}
 
 $form=1;
 $data=$db::getRows("SELECT name,id FROM products_1c WHERE tip='city_store' AND view='1' order by name ASC");
@@ -30,17 +30,16 @@ foreach($data as $row2) $products_group[$row2["id"]]=$row2["name"];
 if($form==1) echo'<form action="" method=get class="m-0 p-0">';
 
 echo'<table><td><select class="form-control" name='.$pole_name.' '; if($form==1 or $form=="-1") echo' onchange="this.form.submit();"'; echo'>';
-echo'<option value=0'; if(0==$id) echo' selected'; echo'>-выбрать магазин-</option>';
-if($store_all==1) { echo'<option value="-1"'; if("-1"==$id) echo' selected'; echo'>-все магазины-</option>'; }
+echo'<option value=0'; if(0==($id ?? -1)) echo' selected'; echo'>-выбрать магазин-</option>';
+if(($store_all ?? 0)==1) { echo'<option value="-1"'; if("-1"==$id) echo' selected'; echo'>-все магазины-</option>'; }
   
 foreach($store_arr as $sid =>$store) { 
- // if(in_array($sid,$_SESSION["store_arr_dostup_guid"]))   
-         echo'<option value='.$sid.''; if($sid==$store_id) echo' selected'; echo'>'.$store.'</option>';
+    echo'<option value='.$sid.''; if($sid==$store_id) echo' selected'; echo'>'.$store.'</option>';
 }
 
 echo'</select></td>';
-if($form==1) echo'<td><button class="btn btn-success" type=submit>вывести</button></td></table></form>';
-echo'</h1></div></div>';
+if($form==1) echo'<td></td></table></form>';
+echo'</h1></div>';
 
 echo"<a href=\"/storage/store/\" class=\"btn btn-info\">Остатки по группам как в 1с</a>";
 
@@ -63,4 +62,3 @@ echo'</tbody></table></div>';
 }
 
 
-include"templates/bottom.php";
index 745cd05fb60bb85f0223277e535838395b7558d7..706c10eade3bb79a9511e76a284e72d2babd81f4 100644 (file)
@@ -1,11 +1,13 @@
-<?
-include_once ("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
-include_once("inc/design_new.php");
+<?php
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/design_new.php");
 
-include"templates/top.php";
 
+global $store_id;
+
+$store_id = '';
 
 if(!empty($_REQUEST["store_id"]))  $store_id=htmlentities($_REQUEST["store_id"]);
 if(!empty($_GET["id"]))  $id=(int)$_GET["id"];
@@ -24,7 +26,7 @@ foreach ($data as $row) $prices[$row['product_id']]= $row['price'];
 
 echo'<form action="" method=get class="m-0 p-0">';
 echo'<table><td><select class="form-control" name=store_id ';  echo' onchange="this.form.submit();"'; echo'>';
-echo'<option value=0'; if(0==$id) echo' selected'; echo'>-выбрать магазин-</option>';
+echo'<option value=0'; if(0==($id ?? -1)) echo' selected'; echo'>-выбрать магазин-</option>';
 $data=$db::getRows("SELECT name,id FROM products_1c WHERE tip='city_store' AND view='1' order by name ASC");
 foreach($data as $row) {
  echo'<option value='.$row["id"].''; if($row["id"]==$store_id) echo' selected'; echo'>'.$row["name"].'</option>';
@@ -88,11 +90,14 @@ $_CONFIG["jscss"]="
 
 function ajax_balances_in_group(parent_id,store_id){
 
+const param21 = $('meta[name=csrf-param]').attr('content');
+const token21 = $('meta[name=csrf-token]').attr('content');
+
 $.ajax({
-       url: '/storage/ajax_balances_in_group/',
+       url: '/storage/ajax-balances-in-group/',
        method: 'post',       
        dataType: 'html',        
-       data: {parent_id: ''+parent_id+'', store_id: ''+store_id+''},  
+       data: {parent_id: ''+parent_id+'', store_id: ''+store_id+'', [param21]: token21},  
        success: function(data){  
    $('#tr_'+parent_id+'').after('<tr id=\"trr_'+parent_id+'\"><td colspan=2>'+data+'</td></tr>');
 
@@ -127,11 +132,11 @@ $.ajax({
                        </div>
                </div>
 
-'; 
+';
+
 
 
 
 
 
-include"templates/bottom.php";
\ No newline at end of file
+include_once dirname(__DIR__, 2) . '/templates/bottom_light.php';
\ No newline at end of file
index d7655662e482bc645a2a498406ae003667cee31a..d387360b4a70392d6837ece5141056b05b356176 100644 (file)
@@ -1,11 +1,14 @@
 <?php
-include_once("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
-include_once("inc/design_new.php");
-include_once("inc/uni.php");
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/design_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/uni.php");
+
+global $id;
+
+$id = 1;
 
-include"templates/top.php";    
 if(!empty($_REQUEST["id"])) $id=(int)$_REQUEST["id"];
 $row=$db::getRow("SELECT name,id FROM city_store WHERE id=?",[$id]);
 $store_id=$id;  
@@ -41,8 +44,7 @@ echo'</tbody></table></div></div>';
 
 
 echo'</div></div>';    
-       
-include"templates/bottom.php"; 
-       
+
+
 
 
diff --git a/erp24/views/storage/ajax-balances-in-group.php b/erp24/views/storage/ajax-balances-in-group.php
new file mode 100644 (file)
index 0000000..26b42f0
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/storage/ajax_balances_in_group.php';
\ No newline at end of file
diff --git a/erp24/views/storage/index.php b/erp24/views/storage/index.php
new file mode 100644 (file)
index 0000000..095d831
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/storage/index.php';
\ No newline at end of file
diff --git a/erp24/views/storage/store.php b/erp24/views/storage/store.php
new file mode 100644 (file)
index 0000000..4a1249c
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/storage/store.php';
\ No newline at end of file
diff --git a/erp24/views/store/itemmatrix.php b/erp24/views/store/itemmatrix.php
new file mode 100644 (file)
index 0000000..63e5cf8
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/store/itemmatrix.php';
\ No newline at end of file