|
|
@ -375,55 +375,102 @@ class Online_payment_account_model extends CI_Model {
|
|
|
|
public function get_refund_imported()
|
|
|
|
public function get_refund_imported()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$ret = array();
|
|
|
|
$ret = array();
|
|
|
|
$paypal_sql = "SELECT 'paypal' as 'payment_type', pn_sn note_sn, pn_txn_id transaction_id,
|
|
|
|
$send_flag = "send-to-finance";
|
|
|
|
(select DEI_DepartmentName from OperatorInfo inner join DepartmentInfo on OPI_DEI_SN=DEI_SN
|
|
|
|
$paypal_sql = "SELECT 'paypal' as payment_type,
|
|
|
|
where OPI_SN=ISNULL(coli.COLI_OPI_ID, bcoli.COLI_OPI_ID)) as department,
|
|
|
|
pn_sn note_sn,pn_txn_id transaction_id,
|
|
|
|
(select GRI_Name from GRoupInfo where gri_sn=ISNULL(coli.COLI_GRI_SN,bcoli.COLI_GRI_SN)) as gri_name,
|
|
|
|
(select DEI_DepartmentName from OperatorInfo inner join DepartmentInfo on OPI_DEI_SN=DEI_SN
|
|
|
|
|
|
|
|
where OPI_SN=ISNULL(table_t.COLI_OPI_ID, isnull(table_b.COLI_OPI_ID,table_app.COLI_OPI_ID))
|
|
|
|
|
|
|
|
) as department,
|
|
|
|
|
|
|
|
case when ISNULL(table_t.COLI_GRI_SN,table_b.COLI_GRI_SN) is null
|
|
|
|
|
|
|
|
then isnull(table_app.COLI_GroupCode,table_app.COLI_ID)
|
|
|
|
|
|
|
|
else (select GRI_Name from GRoupInfo
|
|
|
|
|
|
|
|
where gri_sn=ISNULL(table_t.COLI_GRI_SN,table_b.COLI_GRI_SN)
|
|
|
|
|
|
|
|
) end as gri_name,
|
|
|
|
pn.pn_payment_date payment_date,
|
|
|
|
pn.pn_payment_date payment_date,
|
|
|
|
pn.pn_mc_gross amount,pn_mc_currency currency,
|
|
|
|
pn.pn_mc_gross amount,pn_mc_currency currency,
|
|
|
|
isnull(gai.GAI_SSJE,bgai.GAI_SSJE) amount_CNY,
|
|
|
|
isnull(table_t.GAI_SSJE,isnull(table_b.GAI_SSJE,table_app.GAI_SSJE)) amount_CNY,
|
|
|
|
pn_payer payer,pn_payer_email payer_email
|
|
|
|
pn_payer payer,pn_payer_email payer_email
|
|
|
|
from paypal_note pn
|
|
|
|
from paypal_note pn
|
|
|
|
left join GroupAccountInfo gai on gai.GAI_AccreditNo=pn.pn_txn_id
|
|
|
|
left join (
|
|
|
|
left join ConfirmLineInfo coli on coli.COLI_SN=gai.GAI_COLI_SN
|
|
|
|
select gai.GAI_SSJE,gai.GAI_AccreditNo ,coli.COLI_GRI_SN,coli.COLI_OPI_ID,coli.COLI_SN
|
|
|
|
left join BIZ_GroupAccountInfo bgai on bgai.GAI_AccreditNo=pn.pn_txn_id
|
|
|
|
from GroupAccountInfo gai inner join ConfirmLineInfo coli on coli.COLI_SN=gai.GAI_COLI_SN
|
|
|
|
left join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
) as table_t on table_t.GAI_AccreditNo=pn.pn_txn_id
|
|
|
|
where pn_send='send-to-finance' ";
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select bgai.GAI_AccreditNo,bgai.GAI_SSJE ,bcoli.COLI_GRI_SN,bcoli.COLI_OPI_ID,bcoli.COLI_SN
|
|
|
|
|
|
|
|
from BIZ_GroupAccountInfo bgai inner join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_b on table_b.GAI_AccreditNo=pn.pn_txn_id
|
|
|
|
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select bgai.GAI_AccreditNo,bgai.GAI_SSJE,bgai.GAI_SQJE,bgai.GAI_SQJECurrency ,bcoli.COLI_GRI_SN,bcoli.COLI_OPI_ID,bcoli.COLI_SN ,bcoli.COLI_id ,bcoli.COLI_GroupCode
|
|
|
|
|
|
|
|
from BIZ_GroupAccountInfo bgai inner join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_app on table_app.COLI_ID=REPLACE ( pn_invoice , '_B' , '' )
|
|
|
|
|
|
|
|
and pn.pn_mc_gross=table_app.GAI_SQJE and pn.pn_mc_currency=table_app.GAI_SQJECurrency
|
|
|
|
|
|
|
|
where pn_send='$send_flag'
|
|
|
|
|
|
|
|
order by department ";
|
|
|
|
$ret = $paypal_list = $this->HT->query($paypal_sql)->result_array();
|
|
|
|
$ret = $paypal_list = $this->HT->query($paypal_sql)->result_array();
|
|
|
|
$ipaylinks_sql = "SELECT 'ipaylinks' as 'payment_type', IPL_sn note_sn,IPL_dealId transaction_id,
|
|
|
|
$ipaylinks_sql = "SELECT 'ipaylinks' as 'payment_type', IPL_sn note_sn,IPL_dealId transaction_id,
|
|
|
|
(select DEI_DepartmentName from OperatorInfo inner join DepartmentInfo on OPI_DEI_SN=DEI_SN
|
|
|
|
(select DEI_DepartmentName from OperatorInfo inner join DepartmentInfo on OPI_DEI_SN=DEI_SN
|
|
|
|
where OPI_SN=ISNULL(coli.COLI_OPI_ID, bcoli.COLI_OPI_ID)) as department,
|
|
|
|
where OPI_SN=ISNULL(table_t.COLI_OPI_ID, isnull(table_b.COLI_OPI_ID,table_app.COLI_OPI_ID))
|
|
|
|
(select GRI_Name from GRoupInfo where gri_sn=ISNULL(coli.COLI_GRI_SN,bcoli.COLI_GRI_SN)) as gri_name,
|
|
|
|
) as department,
|
|
|
|
|
|
|
|
case when ISNULL(table_t.COLI_GRI_SN,table_b.COLI_GRI_SN) is null
|
|
|
|
|
|
|
|
then isnull(table_app.COLI_GroupCode,table_app.COLI_ID)
|
|
|
|
|
|
|
|
else (select GRI_Name from GRoupInfo
|
|
|
|
|
|
|
|
where gri_sn=ISNULL(table_t.COLI_GRI_SN,table_b.COLI_GRI_SN)
|
|
|
|
|
|
|
|
) end as gri_name,
|
|
|
|
pn.IPL_completeTime payment_date,
|
|
|
|
pn.IPL_completeTime payment_date,
|
|
|
|
pn.IPL_orderAmount amount,
|
|
|
|
pn.IPL_orderAmount amount,
|
|
|
|
isnull(IPL_currencyCode,isnull(gai.GAI_SQJECurrency,bgai.GAI_SQJECurrency)) currency,
|
|
|
|
isnull(IPL_currencyCode,isnull(table_t.GAI_SQJECurrency,isnull(table_b.GAI_SQJECurrency,table_app.GAI_SQJECurrency))) currency,
|
|
|
|
isnull(gai.GAI_SSJE,bgai.GAI_SSJE) amount_CNY,
|
|
|
|
isnull(table_t.GAI_SSJE,isnull(table_b.GAI_SSJE,table_app.GAI_SSJE)) amount_CNY,
|
|
|
|
isnull(IPL_payerName,isnull(gai.GAI_CusName,bgai.GAI_CusName)) payer,
|
|
|
|
isnull(IPL_payerName,isnull(table_t.GAI_CusName,isnull(table_b.GAI_CusName,table_app.GAI_CusName))) payer,
|
|
|
|
isnull(IPL_payerEmail,ISNULL(gai.gai_cusEmail,bgai.gai_cusemail)) payer_email
|
|
|
|
isnull(IPL_payerEmail,ISNULL(table_t.gai_cusEmail,isnull(table_b.gai_cusemail,table_app.gai_cusemail))) payer_email
|
|
|
|
from InfoManager.dbo.IPayLinksLog pn
|
|
|
|
from InfoManager.dbo.IPayLinksLog pn
|
|
|
|
left join GroupAccountInfo gai on gai.GAI_AccreditNo=pn.IPL_dealId
|
|
|
|
left join (
|
|
|
|
left join ConfirmLineInfo coli on coli.COLI_SN=gai.GAI_COLI_SN
|
|
|
|
select gai.GAI_SQJECurrency,gai.GAI_CusName,gai.gai_cusEmail, gai.GAI_SSJE,gai.GAI_AccreditNo ,coli.COLI_GRI_SN,coli.COLI_OPI_ID,coli.COLI_SN
|
|
|
|
left join BIZ_GroupAccountInfo bgai on bgai.GAI_AccreditNo=pn.IPL_dealId
|
|
|
|
from GroupAccountInfo gai inner join ConfirmLineInfo coli on coli.COLI_SN=gai.GAI_COLI_SN
|
|
|
|
left join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
) as table_t on table_t.GAI_AccreditNo=pn.IPL_dealId
|
|
|
|
where IPL_sent='send-to-finance' ";
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select bgai.GAI_AccreditNo,bgai.GAI_CusName,bgai.gai_cusEmail,bgai.GAI_SQJECurrency,bgai.GAI_SSJE ,bcoli.COLI_GRI_SN,bcoli.COLI_OPI_ID,bcoli.COLI_SN
|
|
|
|
|
|
|
|
from BIZ_GroupAccountInfo bgai inner join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_b on table_b.GAI_AccreditNo=pn.IPL_dealId
|
|
|
|
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select bgai.GAI_AccreditNo,bgai.GAI_CusName,bgai.gai_cusEmail,bgai.GAI_SSJE,bgai.GAI_SQJE,bgai.GAI_SQJECurrency ,bcoli.COLI_GRI_SN,bcoli.COLI_OPI_ID,bcoli.COLI_SN ,bcoli.COLI_id ,bcoli.COLI_GroupCode
|
|
|
|
|
|
|
|
from BIZ_GroupAccountInfo bgai inner join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_app on table_app.COLI_ID=REPLACE ( IPL_orderId , '_B' , '' )
|
|
|
|
|
|
|
|
and pn.IPL_orderAmount=table_app.GAI_SQJE and pn.IPL_currencyCode=table_app.GAI_SQJECurrency
|
|
|
|
|
|
|
|
where IPL_sent='$send_flag'
|
|
|
|
|
|
|
|
order by department ";
|
|
|
|
$ipaylinks_list = $this->HT->query($ipaylinks_sql)->result_array();
|
|
|
|
$ipaylinks_list = $this->HT->query($ipaylinks_sql)->result_array();
|
|
|
|
empty($ipaylinks_list) ? $ipaylinks_list=array() : false;
|
|
|
|
empty($ipaylinks_list) ? $ipaylinks_list=array() : false;
|
|
|
|
$alipay_sql = "SELECT 'alipay' as 'payment_type', ALI_sn note_sn,ALI_dealId transaction_id,
|
|
|
|
$alipay_sql = "SELECT 'alipay' as 'payment_type', ALI_sn note_sn,ALI_dealId transaction_id,
|
|
|
|
(select DEI_DepartmentName from OperatorInfo inner join DepartmentInfo on OPI_DEI_SN=DEI_SN
|
|
|
|
(select DEI_DepartmentName from OperatorInfo inner join DepartmentInfo on OPI_DEI_SN=DEI_SN
|
|
|
|
where OPI_SN=ISNULL(coli.COLI_OPI_ID, bcoli.COLI_OPI_ID)) as department,
|
|
|
|
where OPI_SN=ISNULL(table_t.COLI_OPI_ID, isnull(table_b.COLI_OPI_ID,table_app.COLI_OPI_ID))
|
|
|
|
(select GRI_Name from GRoupInfo where gri_sn=ISNULL(coli.COLI_GRI_SN,bcoli.COLI_GRI_SN)) as gri_name,
|
|
|
|
) as department,
|
|
|
|
pn.ALI_completeTime payment_date,
|
|
|
|
case when ISNULL(table_t.COLI_GRI_SN,table_b.COLI_GRI_SN) is null
|
|
|
|
pn.ALI_orderAmount amount,
|
|
|
|
then isnull(table_app.COLI_GroupCode,table_app.COLI_ID)
|
|
|
|
isnull(ALI_currencyCode,isnull(gai.GAI_SQJECurrency,bgai.GAI_SQJECurrency)) currency,
|
|
|
|
else (select GRI_Name from GRoupInfo
|
|
|
|
isnull(gai.GAI_SSJE,bgai.GAI_SSJE) amount_CNY,
|
|
|
|
where gri_sn=ISNULL(table_t.COLI_GRI_SN,table_b.COLI_GRI_SN)
|
|
|
|
isnull(ALI_payerName,isnull(gai.GAI_CusName,bgai.GAI_CusName)) payer,
|
|
|
|
) end as gri_name,
|
|
|
|
isnull(ALI_payerEmail,ISNULL(gai.gai_cusEmail,bgai.gai_cusemail)) payer_email
|
|
|
|
pn.ALI_completeTime payment_date,
|
|
|
|
from InfoManager.dbo.AlipayLog pn
|
|
|
|
pn.ALI_orderAmount amount,
|
|
|
|
left join GroupAccountInfo gai on gai.GAI_AccreditNo=SUBSTRING(pn.ALI_dealId,0,31)
|
|
|
|
isnull(ALI_currencyCode,isnull(table_t.GAI_SQJECurrency,isnull(table_b.GAI_SQJECurrency,table_app.GAI_SQJECurrency))) currency,
|
|
|
|
left join ConfirmLineInfo coli on coli.COLI_SN=gai.GAI_COLI_SN
|
|
|
|
isnull(table_t.GAI_SSJE,isnull(table_b.GAI_SSJE,table_app.GAI_SSJE)) amount_CNY,
|
|
|
|
left join BIZ_GroupAccountInfo bgai on bgai.GAI_AccreditNo=SUBSTRING(pn.ALI_dealId,0,31)
|
|
|
|
isnull(ALI_payerName,isnull(table_t.GAI_CusName,isnull(table_b.GAI_CusName,table_app.GAI_CusName))) payer,
|
|
|
|
left join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
isnull(ALI_payerEmail,ISNULL(table_t.gai_cusEmail,isnull(table_b.gai_cusemail,table_app.gai_cusemail))) payer_email
|
|
|
|
where ALI_sent='send-to-finance' ";
|
|
|
|
from InfoManager.dbo.AlipayLog pn
|
|
|
|
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select gai.GAI_SQJECurrency,gai.GAI_CusName,gai.gai_cusEmail, gai.GAI_SSJE,gai.GAI_AccreditNo ,coli.COLI_GRI_SN,coli.COLI_OPI_ID,coli.COLI_SN
|
|
|
|
|
|
|
|
from GroupAccountInfo gai inner join ConfirmLineInfo coli on coli.COLI_SN=gai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_t on table_t.GAI_AccreditNo=SUBSTRING( pn.ALI_dealId,0,31)
|
|
|
|
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select bgai.GAI_AccreditNo,bgai.GAI_CusName,bgai.gai_cusEmail,bgai.GAI_SQJECurrency,bgai.GAI_SSJE ,bcoli.COLI_GRI_SN,bcoli.COLI_OPI_ID,bcoli.COLI_SN
|
|
|
|
|
|
|
|
from BIZ_GroupAccountInfo bgai inner join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_b on table_b.GAI_AccreditNo=SUBSTRING( pn.ALI_dealId,0,31)
|
|
|
|
|
|
|
|
left join (
|
|
|
|
|
|
|
|
select bgai.GAI_AccreditNo,bgai.GAI_CusName,bgai.gai_cusEmail,bgai.GAI_SSJE,bgai.GAI_SQJE,bgai.GAI_SQJECurrency ,bcoli.COLI_GRI_SN,bcoli.COLI_OPI_ID,bcoli.COLI_SN ,bcoli.COLI_id ,bcoli.COLI_GroupCode
|
|
|
|
|
|
|
|
from BIZ_GroupAccountInfo bgai inner join BIZ_ConfirmLineInfo bcoli on bcoli.COLI_SN=bgai.GAI_COLI_SN
|
|
|
|
|
|
|
|
) as table_app on table_app.COLI_ID=REPLACE ( REPLACE ( ALI_orderId , '_A' , '' ) , '_B' , '' )
|
|
|
|
|
|
|
|
and pn.ALI_orderAmount=table_app.GAI_SQJE --and pn.ALI_currencyCode=table_app.GAI_SQJECurrency
|
|
|
|
|
|
|
|
where ALI_sent ='$send_flag'
|
|
|
|
|
|
|
|
order by department ";
|
|
|
|
$alipay_list = $this->HT->query($alipay_sql)->result_array();
|
|
|
|
$alipay_list = $this->HT->query($alipay_sql)->result_array();
|
|
|
|
empty($alipay_list) ? $alipay_list=array() : false;
|
|
|
|
empty($alipay_list) ? $alipay_list=array() : false;
|
|
|
|
$ret = array_merge($paypal_list, $ipaylinks_list, $alipay_list);
|
|
|
|
$ret = array_merge($paypal_list, $ipaylinks_list, $alipay_list);
|
|
|
|