DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TFH_API_BUSINESS_RULES2

Source


1 Package Body ota_tfh_api_business_rules2 as
2 /* $Header: ottfh03t.pkb 115.0 99/07/16 00:55:17 porting ship $ */
3 --
4 --
5 -- Global package name
6 --
7 g_package		varchar2(33)	:= '  ota_tfh_api_business_rules2.';
8 --
9 -- Global api dml status
10 --
11 --
12 -- ----------------------------------------------------------------------------
13 -- |--------------------------< update_finance_lines >--------------------|
14 -- ----------------------------------------------------------------------------
15 --
16 Procedure update_finance_lines (p_rec in ota_tfh_api_shd.g_rec_type) is
17 --
18 l_proc  varchar2(72) := g_package||'update_finance_lines';
19 --
20 l_transfer_status_changed   boolean
21     := ota_general.value_changed( ota_tfh_api_shd.g_old_rec.transfer_status
22                                 , p_rec.transfer_status );
23 --
24 begin
25   hr_utility.set_location('Entering:'||l_proc, 5);
26 --
27 -- If the Header transfer status is changed then update all the lines
28 -- with the same old transfer status
29 --
30 if l_transfer_status_changed then
31    ota_tfl_api_business_rules2.change_line_for_header
32         (p_rec.finance_header_id
33         ,p_rec.transfer_status
34         ,ota_tfh_api_shd.g_old_rec.transfer_status);
35 end if;
36 --
37   hr_utility.set_location(' Leaving:'||l_proc, 10);
38 end update_finance_lines;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |--------------------------< invoice_full_amount >------------------|
42 -- ----------------------------------------------------------------------------
43 --
44 -- PUBLIC
45 -- Description:
46 -- Return the full amount of of invoice
47 --
48 Function invoice_full_amount (
49 	p_finance_header_id in varchar2
50  	,p_currency_code in varchar2 )
51 return varchar2 is
52 --
53 cursor csr_tot is
54 	select nvl(sum(tfl.money_amount),0)
55 	from ota_finance_lines tfl
56 	where finance_header_id = p_finance_header_id
57 	and cancelled_flag = 'N';
58 --
59 l_tot 	number;
60 l_amount varchar2(30);
61 --
62 begin
63 --
64 open csr_tot;
65 fetch csr_tot into l_tot;
66 close csr_tot;
67 if p_currency_code is not null then
68   l_amount := hr_chkfmt.changeformat(
69 			l_tot,
70                          'M',
71                          p_currency_code);
72 else
73   l_amount := to_char(l_tot);
74 end if;
75 --
76 return l_amount;
77 --
78 end invoice_full_amount;
79 --
80 end ota_tfh_api_business_rules2;