ipaylinks 导出收款记录,打印给银行用

feature/trippest
lyt 7 years ago
parent 36003c5d00
commit 3e49a01c98

@ -1200,4 +1200,71 @@ class IPayLinksService extends CI_Controller
); );
} }
public function export_list()
{
$from_date = $this->input->post("from_date");
$to_date = $this->input->post("to_date");
$currency = $this->input->post("currency");
$export_list = $this->Note_model->date_range($from_date, $to_date, $currency);
if ($export_list == false) {
echo "Not found any records for export.";
return false;
}
$this->load->library('PHPExcel');
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
//set width
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
// 对齐
$objPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
// 表标题行
$objPHPExcel->getActiveSheet()
->SetCellValue('A1', '#')
->SetCellValue('B1', '团号')
->SetCellValue('C1', '金额')
->SetCellValue('D1', '付款人')
->SetCellValue('E1', '交易号')
->SetCellValue('F1', '收单时间');
$currency_sum = array();
bcscale(2);
$rowCount = 2;
foreach ($export_list as $key => $row) {
if( trim($row->IPL_currencyCode) != "") {
$currency_sum[trim($row->IPL_currencyCode)] = bcadd($currency_sum[trim($row->IPL_currencyCode)], $row->IPL_orderAmount);
}
$payer = $row->IPL_payerName ? ($row->IPL_payerName . "<" . $row->IPL_payerEmail . ">") : "退款";
$objPHPExcel->getActiveSheet()
->SetCellValue('A'.$rowCount, ($rowCount-1))
->setCellValueExplicit('B'.$rowCount, $row->IPL_orderId,PHPExcel_Cell_DataType::TYPE_STRING)
->setCellValueExplicit('C'.$rowCount, trim($row->IPL_currencyCode) . number_format($row->IPL_orderAmount, 2, ".", ""),PHPExcel_Cell_DataType::TYPE_STRING)
->SetCellValue('D'.$rowCount, $payer)
->setCellValueExplicit('E'.$rowCount, $row->IPL_dealId,PHPExcel_Cell_DataType::TYPE_STRING)
->SetCellValue('F'.$rowCount, $row->IPL_acquiringTime);
$payer = "";
$rowCount++;
}
$rowCount++; // 隔一行
// 汇总行
$objPHPExcel->getActiveSheet()
->SetCellValue('A' . $rowCount, '合计');
foreach ($currency_sum as $kc => $cur) {
$objPHPExcel->getActiveSheet()
->SetCellValue('B' . $rowCount, $kc)
->setCellValueExplicit('C' . $rowCount, number_format($cur, 2, ".", ""),PHPExcel_Cell_DataType::TYPE_STRING);
$rowCount++;
}
$filename = "export_ipaylinks_" . date('Y-m-d');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $filename . '.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
} }

@ -273,4 +273,17 @@ class Note_model extends CI_Model {
return $query; return $query;
} }
public function date_range($from, $to, $currency=NULL)
{
$this->init();
$search_sql = " AND pn.IPL_resultCode='0000' ";
$search_sql .= " AND pn.IPL_acquiringTime BETWEEN '$from 00:00:00' AND '$to 23:59:59' ";
if ( ! empty($currency)) {
$search_sql .= " AND IPL_currencyCode = '$currency' ";
}
$this->search = $search_sql;
$this->orderby = "";
return $this->get_list();
}
} }

