修改财务账单下载
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 $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;
|
namespace crmeb\services;
|
||||||
|
|
||||||
|
use app\common\model\system\merchant\FinancialRecord;
|
||||||
use app\common\repositories\store\order\StoreImportDeliveryRepository;
|
use app\common\repositories\store\order\StoreImportDeliveryRepository;
|
||||||
use app\common\repositories\store\order\StoreOrderProfitsharingRepository;
|
use app\common\repositories\store\order\StoreOrderProfitsharingRepository;
|
||||||
use app\common\repositories\store\order\StoreOrderRepository;
|
use app\common\repositories\store\order\StoreOrderRepository;
|
||||||
@ -355,34 +356,46 @@ class ExcelService
|
|||||||
$limit = 20;
|
$limit = 20;
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
/** @var StoreOrderRepository $order_make */
|
||||||
$order_make = app()->make(StoreOrderRepository::class);
|
$order_make = app()->make(StoreOrderRepository::class);
|
||||||
//平台
|
//平台
|
||||||
if (!$where['is_mer']) {
|
if (!$where['is_mer']) {
|
||||||
$header = ['商户类别', '商户分类', '商户名称', '总订单号', '订单编号', '交易流水号', '交易时间', '对方信息', '交易类型', '收支金额', '备注'];
|
$header = ['商户类别', '商户分类', '商户名称', '总订单号', '订单编号', '交易流水号', '交易时间', '对方信息', '交易类型', '收支金额', '备注'];
|
||||||
$list = $query->page($page, $limit)->order('create_time DESC')->select();
|
$list = $query->where('financial_type', 'order')->page($page, $limit)->order('create_time DESC')->select();
|
||||||
foreach ($list as $k => $value) {
|
foreach ($list as $financialRecord) {
|
||||||
$order = $order_make->get($value['order_id']);
|
$otherRecords = FinancialRecord::where('order_id', $financialRecord['order_id'])
|
||||||
if ($value['merchant']) {
|
->where('financial_type', '<>', 'order')
|
||||||
$export[$k] = [
|
->field('financial_type,number')
|
||||||
$value['merchant']['is_trader'] ? '自营' : '非自营',
|
->select();
|
||||||
$value['merchant']['merchantCategory']['category_name'] ?? '平台',
|
$mark = [];
|
||||||
$value['merchant']['mer_name'] ?? '平台',
|
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{
|
}else{
|
||||||
$export[$k] = [
|
$exportItem = [
|
||||||
'平台',
|
'平台',
|
||||||
'平台',
|
'平台',
|
||||||
'平台',
|
'平台',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$export[$k][] = ['groupOrder']['group_order_sn'] ?? '无数据';
|
$exportItem[] = ['groupOrder']['group_order_sn'] ?? '无数据';
|
||||||
$export[$k][] = $value['order_sn'];
|
$exportItem[] = $financialRecord['order_sn'];
|
||||||
$export[$k][] = $value['financial_record_sn'];
|
$exportItem[] = $financialRecord['financial_record_sn'];
|
||||||
$export[$k][] = $value['create_time'];
|
$exportItem[] = $financialRecord['create_time'];
|
||||||
$export[$k][] = $value['user_info'];
|
$exportItem[] = $financialRecord['user_info'];
|
||||||
$export[$k][] = $financialType[$value['financial_type']];
|
$exportItem[] = $financialType[$financialRecord['financial_type']];
|
||||||
$export[$k][] = (in_array($value['financial_type'], $sys_pm_1) ? '+' : '-') . $value['number'];
|
$exportItem[] = (in_array($financialRecord['financial_type'], $sys_pm_1) ? '+' : '-') . $financialRecord['number'];
|
||||||
$export[$k][] = '';
|
$exportItem[] = implode(',', $mark);
|
||||||
|
$export[] = $exportItem;
|
||||||
}
|
}
|
||||||
$foot = [
|
$foot = [
|
||||||
'合计:平台应入账手续费 ' . $charge,
|
'合计:平台应入账手续费 ' . $charge,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user