]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
payroll fix
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Thu, 21 Mar 2024 09:03:00 +0000 (12:03 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Thu, 21 Mar 2024 09:03:00 +0000 (12:03 +0300)
erp24/records/Timetable.php
erp24/views/payroll/management.php

index 7901d5de0205d88eb3fe2fb14dc6ae02b920160d..7da526001d2a6f676283c12ccd5e40861d9e5de3 100755 (executable)
@@ -456,14 +456,16 @@ class Timetable extends ActiveRecord
                 $dateKeyPreparedRow = explode('_', $keyRow);
                 $dateKeyRow = ArrayHelper::getValue($dateKeyPreparedRow, array_key_first($dateKeyPreparedRow));
                 foreach ($itemRows as $itemRow) {
-                    $arrayRow = [
-                        'admin_id' => $itemRow['admin']['id'],
-                        'admin_guid' => $itemRow['admin']['guid'],
-                        'admin_name' => $itemRow['admin']['name'],
-                    ];
-                    $adminsPrepared[$keyRow][] = $arrayRow;
-                    $adminsByDate[$dateKeyRow][] = $arrayRow;
-                    $adminsByDateGuids[$dateKeyRow][] = $itemRow['admin']['guid'];
+                    if (!empty($itemRow) && is_array($itemRow)) {
+                        $arrayRow = [
+                            'admin_id' => $itemRow['admin']['id'],
+                            'admin_guid' => $itemRow['admin']['guid'],
+                            'admin_name' => $itemRow['admin']['name'],
+                        ];
+                        $adminsPrepared[$keyRow][] = $arrayRow;
+                        $adminsByDate[$dateKeyRow][] = $arrayRow;
+                        $adminsByDateGuids[$dateKeyRow][] = $itemRow['admin']['guid'];
+                    }
                 }
             }
         }
index aadd4abfa937011f795bf7ae149465f11efc9078..6975105053ca7d24502f8084e0550952291e0bef 100644 (file)
@@ -81,12 +81,12 @@ $this->params['breadcrumbs'][] = $this->title;
 
 
             <div class="col"><?php
-                $form = ActiveForm::begin();
+                $form = ActiveForm::begin(['id' => 'form_make_payroll_month']);
                                 echo Html::hiddenInput('action', 'startMakePayroll');
                                 echo Html::hiddenInput('start', 1689226046, ['id' => 'start_form_value']);
                 echo $form->field($yearMonthSearchForm, 'year')
                     ->label(false)->dropDownList(
-                        array_combine(range(2022,2026),range(2022,2026)),           // Flat array ('id'=>'label')
+                        array_combine(range(2022,2028),range(2022,2028)),           // Flat array ('id'=>'label')
                         ['prompt' => 'Выберите год']    // options
                     );
                 ?>
@@ -103,8 +103,11 @@ $this->params['breadcrumbs'][] = $this->title;
             <div class="col">
                 <div class="form-group  required">
                 <?php
-                echo Html::checkbox('start_time',false, ['class' => 'checkbox', 'required' => 'required',
-
+                echo Html::checkbox('start_time',false, [
+                        'class' => 'checkbox',
+                        'label' => 'запустить',
+                        'required' => 'required',
+                        'id' => 'start_time_form_value',
                     'onclick'=>"$('#start_form_value').val('" . time() . "')",
                     ]);
                 ?>
@@ -115,6 +118,7 @@ $this->params['breadcrumbs'][] = $this->title;
                     echo Html::submitButton('Запустить формирование ведомости',
                         [
                             'class' => 'btn btn-primary',
+                            'id' => 'start_submit_form',
                             'data' => [
                                     'confirm' => 'Вы уверены, что хотите запустить формирование ведомости?',
                                     'method' => 'post',
@@ -135,7 +139,7 @@ $this->params['breadcrumbs'][] = $this->title;
             ActiveForm::end();
             ?>
             <div class="col"><?php
-                $form = ActiveForm::begin();
+                $form = ActiveForm::begin(['id' => 'form_disable_last_make_payroll']);
                 echo Html::hiddenInput('action', 'disableLastMakePayroll');
                 ?>
             </div>
@@ -150,6 +154,7 @@ $this->params['breadcrumbs'][] = $this->title;
                             'confirm' => 'Вы уверены, что хотите удалить этот документ?',
                             'method' => 'post',
                         ],
+                        'onclick'=>"$('#form_disable_last_make_payroll').submit()",
                     ]
                 );
 
@@ -160,11 +165,11 @@ $this->params['breadcrumbs'][] = $this->title;
                 //                                    'method' => 'post',
                 //                                ],
                 //                            ]);
+                ?>            <?php
+                ActiveForm::end();
                 ?>
             </div>
-            <?php
-            ActiveForm::end();
-            ?>
+
 
         </div>
     </div>
@@ -243,4 +248,18 @@ $this->params['breadcrumbs'][] = $this->title;
     }
     ?>
 </div>
+<script>
+    $( "#start_submit_form" ).on( "click", function( event ) {
+        event.preventDefault();
+        if(document.getElementById('start_time_form_value').checked) {
+            console.log('test_click 1');
+            $("#form_make_payroll_month").submit();
+        } else {
+            console.log('test_click 2');
+            alert('Для продолжения отметьте чекбокс "запустить" !');
+            return false;
+        }
+    });
+
+</script>