123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- namespace App\Http\Controllers\Manage\Finance;
- use App\Http\Controllers\Manage\Finance\Transformers\PaymentStatisticTransformer;
- use App\Modules\Finance\Services\PaymentStatisticService;
- use Illuminate\Http\Request;
- class PaymentStatisticController extends BaseController
- {
-
- function get_list_day(Request $request) {
- $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
- $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
- $end_time = self::getMaxDay($end_time);
- $payments = PaymentStatisticService::getGroupByDayDataStatistic($start_time, $end_time);
- return response()->pagination(new PaymentStatisticTransformer(), $payments);
- }
-
- function get_list_day_export(Request $request) {
- $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
- $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
- $end_time = self::getMaxDay($end_time);
- $payments = PaymentStatisticService::getGroupByDayDataStatistic($start_time, $end_time, true);
- header("Content-type:application/vnd.ms-excel");
- header("Content-Disposition:attachment;filename=" . "对账统计" . date("YmdHis") . ".csv");
- echo iconv("UTF-8","GBK","\"操作日期\",\"打款成功金额\",\"打款成功笔数\",\"对私成功金额\",\"对私成功笔数\",\"对公成功金额\",\"对公成功笔数\",\"审核不通过金额\",\"审核不通过笔数\",\"打款失败金额\",\"打款失败笔数\",\"扣税金额\"\r\n");
- if($payments)
- {
- foreach($payments as $item)
- {
- echo("\"" . iconv("UTF-8","GBK",date('Y-m-d H:i:s',strtotime($item->created_at))) . "\",");
- echo("\"" . $item->amount . "\",");
- echo("\"" . $item->amount_num . "\",");
- echo("\"" . $item->amount_person . "\",");
- echo("\"" . $item->amount_person_num . "\",");
- echo("\"" . $item->amount_company . "\",");
- echo("\"" . $item->amount_company_num . "\",");
- echo("\"" . $item->amount_audit_fail . "\",");
- echo("\"" . ($item->amount_audit_fail_num) . "\",");
- echo("\"" . $item->amount_fail . "\",");
- echo("\"" . $item->amount_fail_num . "\",");
- echo("\"" . $item->tallage . "\"\r\n");
- }
- }
- exit();
- }
- }
|