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)