package body custom is
--
-- Customize this package to provide specific responses to events
-- within Oracle Applications forms.
--
-- Do not change the specification of the CUSTOM package in any way.
-- You may, however, add additional packages to this library.
--
--------------------------------------------------------------------
function zoom_available return boolean is
--
-- This function allows you to specify if zooms exist for the current
-- context. If zooms are available for this block, then return TRUE;
-- else return FALSE.
--
-- This routine is called on a per-block basis within every Applications
-- form from the WHEN-NEW-BLOCK-INSTANCE trigger. Therefore, any code
-- that will enable Zoom must test the current form and block from
-- which the call is being made.
--
-- By default this routine must return FALSE.
--
/* Sample code:
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
begin
if (form_name = 'DEMXXEOR' and block_name = 'ORDERS') then
return TRUE;
else
return FALSE;
end if;
end zoom_available;
*/
--
-- Real code starts here
--
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
v_enabled varchar2(20);
begin
-- Added by Arpit on 31-AUG-2011 to enable zoom trigger for CR 250039
if form_name = 'CSXSRISR' then
RETURN TRUE;
end if;
v_enabled := lazoom.zoom_enabled;
IF v_enabled = 'TRUE' THEN
return TRUE;
else
return FALSE;
end if;
end zoom_available;
--------------------------------------------------------------------
function style(event_name varchar2) return integer is
--
-- This function allows you to determine the execution style for some
-- product-specific events. You can choose to have your code execute
-- before, after, or in place of the code provided in Oracle
-- Applications. See the Applications Technical Reference manuals for a
-- list of events that are available through this interface.
--
-- Any event that returns a style other than custom.standard must have
-- corresponding code in custom.event which will be executed at the
-- time specified.
--
-- The following package variables should be used as return values:
--
-- custom.before
-- custom.after
-- custom.override
-- custom.standard
--
-- By default this routine must return custom.standard
--
-- Oracle Corporation reserves the right to change the events
-- available through this interface at any time.
--
/* Sample code:
begin
if event_name = 'OE_LINES_PRICING' then
return custom.override;
else
return custom.standard;
end if;
end style;
*/
--
-- Real code starts here
--
begin
return custom.standard;
end style;
--------------------------------------------------------------------
procedure event(event_name varchar2) is
--
-- This procedure allows you to execute your code at specific events
-- including:
--
-- ZOOM
-- WHEN-NEW-FORM-INSTANCE
-- WHEN-NEW-BLOCK-INSTANCE
-- WHEN-NEW-RECORD-INSTANCE
-- WHEN-NEW-ITEM-INSTANCE
-- WHEN-VALIDATE-RECORD
--
-- Additionally, product-specific events will be passed via this
-- interface (see the Applications Technical Reference manuals for
-- a list of events that are available).
--
-- By default this routine must perform 'null;'.
--
-- Oracle Corporation reserves the right to change the events
-- available through this interface at any time.
--
/* Sample code:
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
param_to_pass1 varchar2(255);
param_to_pass2 varchar2(255);
begin
-- Zoom event opens a new session of a form and
-- passes parameter values to the new session. The parameters
-- already exist in the form being opened.
if (event_name = 'ZOOM') then
if (form_name = 'DEMXXEOR' and block_name = 'ORDERS') then
param_to_pass1 := name_in('ORDERS.order_id');
param_to_pass2 := name_in('ORDERS.customer_name');
fnd_function.execute(FUNCTION_NAME=>'DEM_DEMXXEOR',
OPEN_FLAG=>'Y',
SESSION_FLAG=>'Y',
OTHER_PARAMS=>'ORDER_ID="'||param_to_pass1||
'" CUSTOMER_NAME="'||param_to_pass2||'"');
-- all the extra single and double quotes account for
-- any spaces that might be in the passed values
end if;
-- This is an example of a product-specific event. Note that as
-- of Prod 15, this event doesn't exist.
elsif (event_name = 'OE_LINES_PRICING') then
get_custom_pricing('ORDERS.item_id', 'ORDERS.price');
-- This is an example of enforcing a company-specific business
-- rule, in this case, that all vendor names must be uppercase.
elsif (event_name = 'WHEN-VALIDATE-RECORD') then
if (form_name = 'APXVENDR') then
if (block_name = 'VENDOR') then
copy(upper(name_in('VENDOR.NAME')), 'VENDOR.NAME');
end if;
end if;
else
null;
end if;
end event;
*/
--
-- Real code starts here
--
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
lc_cursor_item varchar2(100);
lc_pos pls_integer;
lc_seq number;
lc_item varchar2(80);
lc_task_id number;
lc_param_list varchar2(2000);
lv_ncorrescode number := 0;
field_name varchar2(30) := name_in('system.current_item');
function_name varchar2(30);
parameters varchar2(2000);
/*** Begin: Added for FACS Decom Phase 1 project***/
l_num_loc_id number;
l_num_cust_id number;
l_add1 varchar2(240);
l_state varchar2(240);
l_city varchar2(240);
l_zip_code varchar2(240);
l_country varchar2(240);
l_vip_ind varchar2(100);
l_cust_acct_id number;
l_vip_value varchar2(100);
l_cust_num varchar2(30);
/*** End: Added for FACS Decom Phase 1 project***/
l_prompt_text varchar2(2000);
l_opt_out_sd varchar2(2000);
l_party_id number;
l_discount_flag VARCHAR2(1);
l_contract_line_id NUMBER;
-- Add by Arpit for CR 208989 Update resolution code in SR
/*
l_incident_id cs_incidents_all.incident_id%type;
l_task_id jtf_tasks_b.task_id%type;
l_response number;
l_mapping_exists varchar2(1);
*/
x_error_message varchar2(4000);
-- menu menuitem;
begin
xxen_event(event_name); --Added for Blitz Report's forms integration by
Enginatics
IF event_name = 'WHEN-NEW-FORM-INSTANCE' then
if form_name = 'CSFDCMAI' then
app_special2.instantiate('SPECIAL45','Send Nextel
Message','afssend');
end if;
if form_name = 'OKSAUDET' then
app_special2.instantiate('SPECIAL30','Contract Fulfillment
History');
end if;
if form_name = 'OKSAUDET' then
app_special2.instantiate('SPECIAL29','Contract Interface
History');
end if;
lacustom.event('WNF');
elsif event_name = 'SPECIAL30' then
if form_name = 'OKSAUDET' then
lc_param_list := 'CONTRACT_ID='|| name_in('OKS_HEADER.ID');
fnd_function.execute ( function_name => 'NCORCTRCTFULFILL'
, open_flag => 'Y'
, session_flag => 'SESSION'
, other_params => lc_param_list
, activate_flag => 'ACTIVATE'
, browser_target => null
);
end if;
-- execute_menu(event_name);
elsif event_name = 'SPECIAL29' then
if form_name = 'OKSAUDET' then
lc_param_list := 'CONTRACT_ID='|| name_in('OKS_HEADER.ID');
fnd_function.execute ( function_name => 'NCORCINT'
, open_flag => 'Y'
, session_flag => 'SESSION'
, other_params => lc_param_list
, activate_flag => 'ACTIVATE'
, browser_target => null
);
end if;
elsif event_name = 'SPECIAL45' then
if form_name = 'CSFDCMAI' and block_name='PLAN' then
lc_cursor_item := name_in(':system.cursor_item');
lc_pos := instr(upper(lc_cursor_item), 'TASK_CELL_');
if lc_pos = 0 then
raise form_trigger_failure;
end if;
lc_seq := to_number(substr(lc_cursor_item, lc_pos + 10));
lc_item := 'PLAN.TASK_ID_'||to_char(lc_seq);
lc_task_id := to_number(name_in(lc_item));
lc_param_list := 'INTERNAL_ID='||lc_task_id;
fnd_function.execute ( function_name => 'NCOR_NCORNXTL'
,
open_flag => 'Y'
,
session_flag => 'SESSION'
,
other_params => lc_param_list
,
activate_flag => 'ACTIVATE'
,
browser_target => null
);
raise form_trigger_failure;
end if;
elsif (event_name = 'WHEN-NEW-ITEM-INSTANCE') then
--Changed by Apoorv Aggarwal on 05-AUG-2011
if form_name = 'CSFDCMAI' and block_name = 'ASSIGNMENTS' and
name_in('system.cursor_item') = 'ASSIGNMENTS.TRAVEL_TIME'
then
ncorrescode;
end if;
--End change by Apoorv
lacustom.event('WNI');
elsif (event_name = 'ZOOM') then
la_enhncmtmgr_pkg.la_zooms(form_name,block_name,function_name,parameters);
if function_name is not NULL
then
if parameters is null then
fnd_function.execute(function_name,'Y','N');
elsif 'ZOOMSPECIAL' = substr(parameters,1,11) then
lacustom.event('ZOOMSPECIAL'); -----new code 081903
else
parameters := lazoom.zoom_event(parameters);
fnd_function.execute(function_name,'Y','N',parameters);
end if;
end if;
-- Added by Arpit on 31-Aug-2011 for CR 250039 - Need the price of part to
autofill pricelist & flat rate code price when complete debriefing
if form_name = 'CSXSRISR'
then
IF block_name = 'CHARGES_DETAIL_BLK'
THEN
IF NVL(NAME_IN('CHARGES_DETAIL_BLK.BILLING_TYPE_DESC'),'XXX') <>
'Material'
THEN
fnd_message.set_string('Please select valid material item to add
expense item');
fnd_message.show;
RAISE form_trigger_failure;
END IF;
DECLARE
l_return_status VARCHAR2 (1);
l_errmsg VARCHAR2 (2000);
l_no_expense_items NUMBER;
l_msg VARCHAR2
(2000);
l_flat_rate_code
mtl_system_items_b.segment1%TYPE;
l_incident_id NUMBER :=
NAME_IN('CHARGES_DETAIL_BLK.INCIDENT_ID');
l_inventory_item_id NUMBER :=
NAME_IN('CHARGES_DETAIL_BLK.INVENTORY_ITEM_ID');
l_material_item_name mtl_system_items_b.segment1%TYPE
:= NAME_IN('CHARGES_DETAIL_BLK.ITEM_NUMBER');
l_incident_number
cs_incidents_all.incident_number%TYPE :=
NAME_IN('INCIDENT_TRACKING.INCIDENT_NUMBER');
l_estimate_detail_id NUMBER :=
NAME_IN('CHARGES_DETAIL_BLK.ESTIMATE_DETAIL_ID');
l_price_list_header_id NUMBER ;
BEGIN
ncor_flat_rate_code_pkg.add_expense_items(p_incident_id
=> l_incident_id,
p_estimate_detail_id => l_estimate_detail_id,
x_no_expense_items => l_no_expense_items,
x_errmsg
=> l_errmsg,
x_flat_rate_code => l_flat_rate_code);
IF l_errmsg IS NOT NULL
THEN
fnd_message.set_string('Unexpected error occured while
creating expense line for ' || l_material_item_name || ' : ' || l_errmsg);
fnd_message.show;
RAISE form_trigger_failure;
END IF;
IF (l_flat_rate_code IS NOT NULL OR
NAME_IN('CHARGES_DETAIL_BLK.ATTRIBUTE14') = 'Y') AND l_no_expense_items = 1
THEN
fnd_message.set_string('Flat rate code ' ||
l_flat_rate_code ||' is already created for ' || l_material_item_name );
fnd_message.show;
RAISE form_trigger_failure;
END IF;
IF l_no_expense_items = 0
THEN
fnd_message.set_string('No Flate Rate code defined for
material item ' || l_material_item_name );
fnd_message.show;
RAISE form_trigger_failure;
END IF;
IF NAME_IN('INCIDENT_TRACKING.INCIDENT_TYPE') IN ('COD
CLEAN AND CHECK','COD SERVICE REPAIR')
THEN
l_price_list_header_id := 6008; -- Primary price list
ELSE
l_price_list_header_id := 6014; -- Service Repair
price list
END IF;
IF l_no_expense_items > 1
THEN
lc_param_list := 'INVENTORY_ITEM_ID="'||
l_inventory_item_id
||'"MATERIAL_ITEM_NAME="' ||
l_material_item_name
||'"INCIDENT_ID="' ||
l_incident_id
||'"INCIDENT_NUMBER="' ||
l_incident_number
||'"PRICE_LIST_HEADER_ID="'
|| l_price_list_header_id
||'"ESTIMATE_DETAIL_ID="' ||
l_estimate_detail_id||'"';
fnd_function.execute ( function_name =>
'NCOR_FLAT_RATE_CODE'
, open_flag
=> 'Y'
, session_flag
=> 'N'
, other_params
=> lc_param_list
, activate_flag
=> 'ACTIVATE'
, browser_target
=> null
);
END IF;
END ;
END IF;
END IF;
--- End by Arpit
elsif (event_name = 'WHEN-NEW-BLOCK-INSTANCE') then
/*** Begin: Added for FACS Decom Phase 1 project***/
if form_name = 'CSXSRISR' and block_name = 'INCIDENT_TRACKING' then
if name_in('INCIDENT_TRACKING.INCIDENT_ADDRESS') is null
and name_in('INCIDENT_TRACKING.CUSTOMER_ADDRESS') is not null
and name_in('INCIDENT_TRACKING.CALLER_TYPE') = 'PERSON' then
l_num_cust_id := name_in('INCIDENT_TRACKING.customer_id');
begin
select hps.party_site_id,
hl.address1,
hl.state,
hl.city,
hl.postal_code,
hl.country
into l_num_loc_id,
l_add1,
l_state,
l_city,
l_zip_code,
l_country
from hz_locations hl,
hz_party_sites hps,
hz_parties hp
where hl.location_id = hps.location_id
and hps.party_id = hp.party_id
and hp.party_id = l_num_cust_id
and hl.address1 = hp.address1
and nvl(hl.address2,'x') = nvl(hp.address2,'x')
and hl.state = hp.state
and hl.county = hp.county
and hl.city = hp.city
and hl.postal_code = hp.postal_code;
exception
when others then
null;
end;
copy(l_num_loc_id, 'INCIDENT_TRACKING.INCIDENT_LOCATION_ID');
copy('HZ_PARTY_SITE','INCIDENT_TRACKING.INCIDENT_LOCATION_TYPE');
copy(l_add1, 'INCIDENT_TRACKING.INCIDENT_ADDRESS');
copy(l_state, 'INCIDENT_TRACKING.INCIDENT_STATE');
copy(l_city, 'INCIDENT_TRACKING.INCIDENT_CITY');
copy(l_zip_code, 'INCIDENT_TRACKING.INCIDENT_POSTAL_CODE');
copy(l_country, 'INCIDENT_TRACKING.INCIDENT_COUNTRY');
end if;
end if;
/*** End: Added for FACS Decom Phase 1 project***/
lacustom.event('WNB');
elsif (event_name = 'WHEN-NEW-RECORD-INSTANCE') then
lacustom.event('WNR');
if form_name = 'CSXSRISR' and block_name = 'INCIDENT_TRACKING'
then
l_prompt_text := null;
begin
l_cust_num :=
nvl(name_in('INCIDENT_TRACKING.CUSTOMER_NUMBER'),'0');
select 'Y', hz.attribute11
into l_vip_ind, l_vip_value
from hz_parties hz,
fnd_flex_value_sets fvs,
fnd_flex_values_vl fv
where fvs.flex_value_set_id = fv.flex_value_set_id
and fv.flex_value = hz.attribute11
and fvs.flex_value_set_name = 'NCOR_VIP_TYPE'
and hz.party_number = l_cust_num;
exception
when others then
l_vip_ind := 'N';
end;
begin
select attribute13
into l_opt_out_sd
from hz_parties
where party_number = l_cust_num;
exception
when others then
l_opt_out_sd := null;
end;
if l_vip_ind = 'Y'
then
l_prompt_text:= 'VIP:'||upper(l_vip_value);
end if;
if l_opt_out_sd is not null
and to_date(substr(l_opt_out_sd,1,10), 'YYYY/MM/DD')
<= trunc(sysdate)
then
if l_prompt_text is null then
l_prompt_text := 'OPT-OUT';
else
l_prompt_text := l_prompt_text||'/OPT-OUT';
end if;
end if;
if l_prompt_text is not null
then
app_item_property.set_property('INCIDENT_TRACKING.PRODUCT_REVISION',displayed,
property_true);
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION', width, 0.001);
if l_vip_ind = 'Y' then
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION', x_pos, 7.80);
else
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION', x_pos, 6.5);
end if;
--
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION', Y_POS, 0.050);
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION', prompt_text,l_prompt_text);
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION',
prompt_font_weight,font_bold);
set_item_property('INCIDENT_TRACKING.PRODUCT_REVISION', prompt_foreground_color,
'r255g0b0');
else
app_item_property.set_property('INCIDENT_TRACKING.PRODUCT_REVISION',displayed,
property_false);
end if;
end if;
-- Added by Arpit for HEAT#30001289 -- Add discount indicator in
contract line
if form_name = 'OKSAUDET' and block_name = 'OKS_LINES' then
l_contract_line_id := name_in('OKS_LINES.ID');
begin
select 'Y'
into l_discount_flag
from okc_price_adjustments okp, okc_k_lines_b
okl
where okp.cle_id = okl.id
and okl.cle_id = l_contract_line_id
and okl.price_unit > 0
and rownum = 1;
exception
when others then
l_discount_flag := 'N';
end;
if l_discount_flag = 'Y'
then
set_item_instance_property('OKS_LINES.NAME',CURRENT_RECORD,VISUAL_ATTRIBUTE,'DATA_S
PECIAL');
set_item_instance_property('OKS_LINES.MIRR_LINE_NAME_EFFECT',CURRENT_RECORD,VISUAL_
ATTRIBUTE,'DATA_SPECIAL');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_PRICING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA_SPECIAL');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_BILLING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA_SPECIAL');
else
set_item_instance_property('OKS_LINES.NAME',CURRENT_RECORD,VISUAL_ATTRIBUTE,'DATA')
;
set_item_instance_property('OKS_LINES.MIRR_LINE_NAME_EFFECT',CURRENT_RECORD,VISUAL_
ATTRIBUTE,'DATA');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_PRICING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_BILLING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA');
end if;
end if;
elsif (event_name = 'WHEN-VALIDATE-RECORD') then
lacustom.event('WVR');
-- Added by Arpit for HEAT#30001289 -- Add discount indicator in contract
line
if form_name = 'OKSAUDET' and block_name = 'OKS_LINES' then
l_contract_line_id := name_in('OKS_LINES.ID');
begin
select 'Y'
into l_discount_flag
from okc_price_adjustments okp, okc_k_lines_b
okl
where okp.cle_id = okl.id
and okl.cle_id = l_contract_line_id
and okl.price_unit > 0
and rownum = 1;
exception
when others then
l_discount_flag := 'N';
end;
if l_discount_flag = 'Y'
then
set_item_instance_property('OKS_LINES.NAME',CURRENT_RECORD,VISUAL_ATTRIBUTE,'DATA_S
PECIAL');
set_item_instance_property('OKS_LINES.MIRR_LINE_NAME_EFFECT',CURRENT_RECORD,VISUAL_
ATTRIBUTE,'DATA_SPECIAL');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_PRICING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA_SPECIAL');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_BILLING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA_SPECIAL');
else
set_item_instance_property('OKS_LINES.NAME',CURRENT_RECORD,VISUAL_ATTRIBUTE,'DATA')
;
set_item_instance_property('OKS_LINES.MIRR_LINE_NAME_EFFECT',CURRENT_RECORD,VISUAL_
ATTRIBUTE,'DATA');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_PRICING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA');
set_item_instance_property('OKS_LINES.MIRR_ITEM_NAME_BILLING',CURRENT_RECORD,VISUAL
_ATTRIBUTE,'DATA');
end if;
end if;
elsif (substr(event_name,1,7) = 'SPECIAL') then
execute_menu(event_name);
else lacustom.event(event_name);
end if;--Main
end event;
procedure ncorrescode is
lv_list_id PARAMLIST;
lv_status VARCHAR2(240);
lv_res_name varchar2(240);
lv_task_number varchar2(240);
lv_incident_id number;
begin
if name_in('TASKS.RESOLUTION_CODE') is null
and ( name_in('ASSIGNMENTS.ASSIGNMENT_STATUS_ID') <>
name_in('ASSIGNMENTS.ASSIGNMENT_STATUS_ID_OLD'))
and name_in('ASSIGNMENTS.ASSIGNMENT_STATUS') = 'Complete - Pending
Debrief'
and name_in('GLOBAL.G_INIT_VALUE') = 0
then
lv_status := name_in('assignments.assignment_status');
lv_res_name := name_in('assignments.resource_name');
lv_task_number := name_in('tasks.task_number');
lv_incident_id := name_in('tasks.incident_id');
fnd_function.execute(
function_name=>'NCORRESCODE',
open_flag=>'Y',
session_flag=>'N',
OTHER_PARAMS=>'P_TASK_NUMBER=
"'||
lv_task_number||'"
P_INCIDENT_ID=
"'||
lv_incident_id||'"
P_ASSIGNEE_NAME=
"'||
lv_res_name||'"
P_ASSIGN_STATUS=
"'||
lv_status||'"
');
end if;
end;
BEGIN
--
-- You should consider updating the version information listed below as you
-- make any customizations to this library. This information will be
-- displayed in the 'About Oracle Applications' window in the Forms PL/SQL
-- section. Only change the revision, date and time sections of this string.
--
fdrcsid('$Header: CUSTOM.pll 121.1 2025/01/21 16:43:22 appldev ship $');
end custom;