Altered code to fix a couple of bugs, moved the base and housing details that are stored on the terms and conditions page out from the case statements they were in so that we always get the base and housing details, we needed this as the caveats with refer to them as minimum measurements for home made house and bases that customers might use

git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3200 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
PriestJ
2008-01-10 18:33:07 +00:00
parent 8e64181a1b
commit f3844defab

View File

@@ -62,23 +62,8 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS
meter_reference varchar(80)
);
-- Public constant declarations
-- <ConstantName> constant <Datatype> := <Value>;
-- Public variable declarations
--<VariableName> <Datatype>;
--function get_total_cost(p_quoteid number) return number;
-- Public function and procedure declarations
-- function <FunctionName>(<Parameter> <Datatype>) return <Datatype>;
--function get_mam(p_region_code varchar2) return varchar2;
--function get_module_row(p_code varchar2) return modules%ROWTYPE;
--function get_max_lead_time(p_quoteid number) return number;
--FUNCTION determine_caveats(p_enquiryid in number) RETURN BOOLEAN;
--PROCEDURE set_quote_items_data (p_quote_data in out quote_data, p_quoteid number, p_enqu_row enquiries%ROWTYPE);
--FUNCTION get_detailed_quote_data(p_quoteid in number) RETURN quote_data;
--FUNCTION generate_detailed_quote_pdf(p_quote_data in quote_data) RETURN VARCHAR2;
FUNCTION generate_quote_pdf(p_quote_id in number) RETURN VARCHAR2;
END mip_quotation_document;
/
CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
@@ -402,11 +387,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
p_quote_data.quote_costs(l_counter).cost_description := 'Base Delivery cost';
p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price;
end if;
--get the base details
l_base_row := get_base_row(quote_item_rec.bas_code);
p_quote_data.base_length := l_base_row.dim_a;
p_quote_data.base_depth := l_base_row.dim_b;
p_quote_data.base_height := l_base_row.depth;
--get base technical details
p_quote_data.base_dimensions(1) := l_base_row.depth;
p_quote_data.base_dimensions(2) := l_base_row.dim_a;
@@ -429,12 +409,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
p_quote_data.quote_costs(l_counter).cost_description := 'Housing Delivery cost';
p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price;
end if;
--get the housing code and return the housing details into p_quote_data
l_housing_row := get_housing_row(quote_item_rec.hou_code);
p_quote_data.house_length := l_housing_row.dim_l;
p_quote_data.house_depth := l_housing_row.dim_w;
p_quote_data.house_height := l_housing_row.dim_h;
p_quote_data.house_ventilation := ((l_housing_row.dim_l*l_housing_row.dim_w)/100)*3;
--get housing technical details
p_quote_data.house_dimensions(1) := l_housing_row.dim_l;
p_quote_data.house_dimensions(2) := l_housing_row.dim_w;
@@ -506,6 +480,18 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
l_meter_row := get_meter_row(l_module_row.metr_code);
p_quote_data.module_qmax := l_meter_row.qmax;
p_quote_data.module_qmin := l_meter_row.qmin;
--get the min base details for this module
l_base_row := get_base_row(l_module_row.bas_code);
p_quote_data.base_length := l_base_row.dim_a;
p_quote_data.base_depth := l_base_row.dim_b;
p_quote_data.base_height := l_base_row.depth;
--get the min housing details for this module
l_housing_row := get_housing_row(l_module_row.hou_code);
p_quote_data.house_length := l_housing_row.dim_l;
p_quote_data.house_depth := l_housing_row.dim_w;
p_quote_data.house_height := l_housing_row.dim_h;
p_quote_data.house_ventilation := ((l_housing_row.dim_l*l_housing_row.dim_w)/100)*3;
when 'LQI' then --Labour cost
--get costs
p_quote_data.quote_costs(l_counter).cost_description := 'Labour Costs';
@@ -521,7 +507,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
--get existing meter if appropriate
if quote_item_rec.enty_code is not null then
if quote_item_rec.enty_code <>'INSTALL' and quote_item_rec.enty_code <>'STD INSTALL' then
l_works(5) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||', '|| p_enqu_row.existing_meter_model;
l_works(5) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||' '||p_enqu_row.mety_code||', '|| p_enqu_row.existing_meter_model ||', MSN: '||p_enqu_row.existing_meter_serial_no ;
end if;
if quote_item_rec.enty_code <> 'OFMAT' and quote_item_rec.enty_code <> 'ADVERSARIAL' then
l_total_cost := p_quote_data.total_cost;
@@ -1243,7 +1229,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
plpdf.SendDoc(l_blob);
--punt the created pdf into the APEX files table
insert into wwv_flow_files( name, title, mime_type, flow_id, doc_size ,description, blob_content )
values (TO_CHAR(SYSDATE,'SSSSS')||'/quote_'||p_quote_data.quote_ref||'.pdf', 'Quotation - '||p_quote_data.quote_ref, 'application/pdf', 190, DBMS_LOB.GETLENGTH(l_blob),'this is an auto generated quotation from mip_quotation_document.generate_detailed_quote for quotation '||p_quote_data.quote_ref, l_blob)
values ( sys_guid()||'/quote_'||p_quote_data.quote_ref||'.pdf', 'Quotation - '||p_quote_data.quote_ref, 'application/pdf', 190, DBMS_LOB.GETLENGTH(l_blob),'this is an auto generated quotation from mip_quotation_document.generate_detailed_quote for quotation '||p_quote_data.quote_ref, l_blob)
returning name into l_pdf_name;
--set up the file associations within our documents tables
l_success:= mip_files.set_file_association(l_pdf_name,