修改财务账单下载
This commit is contained in:
parent
b6d3f684c3
commit
8dd5c1c00c
@ -50,4 +50,25 @@ class FinancialRecord extends BaseModel
|
||||
{
|
||||
return $this->hasOne(StoreRefundOrder::class,'refund_order_sn','order_sn');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取备注
|
||||
* @return string
|
||||
*/
|
||||
public function getMark()
|
||||
{
|
||||
switch ($this->financial_type) {
|
||||
case 'commission_to_platform':
|
||||
return '平台手续费:' . $this->number;
|
||||
case 'platform_consumption':
|
||||
return '平台优惠:' . $this->number;
|
||||
case 'auto_margin':
|
||||
return '保证金:' . $this->number;
|
||||
case 'commission_to_promoter':
|
||||
return '推广佣金:' . $this->number;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
namespace crmeb\services;
|
||||
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\common\repositories\store\order\StoreImportDeliveryRepository;
|
||||
use app\common\repositories\store\order\StoreOrderProfitsharingRepository;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
@ -355,34 +356,46 @@ class ExcelService
|
||||
$limit = 20;
|
||||
$count = $query->count();
|
||||
$i = 1;
|
||||
/** @var StoreOrderRepository $order_make */
|
||||
$order_make = app()->make(StoreOrderRepository::class);
|
||||
//平台
|
||||
if (!$where['is_mer']) {
|
||||
$header = ['商户类别', '商户分类', '商户名称', '总订单号', '订单编号', '交易流水号', '交易时间', '对方信息', '交易类型', '收支金额', '备注'];
|
||||
$list = $query->page($page, $limit)->order('create_time DESC')->select();
|
||||
foreach ($list as $k => $value) {
|
||||
$order = $order_make->get($value['order_id']);
|
||||
if ($value['merchant']) {
|
||||
$export[$k] = [
|
||||
$value['merchant']['is_trader'] ? '自营' : '非自营',
|
||||
$value['merchant']['merchantCategory']['category_name'] ?? '平台',
|
||||
$value['merchant']['mer_name'] ?? '平台',
|
||||
$list = $query->where('financial_type', 'order')->page($page, $limit)->order('create_time DESC')->select();
|
||||
foreach ($list as $financialRecord) {
|
||||
$otherRecords = FinancialRecord::where('order_id', $financialRecord['order_id'])
|
||||
->where('financial_type', '<>', 'order')
|
||||
->field('financial_type,number')
|
||||
->select();
|
||||
$mark = [];
|
||||
foreach ($otherRecords as $otherRecord) {
|
||||
/** @var FinancialRecord $otherRecord */
|
||||
if (!empty($otherRecord->getMark())) {
|
||||
$mark[] = $otherRecord->getMark();
|
||||
}
|
||||
}
|
||||
if ($financialRecord['merchant']) {
|
||||
$exportItem = [
|
||||
$financialRecord['merchant']['is_trader'] ? '自营' : '非自营',
|
||||
$financialRecord['merchant']['merchantCategory']['category_name'] ?? '平台',
|
||||
$financialRecord['merchant']['mer_name'] ?? '平台',
|
||||
];
|
||||
}else{
|
||||
$export[$k] = [
|
||||
$exportItem = [
|
||||
'平台',
|
||||
'平台',
|
||||
'平台',
|
||||
];
|
||||
}
|
||||
$export[$k][] = ['groupOrder']['group_order_sn'] ?? '无数据';
|
||||
$export[$k][] = $value['order_sn'];
|
||||
$export[$k][] = $value['financial_record_sn'];
|
||||
$export[$k][] = $value['create_time'];
|
||||
$export[$k][] = $value['user_info'];
|
||||
$export[$k][] = $financialType[$value['financial_type']];
|
||||
$export[$k][] = (in_array($value['financial_type'], $sys_pm_1) ? '+' : '-') . $value['number'];
|
||||
$export[$k][] = '';
|
||||
$exportItem[] = ['groupOrder']['group_order_sn'] ?? '无数据';
|
||||
$exportItem[] = $financialRecord['order_sn'];
|
||||
$exportItem[] = $financialRecord['financial_record_sn'];
|
||||
$exportItem[] = $financialRecord['create_time'];
|
||||
$exportItem[] = $financialRecord['user_info'];
|
||||
$exportItem[] = $financialType[$financialRecord['financial_type']];
|
||||
$exportItem[] = (in_array($financialRecord['financial_type'], $sys_pm_1) ? '+' : '-') . $financialRecord['number'];
|
||||
$exportItem[] = implode(',', $mark);
|
||||
$export[] = $exportItem;
|
||||
}
|
||||
$foot = [
|
||||
'合计:平台应入账手续费 ' . $charge,
|
||||
|
Loading…
x
Reference in New Issue
Block a user