]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
фиксы
authormarina <m.zozirova@gmail.com>
Fri, 20 Dec 2024 08:50:01 +0000 (11:50 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 20 Dec 2024 08:50:01 +0000 (11:50 +0300)
erp24/views/cron/1c.php
erp24/views/replacement-invoice/view.php
erp24/web/js/shift-transfer/replacement.js

index 9e1b2e9d37bb0b0d19384cd1f5a7eb4717825ea3..f178ae8a4d040baee48a55f014282268edc8ae47 100644 (file)
@@ -33,45 +33,52 @@ $items=array(
 
 //"prices"=>array("name"=>"Цены"),
 );
-
-echo'<form action="" method=post>';
-echo '<input type="hidden" name="_csrf" value="' . Yii::$app->request->getCsrfToken() . '" />';
-foreach($items as $name => $ar) {
-    echo'<br><input type=checkbox name=in['.$name.']> '.$ar["name"].'';
-    echo"<table>";
-    foreach($ar["array"] ?? [] as $tip => $val) {
-// if($name=="checks")  $type="date"; else $type="text"; 
-        echo'<td> '.$tip.'</td><td> <input type="text" ';
-        if(isset($type) && $type=="date") echo' style="width:220px;"';
-
-        echo' class="form-control" name=in_in['.$name.']['.$tip.'] value="'.$val.'"></td>';
-    }
-    echo '</table>';
-}
-echo'<br><button name=save value=1 type=submit class="btn btn-success">Сохранить</button></form>';
-echo'<p><button class="btn"><a href="/cron/1c">Обновить</a></button></p>';
-$m=array();
-$request_id=time();
-$m["request_id"]=$request_id;
-foreach($_POST["in"] ?? [] as $n => $array5) {
-    $m3=array();
-    foreach($_POST["in_in"][$n] ?? [] as $t => $ar) {
-        $m[$n][$t]="".$ar;
+$request_id = time();
+$m = array();
+$m["request_id"] = $request_id;
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST["save"])) {
+    foreach ($_POST["in"] ?? [] as $n => $array5) {
+        $m3 = array();
+        foreach ($_POST["in_in"][$n] ?? [] as $t => $ar) {
+            $m[$n][$t] = "" . $ar;
+        }
+        if (empty($m[$n])) {
+            $m[$n] = true;
+        }
     }
-    if(empty($m[$n])) $m[$n]=true;
-}
-
-$json2=json_encode($m,JSON_UNESCAPED_UNICODE);
-echo $json2;
 
-if(!empty($_POST["in"]) and $json2!="[]") {
+    $json2 = json_encode($m, JSON_UNESCAPED_UNICODE);
 
+    if (!empty($_POST["in"]) && $json2 != "[]") {
+        $db::sql("INSERT INTO api_cron (date, date_up, status, json_post, request_id) VALUES (NOW(), NOW(), 0, ?, ?)", [$json2, $request_id]);
+    }
 
-
-    $db::sql("INSERT INTO api_cron (date, date_up, status,json_post,request_id) VALUES (NOW(), NOW(), 0, ?, ?)",[$json2,$request_id]);
-
+    header('Location: ' . $_SERVER['PHP_SELF']);
+    exit;
 }
-
+?>
+
+<form action="" method="post">
+    <input type="hidden" name="_csrf" value="<?= Yii::$app->request->getCsrfToken() ?>" />
+
+    <?php foreach($items as $name => $ar): ?>
+        <br><input type="checkbox" name="in[<?= $name ?>]"> <?= $ar["name"] ?>
+        <table>
+            <?php foreach($ar["array"] ?? [] as $tip => $val): ?>
+                <tr>
+                    <td><?= $tip ?></td>
+                    <td><input type="text" class="form-control" name="in_in[<?= $name ?>][<?= $tip ?>]" value="<?= $val ?>"></td>
+                </tr>
+            <?php endforeach; ?>
+        </table>
+    <?php endforeach; ?>
+
+    <br><button name="save" value="1" type="submit" class="btn btn-success">Сохранить</button>
+</form>
+
+<p><button class="btn"><a href="/cron/1c">Обновить</a></button></p>
+<?php
 $status_arr=[0=>"ожидает выполнения",1=>"выполнено"];
 $data = $db::getRows("SELECT * FROM api_cron WHERE 1=1 order by date DESC LIMIT 30 ");
 echo"<h3>Здания для 1с</h3><table class=\"table table-hover table-sm\"><tbody>";
index 33c7f3946aa86b161fd7516b724ea0283928b7a9..987cf935c532784d5f5aa7a0693618ed2976ce34 100644 (file)
@@ -20,7 +20,6 @@ $this->params['breadcrumbs'][] = $this->title;
     <?= DetailView::widget([
         'model' => $model,
         'attributes' => [
-            'id',
             'guid',
             [
                 'format' => 'raw',
@@ -30,7 +29,12 @@ $this->params['breadcrumbs'][] = $this->title;
                 }
             ],
             'number',
-            'number_1c',
+            [
+                'attribute' => 'number_1c',
+                'value' => function ($model) {
+                    return $model->number_1c ?? '';
+                }
+            ],
             [
                 'attribute' => 'status',
                 'value' => function ($model) {
@@ -39,16 +43,22 @@ $this->params['breadcrumbs'][] = $this->title;
             ],
             [
                 'attribute' => 'date',
-                'format' => 'datetime',
             ],
             [
                 'label' => 'Текст ошибки',
                 'attribute' => 'error_text',
+                'value' => function ($model) {
+                    return $model->error_text ?? '';
+                }
+            ],
+            [
+                'attribute' => 'comment',
+                'value' => function ($model) {
+                    return $model->comment ?? '';
+                }
             ],
-            'comment',
             [
                 'attribute' => 'created_at',
-                'format' => 'datetime',
             ],
             [
                 'format' => 'raw',
@@ -109,7 +119,7 @@ $this->params['breadcrumbs'][] = $this->title;
                     return $model->summ_self_cost ?? 'N/A';
                 },
             ],
-            'updated_at:datetime',
+            'updated_at',
             [
                 'attribute' => 'updated_admin_id',
                 'value' => function ($model) {
index 1e15c05999d056a41bf04b88483311628beb8986..cbf220b2c36bfbb39871aa96ede4b21960f06f2d 100644 (file)
@@ -195,7 +195,7 @@ $('.field-shifttransfer-equalizationremains').on('input', '.list-cell__product_r
         return;
     }
 
-    if (quantity < 0) {
+    if (quantity <= 0) {
         alert('Количество не может быть отрицательным!');
         $this.val('');
         return;
@@ -258,6 +258,7 @@ $('.field-shifttransfer-equalizationremains').on('input change', '.list-cell__pr
     var max = parseFloat($(inputElement).attr('max'));
     var value = parseFloat($(inputElement).val());
 
+
     setDynamicMaxValue(inputElement, rowId);
 
     if (value > max) {