Commit ee67b5c3 by 杨树贤

导出文件名

parent 2f53bf4b
Showing with 13 additions and 4 deletions
......@@ -832,8 +832,16 @@ class DataService
public static function exportSupplierByDepartment($topDepartmentId)
{
Excel::create('采购供应商数据导出', function ($excel) use ($topDepartmentId) {
if ($topDepartmentId == 47) {
$append = '联营一部';
}
if ($topDepartmentId == 51) {
$append = '自营采购部';
}
if ($topDepartmentId == 72) {
$append = '联营二部';
}
Excel::create('采购供应商数据导出_'.$append, function ($excel) use ($topDepartmentId) {
$departmentIds = DepartmentModel::where('parent_id', $topDepartmentId)->pluck('department_id')->toArray();
$userIds = UserInfoModel::whereIn('department_id', $departmentIds)->pluck('userId')->toArray();
$suppliers2022 = $suppliersZhangQi2022 = $suppliersAll = $suppliersZhangQi = [];
......@@ -848,7 +856,7 @@ class DataService
$supplier['supplier_name'],
$createTime,
];
if ($supplier['create_time'] >= 1640966400 - 3600 * 24 * 365) {
if ($supplier['create_time'] >= 1640966400) {
$suppliers2022[] = $data;
if ($supplier['pay_type'] == 1) {
$suppliersZhangQi2022[] = $data;
......@@ -873,6 +881,6 @@ class DataService
array_unshift($suppliersZhangQi, $header);
$sheet->fromArray($suppliersZhangQi);
});
})->export('xls');
})->store('xlsx');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment