Commit ff70944e authored by niminmin's avatar niminmin

发票创建修改

parent ce92281d
......@@ -94,12 +94,12 @@
'250',
t1.inv_object_taxpayer_type,
t1.object_taxpayer_type) = 'SMALL_SCALE_TAXPAYER' and
to_char(t2.due_date,'yyyy-mm') <= to_char(SYSDATE,'yyyy-mm')) or t2.write_off_flag = 'FULL')
to_char(t2.due_date,'yyyy-mm') <= to_char(SYSDATE,'yyyy-mm')) or (t2.write_off_flag = 'FULL' and t1.contract_status not in('REPURING','REPUR')) or(nvl(t2.write_off_flag,'NOT')='FULL' and t1.contract_status in('REPURING','REPUR') and t2.cf_item<>1) or (nvl(t2.write_off_flag,'NOT')='PARTIAL' and t1.contract_status in('REPURING','REPUR') and t2.cf_item=1 ) )
AND cf_item<> 9
AND cf_status='RELEASE'
AND ((t2.cf_status='RELEASE' and t1.contract_status not in('REPURING','REPUR') and t2.cf_direction='INFLOW') or(t1.contract_status in ('REPURING','REPUR') and t2.cf_item=250 and t2.cf_status='RELEASE' )or ( t2.cf_status in('BLOCK') and nvl(t2.write_off_flag,'NOT')='PARTIAL' and nvl(t2.billing_status,'NOT') != 'FULL' and t1.contract_status in ('REPURING','REPUR') and t2.cf_item =1 and t2.cf_direction='NONCASH' and nvl(t2.billing_amount,0) <> t2.received_amount))
and t2.cashflow_id not in (20265,34267,24445)
and nvl(t2.billing_status,'NOT') != 'FULL'
and t2.cf_direction='INFLOW'
--and t2.cf_direction='INFLOW'
and ((decode(t2.cf_item,
'250',
t1.inv_object_taxpayer_type,
......@@ -165,7 +165,9 @@
t2.amount_dr received_amount,
NULL received_principal,
NULL received_interest,
0 billing_amount,
nvl((SELECT SUM(l.total_amount)
FROM acr_invoice_ln l
WHERE l.ref_n04 = t2.journal_line_id),0) billing_amount,
NULL billing_principal,
NULL billing_interest,
NULL vat_due_amount,
......@@ -198,7 +200,7 @@
FROM acr_invoice_ln l
WHERE l.ref_n04 = t2.journal_line_id
GROUP BY journal_line_id
HAVING SUM(l.total_amount)>0 )
HAVING SUM(l.total_amount)=t2.amount_dr)
)
)vv
......
......@@ -34,6 +34,8 @@
<bm:field name="exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE" prompt="HLS.EXCHANGE_RATE_TYPE"/>
<bm:field name="exchange_rate_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE_DESC" prompt="HLS.EXCHANGE_RATE_TYPE_DESC"/>
<bm:field name="billing_object_name" databaseType="VARCHAR2" datatype="java.lang.String"/>
<bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String"/>
<bm:field name="cf_status" databaseType="VARCHAR2" datatype="java.lang.String"/>
</bm:fields>
<bm:operations>
......@@ -51,7 +53,12 @@
where m.bp_id =t.bp_id) billing_object_name,
t.due_amount,
t.billing_amount,
-- t.billing_amount,
(case when cf.cf_item= 1 and cf.cf_status='BLOCK' then
t.received_amount-nvl(t.cf_billing_amount,0)
else
t.due_amount-nvl(t.cf_billing_amount,0)
end )billing_amount,
t.cf_billing_amount,
t.received_amount,
t.contract_id,
......@@ -82,7 +89,9 @@
(select i.description
from hls_cashflow_item i
where i.cf_item = t.cf_item) as cf_item_desc,
'融资租赁费' as product_name
'融资租赁费' as product_name,
con.contract_status contract_status,
cf.cf_status cf_status
from acr_invoice_create_tmp t,
con_contract_v con,
con_contract_cashflow_all_v cf
......
......@@ -52,8 +52,13 @@
t.due_amount,
--本次开票金额
t.due_amount received_amount,
t.due_amount billing_amount,
0 cf_billing_amount,
t.due_amount-nvl((SELECT SUM(l.total_amount)
FROM acr_invoice_ln l
WHERE l.ref_n04 = t.journal_line_id),0) billing_amount,
--0 cf_billing_amount,
nvl((SELECT SUM(l.total_amount)
FROM acr_invoice_ln l
WHERE l.ref_n04 = t.journal_line_id),0) cf_billing_amount,
t.contract_id,
con.contract_number,
con.contract_name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment