PayPal 收款记录增加国籍;去掉重复的收款记录

hotfix/paypal-note
Jimmy Liow 2 years ago
parent 0bf4ce88c6
commit c7e4e19f27

@ -1354,6 +1354,7 @@ class Index extends CI_Controller {
$currency = $this->input->post("currency"); $currency = $this->input->post("currency");
$amount = $this->input->post("set_amount"); $amount = $this->input->post("set_amount");
$last_record = $this->input->post("date_history"); $last_record = $this->input->post("date_history");
$filter_list = [];
if (empty($amount)) { if (empty($amount)) {
$export_list = $this->Note_model->date_range($from_date, $to_date, $currency, null, false); $export_list = $this->Note_model->date_range($from_date, $to_date, $currency, null, false);
} else { } else {
@ -1388,6 +1389,15 @@ class Index extends CI_Controller {
if ($export_list == false) { if ($export_list == false) {
echo "Not found any records for export."; echo "Not found any records for export.";
return false; return false;
} else {
// 过滤交易号重复的数据
$txn_list = [];
foreach ($export_list as $key => $row) {
if (!in_array($row->pn_txn_id, $txn_list)) {
$txn_list[] = $row->pn_txn_id;
$filter_list[] = $row;
}
}
} }
// 记录这次导出的最后一条 // 记录这次导出的最后一条
if (isset($all_list['last_flag']) && ! empty($all_list['last_flag'])) { if (isset($all_list['last_flag']) && ! empty($all_list['last_flag'])) {
@ -1406,12 +1416,12 @@ class Index extends CI_Controller {
); );
$this->Note_model->export_record($insert_db); $this->Note_model->export_record($insert_db);
// 修改导出的最后一条 // 修改导出的最后一条
array_pop($export_list); array_pop($filter_list);
$all_list['last_flag']->pn_mc_gross = $last_record_export; $all_list['last_flag']->pn_mc_gross = $last_record_export;
array_push($export_list, $all_list['last_flag']); array_push($filter_list, $all_list['last_flag']);
} }
$this->save_excel($export_list); $this->save_excel($filter_list);
} }
/*! /*!
@ -1464,6 +1474,7 @@ class Index extends CI_Controller {
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20); $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
// 对齐 // 对齐
$objPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); $objPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
@ -1477,7 +1488,8 @@ class Index extends CI_Controller {
->SetCellValue('E1', '付款人') ->SetCellValue('E1', '付款人')
->SetCellValue('F1', '付款人邮箱') ->SetCellValue('F1', '付款人邮箱')
->SetCellValue('G1', '交易号') ->SetCellValue('G1', '交易号')
->SetCellValue('H1', '收单时间'); ->SetCellValue('H1', '收单时间')
->SetCellValue('I1', '付款人国籍');
$currency_sum = array(); $currency_sum = array();
bcscale(2); bcscale(2);
$rowCount = 2; $rowCount = 2;
@ -1496,7 +1508,8 @@ class Index extends CI_Controller {
->SetCellValue('E'.$rowCount, $row->pn_payer) ->SetCellValue('E'.$rowCount, $row->pn_payer)
->SetCellValue('F'.$rowCount, $row->pn_payer_email) ->SetCellValue('F'.$rowCount, $row->pn_payer_email)
->setCellValueExplicit('G'.$rowCount, $row->pn_txn_id,PHPExcel_Cell_DataType::TYPE_STRING) ->setCellValueExplicit('G'.$rowCount, $row->pn_txn_id,PHPExcel_Cell_DataType::TYPE_STRING)
->SetCellValue('H'.$rowCount, $row->pn_datetime); ->SetCellValue('H'.$rowCount, $row->pn_datetime)
->SetCellValue('I'.$rowCount, $row->payer_country);
$payer = $orderid = ""; $payer = $orderid = "";
$rowCount++; $rowCount++;
} }

@ -101,7 +101,7 @@ class Note_model extends CI_Model {
$sql .= " $sql .= "
pn.pn_sn pn.pn_sn
,pn.pn_txn_id ,pn.pn_txn_id
--,pn.pn_invoice ,dbo.GetOrderCusCountry(pn_invoice) as payer_country
,replace(replace(pn.pn_invoice,char(13),' '),char(10),' ') pn_invoice ,replace(replace(pn.pn_invoice,char(13),' '),char(10),' ') pn_invoice
,pn.pn_custom ,pn.pn_custom
,pn.pn_mc_gross ,pn.pn_mc_gross
@ -122,7 +122,7 @@ class Note_model extends CI_Model {
$this->search ? $sql.=$this->search : false; $this->search ? $sql.=$this->search : false;
$this->pn_txn_id ? $sql.=$this->pn_txn_id : false; $this->pn_txn_id ? $sql.=$this->pn_txn_id : false;
$this->orderby ? $sql.=$this->orderby : false; $this->orderby ? $sql.=$this->orderby : false;
// log_message('error',$sql); // log_message('error', 'DEBUG: '.$sql);
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
//print_r($this->HT->queries); //print_r($this->HT->queries);
if ($this->topnum === 1) { if ($this->topnum === 1) {

Loading…
Cancel
Save