master
cody 2 years ago
parent 0fe331b372
commit c6843dc92e

@ -574,7 +574,7 @@ class StatisticsController extends CommonController
} }
// 获取所有订单数据 // 获取所有订单数据
$beds = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->get(); $beds = Bed::whereIn('area_id', $areaList->pluck('id'))->where('project_id', $project_id)->get();
// 订单总数 // 订单总数
$allOrderTotal = Orders::where('project_id', $project_id) $allOrderTotal = Orders::where('project_id', $project_id)
->where('created_at', 'like', '%' . $month . '%') ->where('created_at', 'like', '%' . $month . '%')
@ -589,34 +589,7 @@ class StatisticsController extends CommonController
$zongji['zengshishui'] = $total['zengshishui'] * 2; $zongji['zengshishui'] = $total['zengshishui'] * 2;
$zongji['shijishouru'] = $total['shijishouru'] - $refund['shijishouru']; $zongji['shijishouru'] = $total['shijishouru'] - $refund['shijishouru'];
$zongji['guanlifei'] = $total['guanlifei'] - $refund['guanlifei']; $zongji['guanlifei'] = $total['guanlifei'] - $refund['guanlifei'];
// 导出
if ($is_export) {
$area = $area->toArray();
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', '病区');
$sheet->setCellValue('B1', '护理费用(元)');
$sheet->setCellValue('C1', '手续费0.6%');
$sheet->setCellValue('D1', '增值税6%');
$sheet->setCellValue('E1', '实际收入(元)');
$sheet->setCellValue('F1', '院方管理费6%');
$count = count($area); //计算有多少条数据
for ($i = 2; $i <= $count + 1; $i++) {
$sheet->setCellValue('A' . $i, $area[$i - 2]['name']);
$sheet->setCellValue('B' . $i, $area[$i - 2]['order_total']);
$sheet->setCellValue('C' . $i, $area[$i - 2]['shouxufei']);
$sheet->setCellValue('D' . $i, $area[$i - 2]['zengshishui']);
$sheet->setCellValue('E' . $i, $area[$i - 2]['shijishouru']);
$sheet->setCellValue('F' . $i, $area[$i - 2]['guanlifei']);
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $project->name . '_' . date('YmdHis') . '.xlsx"');
header('Cache-Control: max-age=0');
$writer = new Xlsx($spreadsheet);
$writer->save('php://output');
exit;
}
$admin = Auth::guard("admin")->user(); $admin = Auth::guard("admin")->user();
return view($this->bladePath . ".income", compact("admin", "zongji", "refund", "total", "area", "project", "project_id", "month", "projects")); return view($this->bladePath . ".income", compact("admin", "zongji", "refund", "total", "area", "project", "project_id", "month", "projects"));
} }

Loading…
Cancel
Save