[Home] [Help]
24: G_DEBUG_FLAG VARCHAR2(1) := NVL(oe_credit_check_util.check_debug_flag , 'N' ) ;
25:
26: --===============================================================================
27: -- PROCEDURE : Get_exposure_amount
28: -- Comments : Return the overall exposure amount in RA_INTERFACE_LINES_ALL table
29: --===============================================================================
30: PROCEDURE Get_exposure_amount
31: ( p_header_id IN NUMBER
32: , p_customer_id IN NUMBER
95: NVL(NVL(l.tax_line_value,l.tax_value),0), 0 ), 0 ) --TaxER
96: )
97: FROM oe_order_lines l
98: , oe_order_headers_all h
99: , ra_interface_lines_all rl
100: WHERE rl.orig_system_bill_customer_id = l_customer_id
101: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
102: AND h.header_id = l.header_id
103: AND h.org_id = l.org_id
131: NVL(DECODE(l.line_category_code,'RETURN',(-1)*NVL(l.tax_line_value,l.tax_value),NVL(l.tax_line_value,l.tax_value)),0),0), 0 ) --TaxER
132: )
133: FROM oe_order_lines l
134: , oe_order_headers_all h
135: , ra_interface_lines_all rl
136: WHERE rl.orig_system_bill_customer_id = l_customer_id
137: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
138: AND h.header_id = l.header_id
139: AND h.org_id = l.org_id
164: SELECT SUM( NVL( rl.amount, 0 ))
165: FROM oe_price_adjustments p
166: , oe_order_lines l
167: , oe_order_headers_all h
168: , ra_interface_lines_all rl
169: WHERE rl.orig_system_bill_customer_id = l_customer_id
170: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
171: AND p.line_id = l.line_id
172: AND NVL( l.invoiced_quantity, 0 ) <> 0
201: SELECT SUM(NVL(DECODE(p_credit_check_rule_rec.include_tax_flag,'Y',DECODE(p1.list_line_type_code,'TAX',p1.adjusted_amount,0),0),0))
202: FROM oe_price_adjustments p,oe_price_adjustments p1
203: , oe_order_lines l
204: , oe_order_headers_all h
205: , ra_interface_lines_all rl
206: WHERE rl.orig_system_bill_customer_id = l_customer_id
207: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
208: AND p.line_id = l.line_id
209: AND NVL( l.invoiced_quantity, 0 ) <> 0
241: CURSOR cust_reg_orders_freight2 (p_curr_code IN VARCHAR2 default null,l_cust_acct_site_id IN NUMBER DEFAULT NULL) IS -- bug 8744491
242: SELECT SUM( NVL( rl.amount, 0 ))
243: FROM oe_price_adjustments p
244: , oe_order_headers_all h
245: , ra_interface_lines_all rl
246: WHERE rl.orig_system_bill_customer_id = l_customer_id
247: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
248: AND p.line_id IS NULL
249: AND p.header_id = h.header_id
277: UNION ALL
278: SELECT SUM(NVL(DECODE(p_credit_check_rule_rec.include_tax_flag,'Y',DECODE(p1.list_line_type_code,'TAX',p1.adjusted_amount,0),0),0))
279: FROM oe_price_adjustments p,oe_price_adjustments p1
280: , oe_order_headers_all h
281: , ra_interface_lines_all rl
282: WHERE rl.orig_system_bill_customer_id = l_customer_id
283: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
284: AND p.line_id IS NULL
285: AND p.header_id = h.header_id
326: NVL(NVL(l.tax_line_value,l.tax_value),0), 0 ), 0 ) --TaxER
327: )
328: FROM oe_order_lines_all l
329: , oe_order_headers_all h
330: , ra_interface_lines_all rl
331: WHERE rl.orig_system_bill_customer_id = l_customer_id
332: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
333: AND h.header_id = l.header_id
334: AND NVL( l.invoiced_quantity, 0 ) <> 0
361: NVL(DECODE(l.line_category_code,'RETURN',(-1)*NVL(l.tax_line_value,l.tax_value),NVL(l.tax_line_value,l.tax_value)),0),0), 0 ) --TaxER
362: )
363: FROM oe_order_lines_all l
364: , oe_order_headers_all h
365: , ra_interface_lines_all rl
366: WHERE rl.orig_system_bill_customer_id = l_customer_id
367: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
368: AND h.header_id = l.header_id
369: AND NVL( l.invoiced_quantity, 0 ) <> 0
394: SELECT SUM( NVL( rl.amount, 0 ))
395: FROM oe_price_adjustments p
396: , oe_order_lines_all l
397: , oe_order_headers_all h
398: , ra_interface_lines_all rl
399: WHERE rl.orig_system_bill_customer_id = l_customer_id
400: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
401: AND p.line_id = l.line_id
402: AND NVL( l.invoiced_quantity, 0 ) <> 0
429: SELECT SUM(NVL(DECODE(p_credit_check_rule_rec.include_tax_flag,'Y',DECODE(p1.list_line_type_code,'TAX',p1.adjusted_amount,0),0),0))
430: FROM oe_price_adjustments p,oe_price_adjustments p1
431: , oe_order_lines_all l
432: , oe_order_headers_all h
433: , ra_interface_lines_all rl
434: WHERE rl.orig_system_bill_customer_id = l_customer_id
435: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
436: AND p.line_id = l.line_id
437: AND NVL( l.invoiced_quantity, 0 ) <> 0
467: CURSOR cust_glb_orders_freight2 (p_curr_code IN VARCHAR2 default null,l_cust_acct_site_id IN NUMBER DEFAULT NULL) IS -- bug 8744491
468: SELECT SUM( NVL( rl.amount, 0 ))
469: FROM oe_price_adjustments p
470: , oe_order_headers_all h
471: , ra_interface_lines_all rl
472: WHERE rl.orig_system_bill_customer_id = l_customer_id
473: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
474: AND p.line_id IS NULL
475: AND p.header_id = h.header_id
504: SELECT SUM(NVL(DECODE(p_credit_check_rule_rec.include_tax_flag,'Y',DECODE(p1.list_line_type_code,'TAX',p1.adjusted_amount,0),0),0))
505: FROM oe_price_adjustments p
506: ,oe_price_adjustments p1
507: , oe_order_headers_all h
508: , ra_interface_lines_all rl
509: WHERE rl.orig_system_bill_customer_id = l_customer_id
510: AND rl.ORIG_SYSTEM_BILL_ADDRESS_ID = nvl(l_cust_acct_site_id,ORIG_SYSTEM_BILL_ADDRESS_ID) --6896462 bug 8744491
511: AND p.line_id IS NULL
512: AND p.header_id = h.header_id