修复导出问题 修复显示金额问题

This commit is contained in:
mkm 2023-05-30 17:21:09 +08:00
parent 51e993c128
commit e323a58efc
3 changed files with 28 additions and 14 deletions

View File

@ -515,8 +515,14 @@ class FinancialRecordRepository extends BaseRepository
$financialType = array_merge($financialType, $financialType1);
}
[$data['count_order'], $data['number_order']] = $this->dao->getDataByType($type, $where, $date, $financialType);
if (!empty($financialType1)){
$financialType1[0]=$financialType1[0].'_refund';
[$data['count_refund'], $data['number_refund']] = $this->dao->getDataByType($type, $where, $date, $financialType1);
$data['count_order']-=$data['count_refund'];
$data['number_order']-=$data['number_refund'];
}
if ($where['is_mer']) {
$financialType = ['order_platform_coupon'];
} else {
@ -640,15 +646,17 @@ class FinancialRecordRepository extends BaseRepository
$financialType = ['refund_svip_coupon'];
[$data['count_svipcoupon'], $data['number_svipcoupon']] = $this->dao->getDataByType($type, $where, $date, $financialType);
if (!empty($financialType1)){
[$data['count_commission'], $data['number_commission']] = $this->dao->getDataByType($type, $where, $date, $financialType1);
$data['count_brokerage']+=$data['count_commission'];
$data['number_brokerage']+=$data['number_commission'];
}
// if (!empty($financialType1)){
// $financialType2= [explode('_refund',$financialType1[0])[0]];
// halt($financialType1,$financialType2);
// [$data['count_commission'], $data['number_commission']] = $this->dao->getDataByType($type, $where, $date, $financialType1);
// [$data['count_commission2'], $data['number_commission2']] = $this->dao->getDataByType($type, $where, $date, $financialType2);
// $data['count_brokerage']+=$data['count_commission2']-$data['count_commission'];
// $data['number_brokerage']+=$data['number_commission2']-$data['number_commission'];
// }
//佣金 brokerage_one,brokerage_two - 退回佣金 refund_brokerage_two,refund_brokerage_one
$number = bcsub($data['number_brokerage'], $data['number_refund_brokerage'], 3);
//平台手续费 = order_charge + 预售手续费 presell_charge - 平台退给商户的手续费 refund_charge
$number_1 = bcsub($data['number_order_charge'], $data['number_charge'], 3);

View File

@ -141,7 +141,12 @@ class FinancialRecord extends BaseController
$where['date'] = empty($date) ? date('Y-m-d',time()) : $date ;
$where['type'] = $type;
$where['is_mer'] = $this->request->merId() ?? 0 ;
$data = app()->make(ExcelService::class)->exportFinancial($where,$page,$limit);
try {
$merchant = $this->request->merchant();
}catch (\Exception $e){
$merchant = [];
}
$data = app()->make(ExcelService::class)->exportFinancial($where,$page,$limit,$merchant);
// app()->make(ExcelRepository::class)->create($where, $this->request->adminId(), 'exportFinancial',$where['is_mer']);
return app('json')->success($data);
}

View File

@ -317,7 +317,7 @@ class ExcelService
* @author Qinii
* @day 3/25/21
*/
public function exportFinancial(array $where,int $page, int $limit)
public function exportFinancial(array $where,int $page, int $limit,$merchant=[])
{
/*
order 收入 公共 新订单
@ -367,8 +367,9 @@ class ExcelService
'commission_to_entry_merchant_refund'=> '退回平台佣金',
'commission_to_cloud_warehouse_refund'=> '退回平台佣金',
];
$sys_pm_1 = ['order','presell','order_charge','order_presell','presell_charge','refund_brokerage_one','refund_brokerage_two'];
$mer_pm_1 = ['order','presell','refund_charge','refund_brokerage_one','refund_brokerage_two','mer_presell','order_platform_coupon'];
$sys_pm_1 = ['order','presell','order_charge','order_presell','presell_charge','refund_brokerage_one','refund_brokerage_two','commission_to_platform'];
$mer_pm_1 = ['order','presell','refund_charge','refund_brokerage_one','refund_brokerage_two','mer_presell',
'order_platform_coupon','commission_to_cloud_warehouse','commission_to_entry_merchant','commission_to_town','commission_to_village','commission_to_service_team'];
$date_ = $where['date'];unset($where['date']);
$make = app()->make(FinancialRecordRepository::class);
@ -387,10 +388,10 @@ class ExcelService
}
$income = $make->countIncome($where['type'],$where,$date_,$merchant);
$expend = $make->countExpend($where['type'],$where,$date_,$merchant);
$income = $make->countIncome($where['type'],$where,$date_);
$expend = $make->countExpend($where['type'],$where,$date_);
$refund = $make->countRefund($where['type'],$where,$date_);
// $refund = $make->countRefund($where['type'],$where,$date_);
$charge = bcsub($income['number'],$expend['number'],2);
$filename = $title_.'('.$date_.')'.time();
$export = [];