From a546ddd3532078d71cfb3aa8ad916819ece251eb Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 10:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA=E7=9B=88?= =?UTF-8?q?=E6=94=B6=E7=BB=9F=E8=AE=A1=E7=9B=B8=E5=85=B3=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=92=8C=E6=94=B6=E9=93=B6=E5=8F=B0=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E5=90=8E=E9=BB=98=E8=AE=A4=E4=B8=BA=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/CashFlowLogic.php | 2 ++ app/store/logic/WorkbenchLogic.php | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/common/logic/CashFlowLogic.php b/app/common/logic/CashFlowLogic.php index 9a1d0600..4f0a39bd 100644 --- a/app/common/logic/CashFlowLogic.php +++ b/app/common/logic/CashFlowLogic.php @@ -2,6 +2,7 @@ namespace app\common\logic; +use app\common\enum\YesNoEnum; use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow; class CashFlowLogic extends BaseLogic @@ -13,6 +14,7 @@ class CashFlowLogic extends BaseLogic $model->store_id = $storeId; $model->cash_price = $amount; $model->receivable = $amount; + $model->status = YesNoEnum::YES;//收银台收了默认算完成了 $model->save(); } diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index a0b9934e..701840de 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -548,24 +548,27 @@ class WorkbenchLogic extends BaseLogic public static function revenueStatistics($params) { - //当日营业额的统计 当日利润的统计 当日成本合集的统计 当日加到保证金的 当日的现金收银 + //当日营业额的统计 $today = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); $turnover_today = $today ->whereDay('create_time') ->sum('pay_price'); + //当日利润的统计 $profit_today = $today ->whereDay('create_time') ->sum('profit'); + //当日成本合集的统计 $cost_today = $today ->whereDay('create_time') ->sum('cost'); - $deposit = StoreFinanceFlow::where(['store_id'=>$params['store_id']]) + //当日加到保证金的 + $deposit = StoreFinanceFlow::where(['store_id'=>$params['store_id'],'status'=>YesNoEnum::YES]) ->where('financial_type',OrderEnum::ORDER_MARGIN); $deposit_today =$deposit ->whereDay('create_time') ->sum('number'); - + //当日的现金收银 $cash_today = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->whereDay('create_time') ->where('status',YesNoEnum::YES) @@ -574,8 +577,8 @@ 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'); + $deposit_all = StoreFinanceFlow::where(['store_id'=>$params['store_id'],'status'=>YesNoEnum::YES]) + ->sum('number'); $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->where('status',YesNoEnum::YES)