Commit d5563313 by 杨树贤

导出数据

parent 0ce0036d
...@@ -851,9 +851,11 @@ class DataService ...@@ -851,9 +851,11 @@ class DataService
foreach ($suppliersAll as $supplier) { foreach ($suppliersAll as $supplier) {
$createTime = date('Y-m-d H:i:s', $supplier['create_time']); $createTime = date('Y-m-d H:i:s', $supplier['create_time']);
$creatName = UserInfoModel::where('userId', $supplier['create_uid'])->value('name'); $creatName = UserInfoModel::where('userId', $supplier['create_uid'])->value('name');
$supplierGroup = array_get(config('fixed.SupplierGroup'),$supplier['supplier_group']);
$data = [ $data = [
$creatName, $creatName,
$supplier['supplier_name'], $supplier['supplier_name'],
$supplierGroup,
$createTime, $createTime,
]; ];
if ($supplier['create_time'] >= 1640966400) { if ($supplier['create_time'] >= 1640966400) {
...@@ -866,21 +868,28 @@ class DataService ...@@ -866,21 +868,28 @@ class DataService
if ($supplier['pay_type'] == 1) { if ($supplier['pay_type'] == 1) {
$suppliersZhangQi[] = $data; $suppliersZhangQi[] = $data;
} }
$suppliersAllList[] = $data;
} }
$header = ['创建人', '供应商名称', '创建时间']; $header = ['创建人', '供应商名称','供应商性质', '创建时间'];
// dd($suppliersZhangQi,$header); // dd($suppliersZhangQi,$header);
$excel->sheet('2022年创建的供应商', function ($sheet) use ($header, $suppliers2022) { // $excel->sheet('2022年创建的供应商', function ($sheet) use ($header, $suppliers2022) {
array_unshift($suppliers2022, $header); // array_unshift($suppliers2022, $header);
$sheet->fromArray($suppliers2022); // $sheet->fromArray($suppliers2022);
}); // });
$excel->sheet('2022年创建的账期供应商', function ($sheet) use ($header, $suppliersZhangQi2022) { // $excel->sheet('2022年创建的账期供应商', function ($sheet) use ($header, $suppliersZhangQi2022) {
array_unshift($suppliersZhangQi2022, $header); // array_unshift($suppliersZhangQi2022, $header);
$sheet->fromArray($suppliersZhangQi2022); // $sheet->fromArray($suppliersZhangQi2022);
}); // });
$excel->sheet('全部账期供应商', function ($sheet) use ($header, $suppliersZhangQi) { // $excel->sheet('全部账期供应商', function ($sheet) use ($header, $suppliersZhangQi) {
array_unshift($suppliersZhangQi, $header); // array_unshift($suppliersZhangQi, $header);
$sheet->fromArray($suppliersZhangQi); // $sheet->fromArray($suppliersZhangQi);
// });
$excel->sheet('全部供应商', function ($sheet) use ($header, $suppliersAllList) {
array_unshift($suppliersAllList, $header);
$sheet->fromArray($suppliersAllList);
}); });
})->store('xlsx'); })->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