shizhongqi 1 год назад
Родитель
Сommit
0ce00a782f

+ 40 - 0
app-ghs/controllers/ExpendController.php

@@ -205,6 +205,9 @@ class ExpendController extends BaseController
         if ($bx != -1) {
             $where['bx'] = $bx;
         }
+        if (true) { //过滤掉已删除的
+            $where['delStaffId'] = 0;
+        }
         $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : 'thisYear';
         $startTime = $get['startTime'] ?? '';
         $endTime = $get['endTime'] ?? '';
@@ -359,6 +362,43 @@ class ExpendController extends BaseController
         }
     }
 
+    //删除支出
+    public function actionDelExpend()
+    {
+        $mainId = $this->mainId;
+        if (getenv('YII_ENV') == 'production') {
+            if (in_array($mainId, [23390])) {
+                if (!in_array($this->adminId, [24655])) {
+                    util::fail('请财务人员操作吧');
+                }
+            }
+        }
+
+        $post = Yii::$app->request->post();
+        $staffId = intVal($post['staffId']);
+        $staff = ShopAdminClass::getById($staffId, true);
+        if (empty($staff)) {
+            util::fail('没有找到员工');
+        }
+        if ($staff->mainId != $this->mainId) {
+            util::fail('员工不存在');
+        }
+
+        $shop = $this->shop;
+        $admin = $this->admin;
+
+        $id = intval($post['id']);
+        $expend = ExpendClass::getById($id, true);
+        $expend->delStaffId = $staffId;
+        $expend->delStaffName = $staff->name;
+        $rs = $expend->save();
+        if ($rs) {
+            util::complete();
+        } else {
+            util::fail('删除支出失败');
+        }
+    }
+
     //修改账单日期 ssh 20241122
     public function actionChangePayTime()
     {

+ 0 - 1
app-ghs/controllers/StatController.php

@@ -121,7 +121,6 @@ class StatController extends BaseController
 
     public function actionProfit()
     {
-
         ini_set('memory_limit', '2045M');
         set_time_limit(0);
 

+ 5 - 1
biz-ghs/stat/classes/StatSaleClass.php

@@ -334,7 +334,11 @@ class StatSaleClass extends BaseClass
             }
         }
 
-        $condition = ['mainId' => $mainId, 'payTime' => ['between', [$currentStartTime, $currentEndTime]],];
+        $condition = [
+            'mainId' => $mainId,
+            'payTime' => ['between', [$currentStartTime, $currentEndTime]],
+            'delStaffId' => 0,
+        ];
         $expendList = ExpendClass::getAllByCondition($condition, null, '*', null, true);
         $expendTypeMap = dict::getDict('expendTypeMap');
         $expendAmount = [];