diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php
index cce8f5e11..d503e4f18 100644
--- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php
+++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php
@@ -262,23 +262,25 @@ class AggregateFinanceStatementController extends ThinkController
$this->display();
}
//导出
- public function export(){
- if(!isset($_REQUEST['ids'])) $this->error("参数错误");
- $ids = explode(",",$_REQUEST['ids']);
- foreach ($ids as $k => $v) {
- $this->doexport($v);
- }
- }
- private function doexport($id)
+ // public function export(){
+ // if(!isset($_REQUEST['ids'])) $this->error("参数错误");
+ // $ids = explode(",",$_REQUEST['ids']);
+ // foreach ($ids as $k => $v) {
+ // $this->doexport($v);
+ // }
+ // }
+ public function export()
{
+ if(!isset($_REQUEST['id'])) $this->error("参数错误");
+ $id = $_REQUEST['id'];
+
$data = M("aggregate_statement","tab_")->where("id = '{$id}'")->find();
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
$data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录
//收款方
- $big_pay_money = convertAmountToCn($data['pay_money']);//大写
-
+ $big_pay_money = convertAmountToCn($data['ratio_money']);//大写
$data['receive_company'] = $data['pay_type'] ? $data['first_party_info'] : $data['second_party_info'];
$data['pay_company'] = $data['pay_type'] ? $data['second_party_info'] : $data['first_party_info'];
$this->excelDownStreamTemplate($data,$big_pay_money);
@@ -353,16 +355,12 @@ class AggregateFinanceStatementController extends ThinkController
}else{
$fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}";
}
-
- // dd($fileName);
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
- $objWriter->save('php://output');
- exit;
-
+ $objWriter->save('php://output');
}
diff --git a/Application/Admin/View/AggregateFinanceStatement/lists.html b/Application/Admin/View/AggregateFinanceStatement/lists.html
index cbdf3cf55..72b77d20a 100644
--- a/Application/Admin/View/AggregateFinanceStatement/lists.html
+++ b/Application/Admin/View/AggregateFinanceStatement/lists.html
@@ -251,6 +251,7 @@
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
+
if(text.length > 2){
layer.msg("" + '暂不支持超过20条的批量导出' + "");
return;
@@ -259,9 +260,12 @@
layer.msg("" + '请先选择要导出的结算单' + "");
return;
}
- text = text.join(",");
- window.location.href = "{:U('export')}"+"&ids="+text;
-
+ for (var index = 0; index < text.length; index++) {
+ var id = text[index];
+ var url ="{:U('export')}"+"&id="+id;
+ var iframeExcel = ""//添加下载的地址到iframe,这里是公司信息,我用**表示了。
+ $("body").append(iframeExcel)
+ }
})
$("#shenhe").click(function () {