]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
add shipment store-products-fact during pure php to yii movement
authorAlexander Smirnov <fredeom@mail.ru>
Tue, 19 Dec 2023 18:06:12 +0000 (21:06 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Tue, 19 Dec 2023 18:06:12 +0000 (21:06 +0300)
erp24/actions/shipment/StoreProductsFactEditAction.php [new file with mode: 0644]
erp24/controllers/ShipmentController.php
erp24/views/shipment/polnogramm.php
erp24/views/shipment/store-products-fact-edit.php [new file with mode: 0644]
erp24/views/shipment/store-products-fact.php

diff --git a/erp24/actions/shipment/StoreProductsFactEditAction.php b/erp24/actions/shipment/StoreProductsFactEditAction.php
new file mode 100644 (file)
index 0000000..bc4facf
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+namespace yii_app\actions\shipment;
+
+use yii\base\Action;
+
+class StoreProductsFactEditAction extends Action
+{
+    public function run() {
+        return $this->controller->renderPartial('store-products-fact-edit');
+    }
+}
\ No newline at end of file
index f765f17d9fc56f8fd475603adbe88ca4597fcf94..27e8d677303b84d434a9e58a6232f76bc03a1c34 100755 (executable)
@@ -25,6 +25,7 @@ class ShipmentController extends \yii\web\Controller
             'division-print-edit' => \yii_app\actions\shipment\DivisionPrintEditAction::class,
             'set-division-priority' => \yii_app\actions\shipment\SetDivisionPriorityAction::class,
             'store-products-fact' => \yii_app\actions\shipment\StoreProductsFactAction::class,
+            'store-products-fact-edit' => \yii_app\actions\shipment\StoreProductsFactEditAction::class,
             'polnogramm' => \yii_app\actions\shipment\PolnogrammAction::class,
             'store-planogram-logi' => \yii_app\actions\shipment\StorePlanogramLogiAction::class,
         ];
index b5f05dc1605815688c8f1c20ab1840cbf8b950ae..6d4b755ec219117bbd1858943a6989f030df2089 100644 (file)
@@ -465,6 +465,7 @@ $.ajax({
 
 
 //include"templates/bottom.php";
+include_once dirname(__DIR__, 2) . '/templates/bottom_light.php';
 
 
 
diff --git a/erp24/views/shipment/store-products-fact-edit.php b/erp24/views/shipment/store-products-fact-edit.php
new file mode 100644 (file)
index 0000000..48f3bb3
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+
+if(!empty($_REQUEST["product_id"])) {
+
+    $product_id=htmlentities($_REQUEST["product_id"]);
+    $color=htmlentities($_REQUEST["color"]);
+    $quantity=intval($_REQUEST["quantity"]);
+    $store_id=htmlentities($_REQUEST["store_id"]);
+    $date_id=intval($_REQUEST["date_id"]);
+    echo"Сохранили количество =$quantity";
+
+
+
+    if($color!="NULL") $color=str_replace('"','',$color);
+    else $color='';
+    $sql="INSERT IGNORE INTO store_products_fact SET  ";
+    $up= "store_id='$store_id', product_id='$product_id', date_id='$date_id', color='$color', quantity='$quantity' ";
+    $sql .="$up ON DUPLICATE KEY UPDATE $up";
+//echo"<br><br>++$color++$sql";
+    $db::sql($sql);
+
+}
\ No newline at end of file
index 50954ec0ebfca1121d48a96ade6a3d8ff164f34b..0d6dd73fc6b550b980de16904349e6d2d2500f8e 100644 (file)
@@ -561,8 +561,9 @@ WHERE cl.tip='related' group by p.id order by o.provider_id, p.parent_id, p.name
     .zak td.td_product:hover {background:#fff;}
 
     */
+global $_CONFIG;
 
-    $_CONFIG["jscss"] = ($_CONFIG["jscss"] ?? '') . '<style>.t tbody tr td{padding:0;}
+    $_CONFIG["jscss"] = '<style>.t tbody tr td{padding:0;}
 .t tbody tr td input.form-control{padding:0;margin:0 2px;text-align:center;font-weight:bold;}
 
 .table tbody tr td{padding:0;}
@@ -590,6 +591,8 @@ table tbody td small{color:#787878; text-align:center; font-size:0.7rem; margin:
 </style>
 
 <script>
+const param6x = $(\'meta[name=csrf-param]\').attr(\'content\');
+const token6x = $(\'meta[name=csrf-token]\').attr(\'content\');
 
 
 $quantity=htmlentities($_REQUEST["quantity"]);
@@ -600,11 +603,11 @@ function storeProductsFactEdit(product_id,color){
 var quantity=$(\'#color_quantity_\'+product_id+\'_\'+color+\'\').val();
 
  $.ajax({
-       url: \'/shipment/storeProductsFactEdit/\',
+       url: \'/shipment/store-products-fact-edit/\',
        method: \'post\',       
        dataType: \'html\',        
-       data: {store_id: \''.$store_id.'\', date_id: \''.$date_id.'\', quantity: quantity,  product_id: product_id, color: color},  
-       success: function(data){  
+       data: {store_id: \''.$store_id.'\', date_id: \''.$date_id.'\', quantity: quantity,  product_id: product_id, color: color, [param6x]: token6x},  
+       success: function(data) {
     $(\'#editDiv\').html(data);
        }}); 
 }
@@ -617,9 +620,11 @@ function up(e) {
 }
 </script>';
 
+    include_once dirname(__DIR__, 2) . '/templates/bottom_light.php';
 }
 
 //include"templates/bottom.php";
 
 
 
+