[Home] [Help]
PACKAGE BODY: APPS.IGI_CIS2007_IGIPPADR_PKG
Source
1 package body IGI_CIS2007_IGIPPADR_PKG AS
2 -- $Header: IGIPPADB.pls 120.3 2011/10/14 05:59:56 dramired ship $
3 function BeforeReport return boolean is
4 begin
5 if UPPER(P_TOTAL_TYPE) = 'T' then
6 p_select_clause := ' , (lines.total_payments + lines.total_deductions) GROSS_AMOUNT_PAID,' ||
7 ' lines.MATERIAL_COST MATERIAL_COST,' ||
8 ' lines.LABOUR_COST LABOUR_COST, ' ||
9 ' lines.TOTAL_DEDUCTIONS AMOUNT_DEDUCTED, ' ||
10 ' lines.CIS_TAX CIS_TAX, ' ||
11 ' null INVOICE_NUM ' ;
12 p_from_clause := ', HR_LOCATIONS_V hrl';
13
14 if UPPER(P_ZERO_DEDUCTIONS) = 'Y' Then
15 p_where_clause := ' and hrl.location_id = aprea.LOCATION_ID '||
16 ' and UPPER(hdr.period_name) ='''||UPPER(P_PERIOD)||'''';
17 else
18 p_where_clause := ' and hrl.location_id = aprea.LOCATION_ID '||
19 ' and UPPER(hdr.period_name) ='''||UPPER(P_PERIOD)||'''' ||
20 ' and nvl(lines.total_deductions,0) > 0' ;
21 end if;
22
23 if (P_SUPPLIER_FROM IS NOT NULL) then
24 p_where_clause := p_where_clause || ' and LINES.vendor_name >= ' || '''' ||
25 P_SUPPLIER_FROM || '''';
26 end if;
27 if (P_SUPPLIER_TO IS NOT NULL) then
28 p_where_clause := p_where_clause || ' and LINES.vendor_name <= ' || '''' ||
29 P_SUPPLIER_TO || '''';
30 end if;
31
32 p_where_clause := p_where_clause || ' order by lines.vendor_name ';
33
34
35 elsif UPPER(P_TOTAL_TYPE) = 'P' then
36 p_select_clause := ', (payment.amount + payment.total_deductions) GROSS_AMOUNT_PAID,' ||
37 ' payment.MATERIAL_COST MATERIAL_COST,' ||
38 ' payment.LABOUR_COST LABOUR_COST, ' ||
39 ' payment.TOTAL_DEDUCTIONS AMOUNT_DEDUCTED, ' ||
40 ' payment.CIS_TAX CIS_TAX, ' ||
41 ' invoice.INVOICE_NUM INVOICE_NUM ' ;
42 p_from_clause := ', HR_LOCATIONS_V hrl, igi_cis_mth_ret_pay_h payment, AP_INVOICES invoice';
43 p_where_clause := ' and hrl.location_id = aprea.LOCATION_ID '||
44 ' and UPPER(hdr.period_name) ='''||UPPER(P_PERIOD)||'''' ||' and payment.INVOICE_ID = invoice.INVOICE_ID ' ;
45 if UPPER(P_ZERO_DEDUCTIONS) = 'Y' Then
46 p_where_clause := p_where_clause ||' and lines.HEADER_ID = payment.header_id
47 and lines.vendor_id = payment.VENDOR_ID ';
48 else
49 p_where_clause := p_where_clause ||' and lines.HEADER_ID = payment.header_id and lines.vendor_id = payment.VENDOR_ID ' ||
50 ' and nvl(payment.total_deductions,0) > 0' ;
51 end if;
52
53 p_where_clause := p_where_clause ||' and lines.HEADER_ID = payment.header_id
54 and lines.vendor_id = payment.VENDOR_ID ';
55 if (P_SUPPLIER_FROM IS NOT NULL) then
56 p_where_clause := p_where_clause || ' and LINES.vendor_name >= ' || '''' ||
57 P_SUPPLIER_FROM || '''';
58 end if;
59 if (P_SUPPLIER_TO IS NOT NULL) then
60 p_where_clause := p_where_clause || ' and LINES.vendor_name <= ' || '''' ||
61 P_SUPPLIER_TO || '''';
62 end if;
63 p_where_clause := p_where_clause || ' order by lines.vendor_name ';
64
65
66 end if;
67 return(TRUE);
68 end BeforeReport;
69 -------------------------------------------------------------------------------------
70 function get_PRINT_TYPE return varchar2 is
71 l_print_type IGI_LOOKUPS.MEANING% TYPE := null;
72 begin
73 select meaning
74 into l_print_type
75 from IGI_LOOKUPS
76 where LOOKUP_TYPE = 'IGI_CIS2007_PRINT_TYPES'
77 and LOOKUP_CODE = P_PRINT_TYPE;
78 return(l_print_type);
79 exception
80 WHEN no_data_found THEN
81 return(l_print_type);
82 end get_PRINT_TYPE;
83 --------------------------------------------------------------------------------
84 function get_ORG_NAME return varchar2 is
85 l_org_id HR_OPERATING_UNITS.organization_id%TYPE := null;
86 l_org_name HR_OPERATING_UNITS.name%TYPE := null;
87 begin
88 l_org_id := MO_GLOBAL.get_current_org_id;
89 select name
90 into l_org_name
91 from hr_operating_units
92 where organization_id = l_org_id;
93 return(l_org_name);
94 exception
95 WHEN no_data_found THEN
96 return(l_org_name);
97 end get_ORG_NAME;
98 -------------------------------------------------------------------------------
99 function get_PERIOD_END_DATE return varchar2 is
100 l_period_type AP_OTHER_PERIODS.Period_Type%TYPE;
101 l_end_date AP_OTHER_PERIODS.Start_Date%TYPE;
102 begin
103 l_period_type := fnd_profile.value('IGI_CIS2007_CALENDAR');
104 select end_date
105 into l_end_date
106 from AP_OTHER_PERIODS
107 where period_type = l_period_type
108 and period_name = P_PERIOD;
109 return(l_end_date);
110 exception
111 WHEN no_data_found THEN
112 return(l_end_date);
113 end get_PERIOD_END_DATE;
114 end IGI_CIS2007_IGIPPADR_PKG;