diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index e3a2f26db..bb7e57183 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -563,10 +563,24 @@ class WorkbenchLogic extends BaseLogic //总的营业额的统计 总的利润的统计 总的成本合集的统计 总的加到保证金的 $all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); + + $deposit_all = SystemStore::where('id',$params['store_id']) + ->value('paid_deposit'); + + $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) + ->where('status',YesNoEnum::YES) + ->sum('receipts'); if(isset($params['month']) && $params['month']){ $all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]) ->whereMonth('create_time', $params['month']) ; + $deposit_all = SystemStore::where('id',$params['store_id']) + ->whereMonth('create_time', $params['month']) + ->value('paid_deposit'); + $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) + ->where('status',YesNoEnum::YES) + ->whereMonth('create_time', $params['month']) + ->sum('receipts'); } $turnover_all = $all ->sum('pay_price'); @@ -574,11 +588,8 @@ class WorkbenchLogic extends BaseLogic ->sum('profit'); $cost_all = $all ->sum('cost'); - $deposit_all = SystemStore::where('id',$params['store_id']) - ->value('paid_deposit'); - $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) - ->where('status',YesNoEnum::YES) - ->sum('receipts'); + + $time = self::getLastSevenDays();