1 PACKAGE BODY OE_LINEINFO_GRP AS
2 /* $Header: OEXLIFOB.pls 120.0 2005/06/01 00:37:00 appldev noship $ */
3
4 /*
5 column unit_discount_amount will have positive sign if list line type code is a DIS (discount)
6 and negative sign if list line type code is a SUR (Surcharge).
7 */
8 Procedure Get_Adjustments(p_header_id IN NUMBER
9 ,p_line_id IN NUMBER
10 ,x_adj_detail OUT nocopy OE_Header_Adj_Util.line_adjustments_tab_type
11 ,x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2) IS
12
13 l_line_adj_tbl OE_Header_Adj_Util.line_adjustments_tab_type;
14
15 Begin
16 x_return_status := FND_API.G_RET_STS_SUCCESS;
17
18 OE_Header_Adj_Util.Get_Line_Adjustments(p_header_id => p_header_id
19 ,p_line_id => p_line_id
20 ,x_line_adjustments => x_adj_detail
21 );
22
23 Exception
24 When Others Then
25 x_return_status := FND_API.G_RET_STS_ERROR;
26 End;
27
28 Procedure Get_Total_Tax(p_header_id IN NUMBER
29 ,x_order_tax_total OUT nocopy NUMBER
30 ,x_return_status OUT nocopy VARCHAR2) IS
31 l_order_tax_total Number;
32 l_return_tax_total Number;
33 Begin
34 x_return_status:=FND_API.G_RET_STS_SUCCESS;
35 SELECT SUM(tax_value)
36 INTO l_order_tax_total
37 FROM oe_order_lines_all
38 WHERE header_id=p_header_id
39 AND charge_periodicity_code is NULL
40 AND NVL(cancelled_flag,'N') ='N'
41 AND line_category_code<>'RETURN';
42
43
44 SELECT SUM(tax_value)
45 INTO l_return_tax_total
46 FROM oe_order_lines_all
47 WHERE header_id=p_header_id
48 AND charge_periodicity_code is NULL
49 AND NVL(cancelled_flag,'N') ='N'
50 AND line_category_code='RETURN';
51
52 x_order_tax_total:= l_order_tax_total - l_return_tax_total;
53
54 Exception When others THEN
55 x_order_tax_total:=NULL;
56 x_return_status:= FND_API.G_RET_STS_ERROR;
57
58 oe_debug_pub.add(SQLERRM);
59 oe_debug_pub.add('header id passed in:'||p_header_id);
60 End;
61
62 Procedure Get_Tax(p_header_id IN NUMBER
63 ,p_line_id IN NUMBER
64 ,x_tax_rec OUT nocopy oe_lineinfo_grp.tax_rec_type
65 ,x_return_status OUT NOCOPY VARCHAR2) IS
66
67 Begin
68 x_return_status:=FND_API.G_RET_STS_SUCCESS;
69
70 SELECT tax_code,tax_rate,tax_value,tax_date,tax_exempt_flag,tax_exempt_number,tax_exempt_reason_code
71 into x_tax_rec.tax_code,
72 x_tax_rec.tax_rate,
73 x_tax_rec.tax_amount,
74 x_tax_rec.tax_date,
75 x_tax_rec.tax_exempt_flag,
76 x_tax_rec.tax_exempt_number,
77 x_tax_rec.tax_exempt_reason_code
78 FROM oe_order_lines_all
79 Where header_id = p_header_id
80 and line_id = p_line_id;
81
82 Exception When others THEN
83 x_return_status := FND_API.G_RET_STS_ERROR;
84 oe_debug_pub.add(SQLERRM);
85 oe_debug_pub.add('header id passed in:'||p_header_id||' line id:'||p_line_id);
86 End;
87
88 End OE_LINEINFO_GRP;