修改店铺盈收统计相关的数据和收银台下单后默认为成功

This commit is contained in:
liu 2024-06-18 10:47:26 +08:00
parent b5b364a3d1
commit a546ddd353
2 changed files with 10 additions and 5 deletions

View File

@ -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();
}

View File

@ -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)