@ -23,7 +23,7 @@
<style type="text/css"> <style type="text/css">
p{margin-bottom: 8.5px;} p{margin-bottom: 8.5px;}
a{text-decoration: none;} a{text-decoration: none;}
.navbar-header h1{display: inline-block;margin-left: 30px;} .navbar-header h1{display: inline-block;margin-left: 30px;margin-right: 30px;}
.pageTitle{margin-left: 300px;} .pageTitle{margin-left: 300px;}
.pageTitle h1{color: #fff;border:none;font-size: 30px;} .pageTitle h1{color: #fff;border:none;font-size: 30px;}
.mobileTitle h1{color: #fff;border:none;font-size: 20px;} .mobileTitle h1{color: #fff;border:none;font-size: 20px;}
@ -39,24 +39,51 @@
/*.input-group{border: 1px solid #ccc;}*/ /*.input-group{border: 1px solid #ccc;}*/
.input-group-btn{border: 1px solid #ccc;padding: 5px;} .input-group-btn{border: 1px solid #ccc;padding: 5px;}
.search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;} .search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;}
.export_form_area{display: inline-block;padding: 6px;border: 1px solid #ccc;background-color: #ccc;}
</style> </style>
</head> </head>
<body> <body>
<div id="wrapper" class="chkVisible"> <div id="wrapper" class="chkVisible print-none">
<div class="navbar-header" style="float:none;border-bottom: 1px solid #ccc;"> <div class="navbar-header" style="float:none;border-bottom: 1px solid #ccc;">
<a class="navbar-brand text-muted" style="height: 52px;padding-top: 7px;padding-left: 30px;" href="http://www.mycht.cn/webht.php/index/index"> <a class="navbar-brand text-muted" style="height: 52px;padding-top: 7px;padding-left: 30px;" href="http://www.mycht.cn/webht.php/index/index">
<img width="150" style="height:40px;" src="/css/nav/img/6000.png"> <img width="150" style="height:40px;" src="/css/nav/img/6000.png">
</a> </a>
<h1>iPayLinks Notes</h1> <h1>iPayLinks Notes</h1>
<ul class="nav navbar-nav navbar-right pull-right" style="margin:7.5px 0;">
</ul> <div class="export_form_area ">
<form class="form-inline " method="post" id="search_list" action="/webht.php/apps/pay/ipaylinksservice/export_list/">
<div class="form-group ">
<label for="from_date" class="">Date From</label>
<input type="text" class="form-control" id="from_date" name="from_date" required>
</div>
<div class="form-group ">
<label for="to_date" class="">To</label>
<input type="text" class="form-control" id="to_date" name="to_date" required>
</div>
<div class="form-group ">
<label for="currency" class="">Currency</label>
<select class="form-control" id="currency" name="currency">
<option value="">All</option>
<option value="CNY">CNY</option>
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="CAD">CAD</option>
<option value="AUD">AUD</option>
<option value="GBP">GBP</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Export</button>
</form>
</div>
</div> </div>
</div> </div>
<div id="content"> <div id="content">
<div class="container-fluid marginTop"> <div class="container-fluid marginTop">
<div class="row"> <div class="row">
<!-- left --> <!-- left -->
<div class="col-md-4 col-xs-24"> <div class="col-md-4 col-xs-24 print-none">
<div class="row"> <div class="row">
<form method="post" id="search_list" action="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_list/"> <form method="post" id="search_list" action="http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/note_list/">
<div class="input-group"> <div class="input-group">
@ -95,8 +122,8 @@
<li class="col-sm-5 "><strong>付款人</strong></li> <li class="col-sm-5 "><strong>付款人</strong></li>
<li class="col-sm-4 "><strong>交易号</strong></li> <li class="col-sm-4 "><strong>交易号</strong></li>
<li class="col-sm-3 "><strong>收单时间</strong></li> <li class="col-sm-3 "><strong>收单时间</strong></li>
<li class="col-sm-3 "><strong>通知时间</strong></li> <li class="col-sm-3 print-none"><strong>通知时间</strong></li>
<li class="col-sm-2 "><strong>通知状态</strong></li> <li class="col-sm-2 print-none"><strong>通知状态</strong></li>
</a> </a>
</ul> </ul>
<?php <?php
@ -125,8 +152,8 @@
<li class="col-sm-4 nopadding-L" style="overflow:hidden;word-break: break-all;"><?php echo $item->IPL_dealId; ?></li> <li class="col-sm-4 nopadding-L" style="overflow:hidden;word-break: break-all;"><?php echo $item->IPL_dealId; ?></li>
<li class="col-sm-3 nopadding-L" style="overflow:hidden;word-break: break-all;"><?php echo $item->IPL_acquiringTime; ?></li> <li class="col-sm-3 nopadding-L" style="overflow:hidden;word-break: break-all;"><?php echo $item->IPL_acquiringTime; ?></li>
<li class="col-sm-3 nopadding-L" ><?php echo $item->IPL_noticeTime; ?></li> <li class="col-sm-3 nopadding-L print-none" ><?php echo $item->IPL_noticeTime; ?></li>
<li class="col-sm-2" > <li class="col-sm-2 print-none" >
<?php <?php
$show_send = ''; $show_send = '';
$class_css = ''; $class_css = '';
@ -146,7 +173,7 @@
<?php } ?> <?php } ?>
</div> </div>
<!-- </div> --> <!-- </div> -->
<div class="pay_footer text-right"> <div class="pay_footer text-right print-none">
<p>© 1998 China Highlights. <p>© 1998 China Highlights.
<a href="https://www.chinahighlights.com/privacy.htm" rel="nofollow">Privacy Statement</a> <a href="https://www.chinahighlights.com/privacy.htm" rel="nofollow">Privacy Statement</a>
</p> </p>
@ -194,6 +221,39 @@
}); });
$(".ui-datepicker").css('width', '15.7em'); $(".ui-datepicker").css('width', '15.7em');
var dateFormat = "yy-mm-dd",
from = $( "#from_date" )
.datepicker({
// defaultDate: "+1w",
dateFormat: dateFormat,
changeMonth: true,
changeYear: true,
numberOfMonths: 1
})
.on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#to_date" ).datepicker({
// defaultDate: "+1w",
dateFormat: dateFormat,
changeMonth: true,
changeYear: true,
numberOfMonths: 1
})
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
}); });
function show_order_modal(pn_txn_id, pn_invoice,noticeTime,old_order) { function show_order_modal(pn_txn_id, pn_invoice,noticeTime,old_order) {
if (pn_txn_id) { if (pn_txn_id) {

Loading…
Cancel
Save