From 7ba9c25610df3d8aa152141560313f918aff25dc Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 7 Aug 2020 16:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8A=E6=B8=B8=E5=AF=BC?= =?UTF-8?q?=E5=87=BA%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 36 ++++++++++++++++++- .../PHPExcel/PHPExcel/Style/NumberFormat.php | 1 + 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 045fff193..6822c9809 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1873,7 +1873,6 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); - date_default_timezone_set('Europe/London'); Vendor("PHPExcel.PHPExcel"); $objReader = \PHPExcel_IOFactory::createReader('Excel5'); @@ -1918,6 +1917,23 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_ } } else {//游戏 $product_name = $value['game_name']; + $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00); + $objPHPExcel->getActiveSheet()->getStyle('G'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00); + $objPHPExcel->getActiveSheet()->getStyle('H'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00); + $objPHPExcel->getActiveSheet()->getStyle('I'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_000); + if($value['first_ratio'] == 0){ + $value['first_ratio'] = 0; + }else{ + $value['first_ratio'] = number_format($value['first_ratio'], 2); + } + if($value['second_ratio'] == 0) { + $value['second_ratio'] = 0; + }else{ + $value['second_ratio'] = number_format($value['second_ratio'], 2); + } + if($value['promote_ratio'] == 0) $value['promote_ratio'] = 0; + if($value['fax_ratio'] == 0) $value['fax_ratio'] = 0; + $objPHPExcel->getActiveSheet()->setCellValue('F'.$line , $value['first_ratio'] . '%'); $objPHPExcel->getActiveSheet()->setCellValue('G'.$line, $value['second_ratio'] . '%'); $objPHPExcel->getActiveSheet()->setCellValue('H'.$line, $value['promote_ratio'] . '%'); @@ -2015,6 +2031,24 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al } } else {//游戏 $product_name = $value['game_name']; + + $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00); + $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_000); + $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00); + + if($value['increment_ratio'] == 0){ + $value['increment_ratio'] = 0; + }else{ + $value['increment_ratio'] = number_format($value['first_ratio'], 2); + } + if($value['ratio'] == 0) { + $value['ratio'] = 0; + }else{ + $value['ratio'] = number_format($value['ratio'], 2); + } + if($value['fax_ratio'] == 0) $value['fax_ratio'] = 0; + + if ($data['withdraw_type'] == 2) { $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['increment_ratio'] . '%'); }else{ diff --git a/ThinkPHP/Library/Vendor/PHPExcel/PHPExcel/Style/NumberFormat.php b/ThinkPHP/Library/Vendor/PHPExcel/PHPExcel/Style/NumberFormat.php index e8a978fb2..adaeb51c2 100644 --- a/ThinkPHP/Library/Vendor/PHPExcel/PHPExcel/Style/NumberFormat.php +++ b/ThinkPHP/Library/Vendor/PHPExcel/PHPExcel/Style/NumberFormat.php @@ -47,6 +47,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P const FORMAT_PERCENTAGE = '0%'; const FORMAT_PERCENTAGE_00 = '0.00%'; + const FORMAT_PERCENTAGE_000 = '0.000%'; const FORMAT_DATE_YYYYMMDD2 = 'yyyy-mm-dd'; const FORMAT_DATE_YYYYMMDD = 'yy-mm-dd';