Commit 8ea6ee09 authored by stone's avatar stone

【fix】财务收支一览表

parent 1a56ea05
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
(SELECT 1 (SELECT 1
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status IN WHERE ct.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) purchase_amount, --留购金 AND ct.contract_id = contract_id)) purchase_amount, --留购金
(SELECT SUM(due_amount - nvl(received_amount, 0)) (SELECT SUM(due_amount - nvl(received_amount, 0))
FROM con_contract_cashflow FROM con_contract_cashflow
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
(SELECT 1 (SELECT 1
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status IN WHERE ct.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) down_payment, --首付款 AND ct.contract_id = contract_id)) down_payment, --首付款
(SELECT SUM(due_amount) (SELECT SUM(due_amount)
FROM con_contract_cashflow ccc FROM con_contract_cashflow ccc
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
(SELECT 1 (SELECT 1
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status IN WHERE ct.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) lease_amount, --租金 AND ct.contract_id = contract_id)) lease_amount, --租金
(CASE (CASE
WHEN to_char(SYSDATE, 'dd') <= 20 AND WHEN to_char(SYSDATE, 'dd') <= 20 AND
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
FROM con_contract c FROM con_contract c
WHERE c.contract_status <> 'CANCEL' WHERE c.contract_status <> 'CANCEL'
AND to_char(add_months(c.lease_start_date, 1), AND to_char(add_months(c.lease_start_date, 1),
'yyyymmdd') = to_char(SYSDATE, 'yyyymmdd') 'yyyymm') = to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0) + 'NO_DEDUCTION'),0) +
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
FROM con_contract c FROM con_contract c
WHERE c.contract_status <> 'CANCEL' WHERE c.contract_status <> 'CANCEL'
AND to_char(add_months(c.lease_start_date, 1), AND to_char(add_months(c.lease_start_date, 1),
'yyyymmdd') = to_char(SYSDATE, 'yyyymmdd') 'yyyymm') = to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),0) 'NO_DEDUCTION'),0)
WHEN to_char(SYSDATE, 'dd') > 20 AND WHEN to_char(SYSDATE, 'dd') > 20 AND
...@@ -83,20 +83,20 @@ ...@@ -83,20 +83,20 @@
NVL((SELECT SUM(nvl(c.lease_item_amount, 0)) NVL((SELECT SUM(nvl(c.lease_item_amount, 0))
FROM con_contract c FROM con_contract c
WHERE c.contract_status <> 'CANCEL' WHERE c.contract_status <> 'CANCEL'
AND to_char(c.lease_start_date, 'yyyymmdd') = AND to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE, 'yyyymmdd') to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0)+ 'NO_DEDUCTION'),0)+
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
nvl(c.down_payment, 0)) nvl(c.down_payment, 0))
FROM con_contract c FROM con_contract c
WHERE c.contract_status <> 'CANCEL' WHERE c.contract_status <> 'CANCEL'
AND to_char(c.lease_start_date, 'yyyymmdd') = AND to_char(c.lease_start_date, 'yyyymm') =
to_char(SYSDATE, 'yyyymmdd') to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),0) 'NO_DEDUCTION'),0)
ELSE ELSE
0 null
END) outflow_amount END) outflow_amount
FROM (SELECT s.calendar_date FROM (SELECT s.calendar_date
FROM fnd_calendar_details s FROM fnd_calendar_details s
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
(SELECT 1 (SELECT 1
FROM con_contract t FROM con_contract t
WHERE t.contract_status IN WHERE t.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND t.contract_id = ccc.contract_id AND t.contract_id = ccc.contract_id
AND t.data_class = 'NORMAL')) AND t.data_class = 'NORMAL'))
ORDER BY s.calendar_date) t) v ORDER BY s.calendar_date) t) v
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
(SELECT 1 (SELECT 1
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status IN WHERE ct.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) purchase_amount, --留购金 AND ct.contract_id = contract_id)) purchase_amount, --留购金
(SELECT SUM(due_amount - nvl(received_amount, 0)) (SELECT SUM(due_amount - nvl(received_amount, 0))
FROM con_contract_cashflow FROM con_contract_cashflow
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
(SELECT 1 (SELECT 1
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status IN WHERE ct.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) down_payment, --首付款 AND ct.contract_id = contract_id)) down_payment, --首付款
(SELECT SUM(due_amount) (SELECT SUM(due_amount)
FROM con_contract_cashflow ccc FROM con_contract_cashflow ccc
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
(SELECT 1 (SELECT 1
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status IN WHERE ct.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) lease_amount, --租金 AND ct.contract_id = contract_id)) lease_amount, --租金
(CASE (CASE
WHEN to_char(SYSDATE, 'dd') <= 20 AND WHEN to_char(SYSDATE, 'dd') <= 20 AND
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
FROM con_contract c FROM con_contract c
WHERE c.contract_status <> 'CANCEL' WHERE c.contract_status <> 'CANCEL'
AND to_char(add_months(c.lease_start_date, 1), AND to_char(add_months(c.lease_start_date, 1),
'yyyymmdd') = to_char(SYSDATE, 'yyyymmdd') 'yyyymm') = to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') = AND nvl(c.payment_deduction, 'NO_DEDUCTION') =
'NO_DEDUCTION'),0) + 'NO_DEDUCTION'),0) +
NVL((SELECT SUM(nvl(c.lease_item_amount, 0) - NVL((SELECT SUM(nvl(c.lease_item_amount, 0) -
...@@ -74,11 +74,11 @@ ...@@ -74,11 +74,11 @@
FROM con_contract c FROM con_contract c
WHERE c.contract_status <> 'CANCEL' WHERE c.contract_status <> 'CANCEL'
AND to_char(add_months(c.lease_start_date, 1), AND to_char(add_months(c.lease_start_date, 1),
'yyyymmdd') = to_char(SYSDATE, 'yyyymmdd') 'yyyymm') = to_char(SYSDATE, 'yyyymm')
AND nvl(c.payment_deduction, 'NO_DEDUCTION') <> AND nvl(c.payment_deduction, 'NO_DEDUCTION') <>
'NO_DEDUCTION'),0) 'NO_DEDUCTION'),0)
WHEN to_char(SYSDATE, 'dd') > 20 AND WHEN to_char(SYSDATE, 'dd') > 20 AND
to_char(add_months(t.calendar_date, -1), 'yyyymmdd') = to_char(add_months(t.calendar_date, -1), 'yyyymm') =
to_char(SYSDATE, 'yyyymm') || 20 THEN to_char(SYSDATE, 'yyyymm') || 20 THEN
NVL((SELECT SUM(nvl(c.lease_item_amount, 0)) NVL((SELECT SUM(nvl(c.lease_item_amount, 0))
FROM con_contract c FROM con_contract c
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
(SELECT 1 (SELECT 1
FROM con_contract t FROM con_contract t
WHERE t.contract_status IN WHERE t.contract_status IN
('INCEPT', 'ETING', 'REPURING') ('INCEPT', 'PENDING','ETING', 'REPURING')
AND t.contract_id = ccc.contract_id AND t.contract_id = ccc.contract_id
AND t.data_class = 'NORMAL')) AND t.data_class = 'NORMAL'))
ORDER BY s.calendar_date) t) v ORDER BY s.calendar_date) t) v
......
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
result: $ctx.parameter.return_status, result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message message: $ctx.parameter.return_message
}; };
document.write("<h1>通过document.write输出内容"+result+</h1>");
println(result); println(result);
]]></s:server-script> ]]></s:server-script>
</a:init-procedure> </a:init-procedure>
......
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