diff --git a/Modules/mip_quotation_document.pck b/Modules/mip_quotation_document.pck index bd18038..a6fa130 100644 --- a/Modules/mip_quotation_document.pck +++ b/Modules/mip_quotation_document.pck @@ -239,10 +239,12 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS ,p_line IN NUMBER DEFAULT NULL) IS BEGIN - $IF mip_debug_constants.debugging $THEN mip_debug.pl(p_unit => $$PLSQL_UNIT - ,p_line => p_line - ,p_in => p_in); - $END NULL; + $IF mip_debug_constants.debugging $THEN + mip_debug.pl(p_unit => $$PLSQL_UNIT + ,p_line => p_line + ,p_in => p_in); + $END + NULL; END pl; FUNCTION get_current_font_details RETURN t_rec_font_details IS @@ -268,7 +270,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_row_data(1) := p_description; IF p_cost IS NOT NULL THEN l_row_data(2) := TO_CHAR(p_cost - ,'FML999G990D00');else + ,'FML999G990D00'); + ELSE l_row_data(2) := NULL; END IF; l_row_data(3) := p_suffix; @@ -1041,7 +1044,10 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --if it's not an install or exchange get the existing meter type (will overwrite --current value if already set in the code above) IF quote_item_rec.enty_code NOT IN - ('STD EXCHANGE', 'EXCHANGE', 'INSTALL', 'STD INSTALL') THEN + ('STD EXCHANGE' + ,'EXCHANGE' + ,'INSTALL' + ,'STD INSTALL') THEN p_quote_data.mety_code := p_enqu_row.existing_mety_code; END IF; IF quote_item_rec.enty_code <> 'OFMAT' @@ -1079,7 +1085,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --tidy up l_works so there are no blank entries --create an l_works_tidy variable and copy all --non null array entries into it - l_works_counter := l_works.FIRST; + l_works_counter := l_works.first; l_works_tidy_counter := 1; LOOP EXIT WHEN l_works_counter IS NULL; @@ -1087,22 +1093,22 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_works_tidy(l_works_tidy_counter) := l_works(l_works_counter); l_works_tidy_counter := l_works_tidy_counter + 1; END IF; - l_works_counter := l_works.NEXT(l_works_counter); + l_works_counter := l_works.next(l_works_counter); END LOOP; p_quote_data.quote_works := l_works_tidy; --tidy up quote costs -- -- - l_costs_counter := p_quote_data.quote_costs.FIRST; + l_costs_counter := p_quote_data.quote_costs.first; l_quote_cost_tidy_counter := 1; LOOP EXIT WHEN l_costs_counter IS NULL; IF NOT p_quote_data.quote_costs(l_costs_counter) - .cost_description IS NULL THEN + .cost_description IS NULL THEN l_costs_tidy(l_quote_cost_tidy_counter) := p_quote_data.quote_costs(l_costs_counter); l_quote_cost_tidy_counter := l_quote_cost_tidy_counter + 1; END IF; - l_costs_counter := p_quote_data.quote_costs.NEXT(l_costs_counter); + l_costs_counter := p_quote_data.quote_costs.next(l_costs_counter); END LOOP; p_quote_data.quote_costs := l_costs_tidy; @@ -1124,57 +1130,15 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_enquiry_id NUMBER; l_enqu_row enquiries%ROWTYPE; --Address data - l_addr_row v_current_party_addresses%ROWTYPE; - CURSOR c_get_address(cp_party_id NUMBER, cp_rt_type VARCHAR2) IS - SELECT * - FROM v_current_party_addresses - WHERE id = cp_party_id - AND rt_code = cp_rt_type; + l_addr_row v_current_party_addresses%ROWTYPE; l_supplier_id NUMBER; l_agent_id NUMBER; - --Party name - l_party_row parties%ROWTYPE; - CURSOR c_get_party(cp_party_id NUMBER) IS - SELECT * - FROM parties - WHERE id = cp_party_id; --The caveats - CURSOR c_get_caveats(cp_enty_code VARCHAR2, cp_mety_code VARCHAR2, cp_svcpt_code VARCHAR2, cp_quoteid NUMBER) IS - SELECT t.* - FROM caveat_texts t - ,quote_items qi - WHERE t.enty_code = cp_enty_code - AND t.mety_code = cp_mety_code - AND t.svcpt_code = cp_svcpt_code - AND qi.qute_id = cp_quoteid - AND qi.adit_code IS NULL - AND t.adit_code IS NULL - UNION - SELECT t.* - FROM caveat_texts t - ,quote_items qi - WHERE t.enty_code = cp_enty_code - AND t.mety_code = cp_mety_code - AND t.svcpt_code = cp_svcpt_code - AND qi.qute_id = cp_quoteid - AND qi.adit_code IS NOT NULL - AND t.adit_code IS NOT NULL - AND t.adit_code = qi.adit_code - AND regexp_like(decode(qi.selling_price - ,NULL - ,'NULL' - ,qi.selling_price) - ,t.condition)--consider the condition for this caveat (allows user to input regular expression against the cost) - ORDER BY 1 - ,2 - ,3 - ,4 - ,5; --Agent Name - l_agent_first_name VARCHAR2(80); - l_agent_last_name VARCHAR2(80); + l_agent_first_name parties.first_name%TYPE; + l_agent_last_name parties.last_name%TYPE; --suppler name - l_supplier_name VARCHAR2(80); + l_supplier_name parties.name%TYPE; --caveat counters l_dw_counter NUMBER; l_tc_counter NUMBER; @@ -1196,35 +1160,39 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS ,'ENQ OWN'); --get the latest agent address - IF NOT c_get_address%ISOPEN THEN - OPEN c_get_address(l_agent_id - ,'OFFICE'); - END IF; - - FETCH c_get_address - INTO l_addr_row; - CLOSE c_get_address; + BEGIN + SELECT * + INTO l_addr_row + FROM v_current_party_addresses + WHERE id = l_agent_id + AND rt_code = 'OFFICE'; + EXCEPTION + WHEN no_data_found THEN + NULL; + END; --supplier - IF NOT c_get_party%ISOPEN THEN - OPEN c_get_party(l_supplier_id); - END IF; - - FETCH c_get_party - INTO l_party_row; - CLOSE c_get_party; - l_supplier_name := l_party_row.NAME; + BEGIN + SELECT NAME + INTO l_supplier_name + FROM parties + WHERE id = l_supplier_id; + EXCEPTION + WHEN no_data_found THEN + NULL; + END; --agent - IF NOT c_get_party%ISOPEN THEN - OPEN c_get_party(l_agent_id); - END IF; - - FETCH c_get_party - INTO l_party_row; - CLOSE c_get_party; - - l_agent_first_name := l_party_row.first_name; - l_agent_last_name := l_party_row.last_name; + BEGIN + SELECT first_name + ,last_name + INTO l_agent_first_name + ,l_agent_last_name + FROM parties + WHERE id = l_agent_id; + EXCEPTION + WHEN no_data_found THEN + NULL; + END; l_quote_data.enquiry_ref := l_enquiry_id; l_quote_data.quote_ref := l_quote_row.id; @@ -1264,10 +1232,40 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_tc_counter := 1; l_cs_counter := 1; l_csqa_counter := 1; - FOR rec IN c_get_caveats(l_enqu_row.enty_code - ,l_quote_data.mety_code - ,l_quote_data.svcpt_code - ,p_quoteid) LOOP + + FOR rec IN (SELECT t.document_position + ,t.text + ,t.sort_order + FROM caveat_texts t + ,quote_items qi + WHERE t.enty_code = l_enqu_row.enty_code + AND t.mety_code = l_quote_data.mety_code + AND t.svcpt_code = l_quote_data.svcpt_code + AND qi.qute_id = p_quoteid + AND qi.adit_code IS NULL + AND t.adit_code IS NULL + UNION + SELECT t.document_position + ,t.text + ,t.sort_order + FROM caveat_texts t + ,quote_items qi + WHERE t.enty_code = l_enqu_row.enty_code + AND t.mety_code = l_quote_data.mety_code + AND t.svcpt_code = l_quote_data.svcpt_code + AND qi.qute_id = p_quoteid + AND qi.adit_code IS NOT NULL + AND t.adit_code IS NOT NULL + AND t.adit_code = qi.adit_code + AND regexp_like(decode(qi.selling_price + ,NULL + ,'NULL' + ,qi.selling_price) + ,t.condition) --consider the condition for this caveat (allows user to input regular expression against the cost) + ORDER BY document_position + ,sort_order + + ) LOOP CASE rec.document_position WHEN 'TERM_COND' THEN --terms and conditions/specialfeatures caveat point @@ -1286,7 +1284,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_quote_data.caveat_cont_sum_qa(l_csqa_counter) := rec.text; l_csqa_counter := l_csqa_counter + 1; END CASE; - --need to add in the condition to determine if the additional item should be + --need to add in the condition to determine if the additional item should be --displayed or not here(ish) END LOOP; @@ -1506,8 +1504,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.printtext(p_indent ,p_vertical_offset + 216 ,'Yours sincerely'); - --put on daves signature - plpdf.putimage('dhsignature' + --put on signature + plpdf.putimage('signature' ,p_signature_blob ,p_indent ,248 @@ -1515,7 +1513,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS ,11); plpdf.printtext(p_indent ,p_vertical_offset + 234 - ,'David Harper'); + ,'Hilary Parry'); plpdf.printtext(p_indent ,p_vertical_offset + 238 ,'I&C Technical Manager'); @@ -1607,7 +1605,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.setprintfont(p_font ,'B' ,10); --set bold - l_works_counter := p_quote_data.quote_works.FIRST; + l_works_counter := p_quote_data.quote_works.first; LOOP EXIT WHEN l_works_counter IS NULL; IF NOT p_quote_data.quote_works(l_works_counter) IS NULL THEN @@ -1618,7 +1616,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_caveat_desc_works_offset := l_vertical_offset_for_works + (l_works_counter * 4); END IF; - l_works_counter := p_quote_data.quote_works.NEXT(l_works_counter); + l_works_counter := p_quote_data.quote_works.next(l_works_counter); END LOOP; -- DESC_WORK caveat here @@ -1641,7 +1639,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.setprintfont(p_font ,NULL ,10); --unset bold - l_ybefore := plpdf.getcurrenty; + l_ybefore := plpdf.getcurrenty; l_vertical_offset_for_costs := l_vertical_offset_for_costs + (plpdf.getcurrenty - l_ybefore); plpdf.setprintfont(p_font @@ -1650,7 +1648,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.setcurrenty(p_vertical_offset + 114); print_costs(p_description => 'Contract sum (excluding V.A.T):' ,p_cost => p_quote_data.total_cost - ,p_suffix => glue_one_line_caveat(p_quote_data.caveat_cont_sum));-- CONT_SUM caveat here + ,p_suffix => glue_one_line_caveat(p_quote_data.caveat_cont_sum)); -- CONT_SUM caveat here plpdf.linebreak(20); -- line break, height is 20 print_costs(p_description => 'Analysis of Costs (all costs exclude V.A.T)'); plpdf.setprintfont(p_font @@ -1661,11 +1659,11 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS -- l_cost_line_counter := 1; WHILE p_quote_data.quote_costs(l_cost_line_counter) - .cost_description IS NOT NULL LOOP + .cost_description IS NOT NULL LOOP print_costs(p_description => p_quote_data.quote_costs(l_cost_line_counter) - .cost_description + .cost_description ,p_cost => p_quote_data.quote_costs(l_cost_line_counter) - .cost_price); + .cost_price); l_cost_line_counter := l_cost_line_counter + 1; END LOOP; @@ -1676,7 +1674,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS ,p_cost => p_quote_data.total_cost ,p_border => 'T' ,p_suffix => glue_one_line_caveat(p_quote_data.caveat_cont_sum)); -- CONT_SUM caveat here - + END build_costs_page; /* PROCEDURE build_caveats_page @@ -2861,7 +2859,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS plpdf.printtext(85 ,p_vertical_offset + 62 ,TO_CHAR(p_quote_data.total_cost - ,'FML999999D90')); + ,'FML999999D90')); plpdf.setcurrenty(66); l_ybefore := plpdf.getcurrenty; -- CONT_SUM_QA caveat here diff --git a/Schema/InstallMIP.sql b/Schema/InstallMIP.sql index e46c3bb..44f94a9 100644 --- a/Schema/InstallMIP.sql +++ b/Schema/InstallMIP.sql @@ -1,6 +1,6 @@ connect &1/&2@&5 as sysdba -drop user &3 cascade; +@@drop_user_objects &3 grant connect, resource to &3 identified by &4; grant create view, create any directory to &3; @@ -10,6 +10,7 @@ grant execute on dbms_sql to &3; grant create procedure to &3; grant execute on plpdf.plpdf to &3; grant execute on plpdf.plpdf_img to &3; +grant execute on plpdf.plpdf_type to &3; create synonym &3..plpdf for plpdf.plpdf; create synonym &3..plpdf_img for plpdf.plpdf_img; diff --git a/Schema/drop_user_objects.sql b/Schema/drop_user_objects.sql new file mode 100644 index 0000000..001afcd --- /dev/null +++ b/Schema/drop_user_objects.sql @@ -0,0 +1,138 @@ +DECLARE + l_owner VARCHAR2(80) := upper('&1'); +BEGIN +IF l_owner IN ('SYS','SYSTEM') THEN +RAISE no_data_found; +END IF; + FOR l_cmd IN (SELECT 0 + ,'purge '||TYPE||' '||owner||'.'||original_name AS command + FROM dba_recyclebin + WHERE owner = l_owner + AND can_purge = 'YES' + AND TYPE NOT IN ('INDEX') + UNION + SELECT ord + ,command + FROM (SELECT 1 AS ord + ,'alter table ' || owner || '.' || table_name || + ' drop constraint ' || + constraint_name AS command + FROM all_constraints + WHERE owner = l_owner + AND constraint_type = 'R' + UNION + SELECT 2 + ,command + FROM (SELECT 'truncate ' || object_type || ' ' || + owner || '.' || object_name AS command + ,object_type + FROM all_objects + WHERE owner = l_owner + AND object_type IN ('TABLE') + ORDER BY decode(object_type + ,'TABLE' + ,1 + ,'VIEW' + ,2 + ,'SEQUENCE' + ,3 + ,'SYNONYM' + ,4 + ,'TYPE' + ,5 + ,6)) + UNION + SELECT 3 + ,command + FROM (SELECT 'drop ' || object_type || ' ' || owner || '.' || + object_name ||decode(object_type,'TYPE',' FORCE') AS command + ,object_type + FROM all_objects + WHERE owner = l_owner + AND object_type IN + ('TABLE', 'VIEW', 'SEQUENCE', 'SYNONYM', + 'TYPE') + ORDER BY decode(object_type + ,'TABLE' + ,1 + ,'VIEW' + ,2 + ,'SEQUENCE' + ,3 + ,'SYNONYM' + ,4 + ,'TYPE' + ,5 + ,6)) + UNION + SELECT 4 + ,'drop ' || TYPE || ' ' || owner || '.' || NAME AS command + FROM all_source + WHERE owner = l_owner + AND TYPE NOT IN ('PACKAGE BODY', 'TYPE', 'INDEX') + ) + ORDER BY 1) LOOP + BEGIN + dbms_output.put_line(l_cmd.command); + EXECUTE IMMEDIATE l_cmd.command; + EXCEPTION + WHEN OTHERS THEN + dbms_output.put_line(SQLERRM); + END; + END LOOP; + + -- remove any nested types + FOR l_cmd IN (SELECT 'drop ' || object_type || ' ' || owner || '.' || + object_name ||decode(object_type,'TYPE',' FORCE') AS command + ,object_type + FROM all_objects + WHERE owner = l_owner + AND object_type IN ('TYPE') + ) LOOP + BEGIN + dbms_output.put_line(l_cmd.command); + EXECUTE IMMEDIATE l_cmd.command; + EXCEPTION + WHEN OTHERS THEN + dbms_output.put_line(SQLERRM); + END; + END LOOP; + + FOR l_cmd IN (SELECT 999 + ,'purge '||TYPE||' '||owner||'.'||original_name AS command + FROM dba_recyclebin + WHERE owner = l_owner + AND TYPE NOT IN ('INDEX') + AND can_purge = 'YES' + ) LOOP + BEGIN + dbms_output.put_line(l_cmd.command); + EXECUTE IMMEDIATE l_cmd.command; + EXCEPTION + WHEN OTHERS THEN + dbms_output.put_line(SQLERRM); + END; + END LOOP; + + FOR l_jobs IN (SELECT job + FROM all_jobs + WHERE schema_user = l_owner) LOOP + dbms_job.remove(job => l_jobs.job); + END LOOP; + + FOR l_jobs IN (SELECT owner||'.'||job_name AS job_name + FROM all_scheduler_jobs + WHERE owner = l_owner) LOOP + dbms_scheduler.drop_job(job_name => l_jobs.job_name + ,force => TRUE); + END LOOP; + + FOR l_schedules IN (SELECT owner||'.'||schedule_name AS schedule_name + FROM all_scheduler_schedules + WHERE owner = l_owner) LOOP + dbms_scheduler.drop_schedule(schedule_name => l_schedules.schedule_name + ,force => TRUE); + END LOOP; + +END; +/ diff --git a/Screens/f155.sql b/Screens/f155.sql index 2b02a63..be08af1 100644 --- a/Screens/f155.sql +++ b/Screens/f155.sql @@ -13,8 +13,8 @@ prompt APPLICATION 155 - webmip -- Application Export: -- Application: 155 -- Name: webmip --- Date and Time: 11:14 Thursday January 7, 2010 --- Exported By: PRIESTJ +-- Date and Time: 15:39 Tuesday August 10, 2010 +-- Exported By: HARDYA -- Flashback: 0 -- Export Type: Application Export -- Version: 3.1.0.00.32 @@ -86,7 +86,7 @@ begin execute immediate 'alter session set nls_numeric_characters=''.,'''; end; / -begin wwv_flow.g_browser_language := 'en-gb'; end; +begin wwv_flow.g_browser_language := 'en-us'; end; / prompt Check Compatibility... @@ -138,14 +138,14 @@ wwv_flow_api.create_flow( p_display_id=> 155, p_owner => 'MIP_DEV', p_name => 'webmip', - p_alias => 'WEBMIP255155154155', + p_alias => 'WEBMIP', p_page_view_logging => 'YES', p_default_page_template=> 71114788560453355 + wwv_flow_api.g_id_offset, p_printer_friendly_template=> 71116307709453357 + wwv_flow_api.g_id_offset, p_default_region_template=> 71121389039453369 + wwv_flow_api.g_id_offset, p_error_template => 85292499999520701 + wwv_flow_api.g_id_offset, p_page_protection_enabled_y_n=> 'N', - p_checksum_salt_last_reset => '20100107111402', + p_checksum_salt_last_reset => '20100810153916', p_home_link => 'f?p=&APP_ID.:101', p_flow_language => 'en-gb', p_flow_language_derived_from=> 'FLOW_PRIMARY_LANGUAGE', @@ -155,7 +155,7 @@ wwv_flow_api.create_flow( p_login_url => '', p_logout_url => 'wwv_flow_custom_auth_std.logout?p_this_flow=&FLOW_ID.&p_next_flow_page_sess=&FLOW_ID.:500', p_application_tab_set=> 1, - p_logo_image => 'TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:', + p_logo_image => 'TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:TEXT:', p_logo_image_attributes => 'style="font-family:Arial; color:#004C66; font-size:18px; white-space:nowrap; font-weight:bold;"', p_public_url_prefix => '', p_public_user => 'APEX_PUBLIC_USER', @@ -164,7 +164,7 @@ wwv_flow_api.create_flow( p_cust_authentication_process=> '.'||to_char(56772791679388739 + wwv_flow_api.g_id_offset)||'.', p_cust_authentication_page=> '', p_custom_auth_login_url=> '', - p_flow_version => '$Rev$:', + p_flow_version => '$Rev: 4851 $:', p_flow_status => 'AVAILABLE_W_EDIT_LINK', p_flow_unavailable_text=> 'This application is currently unavailable at this time.', p_build_status => 'RUN_AND_BUILD', @@ -193,8 +193,8 @@ wwv_flow_api.create_flow( p_substitution_value_03 => 'http://www.nationalgrid.com/corporate/legal/privacy.htm', p_substitution_string_04 => 'SITEMAP_URL', p_substitution_value_04 => 'http://www.nationalgrid.com/uk/sitemap.htm', - p_last_updated_by => 'PRIESTJ', - p_last_upd_yyyymmddhh24miss=> '20100107111402', + p_last_updated_by => 'HARDYA', + p_last_upd_yyyymmddhh24miss=> '20100810153916', p_required_roles=> wwv_flow_utilities.string_to_table2('')); @@ -12906,8 +12906,8 @@ wwv_flow_api.create_page( p_step_template => '', p_required_role => 59152281045285598+ wwv_flow_api.g_id_offset, p_required_patch=> null + wwv_flow_api.g_id_offset, - p_last_updated_by => 'PRIESTJ', - p_last_upd_yyyymmddhh24miss => '20090925103732', + p_last_updated_by => 'HARDYA', + p_last_upd_yyyymmddhh24miss => '20100204143715', p_page_is_public_y_n=> 'N', p_protection_level=> 'C', p_page_comment => '');