租金发票xml的sql
This commit is contained in:
parent
2afe87343b
commit
5b1962fa89
@ -43,7 +43,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
rlrp.plan_list AS rentlist,
|
||||
rlrp.plan_date AS plandate,
|
||||
rlrp.rent AS planmoney,
|
||||
'rent' AS renttype,
|
||||
CONVERT('rent' USING utf8) AS renttype,
|
||||
invoiceinfo.interest_invoice_type AS rentinvoicetype,
|
||||
invoiceinfo.interest_rate AS rentrate,
|
||||
lccs.contract_id AS contractid
|
||||
@ -81,7 +81,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
LEFT JOIN
|
||||
(SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form
|
||||
) invoiceinfo on lci.id= invoiceinfo.id
|
||||
WHERE lci.rent_invoice_type in ('invoice_type03','invoice_type05') AND lccs.PLAN_STATUS>=31
|
||||
WHERE lccs.PLAN_STATUS>=31
|
||||
UNION ALL
|
||||
SELECT
|
||||
clrp.id AS id,
|
||||
@ -89,7 +89,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
clrp.plan_list AS rentlist,
|
||||
clrp.plan_date AS plandate,
|
||||
clrp.corpus AS planmoney,
|
||||
'corpus' AS renttype,
|
||||
CONVERT('corpus' USING utf8) AS renttype,
|
||||
invoiceinfo.corpus_invoice_type AS rentinvoicetype,
|
||||
invoiceinfo.corpus_rate AS rentrate,
|
||||
lccs.contract_id AS contractid
|
||||
@ -128,7 +128,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
(SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form
|
||||
where lci.sign_date>='2016/05/01'
|
||||
) invoiceinfo on lci.id= invoiceinfo.id
|
||||
WHERE lci.rent_invoice_type='invoice_type04' AND lccs.PLAN_STATUS>=31
|
||||
WHERE lccs.PLAN_STATUS>=31
|
||||
UNION ALL
|
||||
SELECT
|
||||
ilrp.id AS id,
|
||||
@ -136,7 +136,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
ilrp.plan_list AS rentlist,
|
||||
ilrp.plan_date AS plandate,
|
||||
ilrp.interest AS planmoney,
|
||||
'interest' AS renttype,
|
||||
CONVERT('interest' USING utf8) AS renttype,
|
||||
invoiceinfo.interest_invoice_type AS rentinvoicetype,
|
||||
invoiceinfo.interest_rate AS rentrate,
|
||||
lccs.contract_id AS contractid
|
||||
@ -175,7 +175,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
(SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form
|
||||
where lci.sign_date>='2016/05/01'
|
||||
) invoiceinfo on lci.id= invoiceinfo.id
|
||||
WHERE lci.rent_invoice_type IN ('invoice_type01','invoice_type02','invoice_type04','invoice_type06') AND lccs.PLAN_STATUS>=31
|
||||
WHERE lccs.PLAN_STATUS>=31
|
||||
) rentplan
|
||||
LEFT JOIN LB_CONTRACT_INFO lci ON rentplan.contractid=lci.id
|
||||
LEFT JOIN lb_contract_invoice_type lcit ON lcit.contract_id=lci.id AND lcit.is_main='Y'
|
||||
@ -265,7 +265,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
LEFT JOIN
|
||||
(SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form
|
||||
) invoiceinfo on lci.id= invoiceinfo.id
|
||||
WHERE lci.rent_invoice_type in ('invoice_type03','invoice_type05') AND lccs.PLAN_STATUS>=31
|
||||
WHERE lccs.PLAN_STATUS>=31
|
||||
UNION ALL
|
||||
SELECT
|
||||
clrp.id AS id,
|
||||
@ -312,7 +312,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
(SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form
|
||||
where lci.sign_date>='2016/05/01'
|
||||
) invoiceinfo on lci.id= invoiceinfo.id
|
||||
WHERE lci.rent_invoice_type='invoice_type04' AND lccs.PLAN_STATUS>=31
|
||||
WHERE lccs.PLAN_STATUS>=31
|
||||
UNION ALL
|
||||
SELECT
|
||||
ilrp.id AS id,
|
||||
@ -359,7 +359,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney,
|
||||
(SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form
|
||||
where lci.sign_date>='2016/05/01'
|
||||
) invoiceinfo on lci.id= invoiceinfo.id
|
||||
WHERE lci.rent_invoice_type IN ('invoice_type01','invoice_type02','invoice_type04','invoice_type06') AND lccs.PLAN_STATUS>=31
|
||||
WHERE lccs.PLAN_STATUS>=31
|
||||
) rentplan
|
||||
LEFT JOIN LB_CONTRACT_INFO lci ON rentplan.contractid=lci.id
|
||||
LEFT JOIN lb_contract_invoice_type lcit ON lcit.contract_id=lci.id AND lcit.is_main='Y'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user