added code to get most of the data for the pdf of the quotation, still need to get the tech spec details (detailed dimensions for housing, base and module), not yet tested so use at your peril...
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3056 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
584
Modules/mip_quotation_document.pck
Normal file
584
Modules/mip_quotation_document.pck
Normal file
@@ -0,0 +1,584 @@
|
||||
CREATE OR REPLACE PACKAGE mip_quotation_document IS
|
||||
|
||||
-- Author : HARDYA
|
||||
-- Created : 15/11/2007 11:27:58
|
||||
-- Purpose : Handle life-cycle of quotations
|
||||
|
||||
-- Public type declarations
|
||||
--type <TypeName> is <Datatype>;
|
||||
type cost_line is record(
|
||||
cost_description varchar2(80),
|
||||
cost_price number);
|
||||
|
||||
type address is varray(7) of varchar2(160);
|
||||
type works is varray(20) of varchar2(160);
|
||||
type costs is varray(20) of cost_line;
|
||||
type caveats is varray(20) of varchar2(2000);
|
||||
type dimensions is varray(10) of number;
|
||||
type quote_data is record
|
||||
(quote_ref NUMBER,
|
||||
transaction_ref VARCHAR2(80),
|
||||
mprn number(30),
|
||||
supplier_address address,
|
||||
current_date DATE,
|
||||
agent_first_name varchar2(80),
|
||||
site_address address,
|
||||
mam varchar2(80),
|
||||
quote_works works,
|
||||
lead_time number,
|
||||
total_cost number,
|
||||
quote_costs costs,
|
||||
house_length number,
|
||||
house_depth number,
|
||||
house_height number,
|
||||
house_ventilation number,
|
||||
base_length number,
|
||||
base_depth number,
|
||||
base_height number,
|
||||
outlet_termninal_size number,
|
||||
quote_caveats caveats,
|
||||
liquid_damage_day number,
|
||||
liquid_damage_cap number,
|
||||
base_dimensions dimensions,
|
||||
base_diagram number,
|
||||
house_dimensions dimensions,
|
||||
house_diagram number,
|
||||
module_dimensions dimensions,
|
||||
module_diagram number,
|
||||
requested_qmax number,
|
||||
module_qmax number,
|
||||
module_qmin number,
|
||||
module_inlet_height number,
|
||||
module_outlet_height number,
|
||||
module_inlet_size number,
|
||||
module_outlet_size number,
|
||||
module_inlet_type varchar2(80),
|
||||
module_outlet_type varchar2(80),
|
||||
module_inlet_orientation varchar2(80),
|
||||
module_outlet_orientation varchar2(80)
|
||||
);
|
||||
|
||||
-- Public constant declarations
|
||||
-- <ConstantName> constant <Datatype> := <Value>;
|
||||
|
||||
-- Public variable declarations
|
||||
--<VariableName> <Datatype>;
|
||||
|
||||
|
||||
-- Public function and procedure declarations
|
||||
-- function <FunctionName>(<Parameter> <Datatype>) return <Datatype>;
|
||||
function get_module_row(p_id number) return modules%ROWTYPE;
|
||||
function get_max_lead_time(p_id 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 determine_caveats(p_enquiry in number) RETURN BOOLEAN;
|
||||
FUNCTION get_detailed_quote_data(data_for_quote in number) RETURN BOOLEAN;
|
||||
FUNCTION generate_detailed_quote_pdf(get_detailed_quote_data in number) RETURN BOOLEAN;
|
||||
FUNCTION build_detailed_quote(p_enquiry_id in number) RETURN BOOLEAN;
|
||||
|
||||
PROCEDURE produce_quotes(p_id IN enquiries.id%TYPE);
|
||||
END mip_quotation_document;
|
||||
/
|
||||
CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS
|
||||
function get_module_row(p_id number) return modules%ROWTYPE is
|
||||
l_module_row modules%ROWTYPE;
|
||||
CURSOR c_get_module(cp_module_code varchar2) IS
|
||||
SELECT *
|
||||
FROM modules
|
||||
WHERE code = cp_module_code;
|
||||
begin
|
||||
IF NOT c_get_module%ISOPEN THEN
|
||||
OPEN c_get_module(p_id);
|
||||
END IF;
|
||||
FETCH c_get_module
|
||||
INTO l_module_row;
|
||||
CLOSE c_get_module;
|
||||
return l_module_row;
|
||||
end get_module_row;
|
||||
|
||||
function get_housing_row(p_code varchar2) return housings%ROWTYPE is
|
||||
l_housing_row housings%ROWTYPE;
|
||||
CURSOR c_get_housing(cp_housing_code varchar2) IS
|
||||
SELECT *
|
||||
FROM housings
|
||||
WHERE code = cp_housing_code;
|
||||
begin
|
||||
IF NOT c_get_housing%ISOPEN THEN
|
||||
OPEN c_get_housing(p_code);
|
||||
END IF;
|
||||
FETCH c_get_housing
|
||||
INTO l_housing_row;
|
||||
CLOSE c_get_housing;
|
||||
return l_housing_row;
|
||||
end get_housing_row;
|
||||
|
||||
function get_base_row(p_code varchar2) return bases%ROWTYPE is
|
||||
l_base_row bases%ROWTYPE;
|
||||
CURSOR c_get_base(cp_base_code varchar2) IS
|
||||
SELECT *
|
||||
FROM bases
|
||||
WHERE code = cp_base_code;
|
||||
begin
|
||||
IF NOT c_get_base%ISOPEN THEN
|
||||
OPEN c_get_base(p_code);
|
||||
END IF;
|
||||
FETCH c_get_base
|
||||
INTO l_base_row;
|
||||
CLOSE c_get_base;
|
||||
return l_base_row;
|
||||
end get_base_row;
|
||||
|
||||
|
||||
function get_additional_item(p_code varchar2) return additional_items%ROWTYPE is
|
||||
--Additional Items
|
||||
l_add_item_row additional_items%ROWTYPE;
|
||||
CURSOR c_get_add_item(cp_additid varchar2) IS
|
||||
SELECT *
|
||||
FROM additional_items
|
||||
WHERE code = cp_additid;
|
||||
begin
|
||||
--get additional item
|
||||
IF NOT c_get_add_item%ISOPEN THEN
|
||||
OPEN c_get_add_item(p_code);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_add_item
|
||||
INTO l_add_item_row;
|
||||
CLOSE c_get_add_item;
|
||||
return l_add_item_row;
|
||||
end get_additional_item;
|
||||
|
||||
|
||||
function get_max_lead_time(p_id number) return number is
|
||||
l_quote_item_maxlt number;
|
||||
CURSOR c_get_max_lead_time (cp_id number) is
|
||||
SELECT MAX(lead_time)
|
||||
FROM quote_items
|
||||
WHERE qute_id = cp_id;
|
||||
begin
|
||||
IF NOT c_get_max_lead_time%ISOPEN THEN
|
||||
OPEN c_get_max_lead_time(p_id);
|
||||
END IF;
|
||||
FETCH c_get_max_lead_time
|
||||
INTO l_quote_item_maxlt;
|
||||
CLOSE c_get_max_lead_time;
|
||||
return l_quote_item_maxlt;
|
||||
end get_max_lead_time;
|
||||
|
||||
function get_total_cost(p_id number) return number is
|
||||
l_quote_total_cost number;
|
||||
CURSOR c_get_total_cost (cp_id number) is
|
||||
SELECT SUM(selling_price + delivery_price)
|
||||
FROM quote_items
|
||||
WHERE qute_id = cp_id;
|
||||
begin
|
||||
IF NOT c_get_total_cost%ISOPEN THEN
|
||||
OPEN c_get_total_cost(p_id);
|
||||
END IF;
|
||||
FETCH c_get_total_cost
|
||||
INTO l_quote_total_cost;
|
||||
CLOSE c_get_total_cost;
|
||||
return l_quote_total_cost;
|
||||
end get_total_cost;
|
||||
|
||||
function get_quote_costs(p_id number) return costs is
|
||||
CURSOR c_get_quote_costs(cp_id number) is
|
||||
SELECT *
|
||||
FROM quote_items
|
||||
WHERE qute_id = cp_id;
|
||||
l_costs costs;
|
||||
l_counter number;
|
||||
l_add_item_row additional_items%ROWTYPE;
|
||||
l_module_row modules%ROWTYPE;
|
||||
begin
|
||||
l_counter := 0;
|
||||
FOR quote_item_rec IN c_get_quote_costs(p_id) LOOP
|
||||
l_counter := l_counter + 1;
|
||||
case quote_item_rec.quit_type
|
||||
when 'BQI' then --base item
|
||||
l_costs(l_counter).cost_description := 'Base Materials cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.selling_price;
|
||||
if not (quote_item_rec.delivery_price is null) then
|
||||
l_costs(l_counter).cost_description := 'Base Labour cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.delivery_price;
|
||||
end if;
|
||||
when 'HQI' then --housing item
|
||||
l_costs(l_counter).cost_description := 'Housing Materials cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.selling_price;
|
||||
if not (quote_item_rec.delivery_price is null) then
|
||||
l_costs(l_counter).cost_description := 'Housing Labour cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.delivery_price;
|
||||
end if;
|
||||
when 'AQI' then --add-on item
|
||||
--If we get time add an if statement round this that checks if the
|
||||
--Additional Item is lifting gear that it only appears for
|
||||
--LP Diaphgram install/std install jobs
|
||||
l_add_item_row := get_additional_item(quote_item_rec.adit_code);
|
||||
l_costs(l_counter).cost_description := l_add_item_row.description||' Materials cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.selling_price;
|
||||
if not(quote_item_rec.delivery_price is null) then
|
||||
l_costs(l_counter).cost_description := l_add_item_row.description||' Labour cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.delivery_price;
|
||||
end if;
|
||||
|
||||
when 'MQI' then --module item
|
||||
l_costs(l_counter).cost_description := 'Module Materials cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.selling_price;
|
||||
if not(quote_item_rec.delivery_price is null) then
|
||||
l_costs(l_counter).cost_description := 'Module Labour cost';
|
||||
l_costs(l_counter).cost_price := quote_item_rec.delivery_price;
|
||||
end if;
|
||||
end case;
|
||||
|
||||
END LOOP;
|
||||
|
||||
return l_costs;
|
||||
end get_quote_costs;
|
||||
|
||||
/*
|
||||
FUNCTION determine_works
|
||||
--This function should return a list of works, probably in an array, required for
|
||||
--the quotation. It will need to be passed relevent data so that it can make the
|
||||
--determinations
|
||||
%param p_enqu_row - the current enquiry row to make determinations against.
|
||||
%param possibly a few more params to get the required data in
|
||||
*/
|
||||
/* FUNCTION determine_works(p_quoteid number, p_enqu_row enquiries%ROWTYPE) RETURN works is
|
||||
|
||||
--Enquiry type
|
||||
l_enqu_type_row enquiry_types%ROWTYPE;
|
||||
CURSOR c_get_enquiry_type(cp_enty_code varchar2) IS
|
||||
SELECT *
|
||||
FROM enquiry_types
|
||||
WHERE code = cp_enty_code;
|
||||
--Quote Items
|
||||
l_quote_item_row quote_items%ROWTYPE;
|
||||
CURSOR c_get_quote_item(cp_quoteid number) IS
|
||||
SELECT *
|
||||
FROM quote_items
|
||||
WHERE qute_id = cp_quoteid;
|
||||
--Module data
|
||||
l_module_row modules%ROWTYPE;
|
||||
CURSOR c_get_module(cp_module_code varchar2) IS
|
||||
SELECT *
|
||||
FROM modules
|
||||
WHERE code = cp_module_code;
|
||||
--Costs
|
||||
-- l_cost_row costs%ROWTYPE;
|
||||
-- CURSOR c_get_cost(cp_costid number) IS
|
||||
-- SELECT *
|
||||
-- FROM costs
|
||||
-- WHERE id = cp_costid;
|
||||
--Additional Items
|
||||
l_add_item_row additional_items%ROWTYPE;
|
||||
l_works works; --list of works for the quote
|
||||
l_addons varchar(300); --list of addons for the quote
|
||||
begin
|
||||
--cycle through the quote items picking up each item to display on the
|
||||
--description of works section
|
||||
FOR quote_item_rec IN c_get_quote_item(p_quoteid) LOOP
|
||||
case quote_item_rec.quit_type
|
||||
when 'BQI' then --base item
|
||||
l_addons := l_addons || ', Base';
|
||||
when 'HQI' then --housing item
|
||||
l_addons := l_addons || ', Housing';
|
||||
when 'AQI' then --add-on item
|
||||
l_add_item_row := get_additional_item(quote_item_rec.adit_code);
|
||||
l_addons := l_addons || ', '||l_add_item_row.description;
|
||||
when 'MQI' then --module item
|
||||
l_module_row := get_module_row (quote_item_rec.modu_code);
|
||||
l_works(3) := 'Meter Type: '|| l_module_row.svcp_code || ' ' || l_module_row.metr_code;
|
||||
when 'LQI' then --labour item (job type)
|
||||
--get type of enquiry to display as works type
|
||||
IF NOT c_get_enquiry_type%ISOPEN THEN
|
||||
OPEN c_get_enquiry_type(quote_item_rec.enty_code);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_enquiry_type
|
||||
INTO l_enqu_type_row;
|
||||
CLOSE c_get_enquiry_type;
|
||||
|
||||
l_works(1) := 'Works Type: '||l_enqu_type_row.description;
|
||||
--get service pressure
|
||||
l_works(2) := 'Service Pressure: '|| quote_item_rec.svcpt_code;
|
||||
--get existing meter if appropriate
|
||||
if l_quote_item_row.enty_code <>'INSTALL' or l_quote_item_row.enty_code <>'STD INSTALL' then
|
||||
l_works(4) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||', '|| p_enqu_row.existing_meter_model;
|
||||
end if;
|
||||
end case;
|
||||
|
||||
|
||||
END LOOP;
|
||||
--
|
||||
--add up all the addons and format the string
|
||||
l_works(5) := 'Add-Ons: '|| l_addons;
|
||||
|
||||
return l_works;
|
||||
end determine_works; */
|
||||
|
||||
/*
|
||||
FUNCTION determine_caveats
|
||||
--This function should return a list of caveats, probably in an array, required for
|
||||
--the quotation. It will need to be passed relevent data so that it can make the
|
||||
--determinations
|
||||
%param p_enquiryid - the current enquiry to make determinations against.
|
||||
%param possibly a few more params to get the required data in
|
||||
*/
|
||||
FUNCTION determine_caveats(p_enquiryid in number) RETURN BOOLEAN is
|
||||
|
||||
begin
|
||||
null;
|
||||
end determine_caveats;
|
||||
|
||||
procedure set_quote_items_data (p_quote_data in out quote_data, p_quoteid number, p_enqu_row enquiries%ROWTYPE) is
|
||||
--Enquiry type
|
||||
l_enqu_type_row enquiry_types%ROWTYPE;
|
||||
CURSOR c_get_enquiry_type(cp_enty_code varchar2) IS
|
||||
SELECT *
|
||||
FROM enquiry_types
|
||||
WHERE code = cp_enty_code;
|
||||
--Quote Items
|
||||
l_quote_item_row quote_items%ROWTYPE;
|
||||
CURSOR c_get_quote_item(cp_quoteid number) IS
|
||||
SELECT *
|
||||
FROM quote_items
|
||||
WHERE qute_id = cp_quoteid;
|
||||
--Module data
|
||||
l_module_row modules%ROWTYPE;
|
||||
--Additional Items
|
||||
l_add_item_row additional_items%ROWTYPE;
|
||||
l_works works; --list of works for the quote
|
||||
l_addons varchar(300); --list of addons for the quote
|
||||
l_housing_row housings%ROWTYPE;
|
||||
l_base_row bases%ROWTYPE;
|
||||
l_total_cost number; --used to figure out the liquidated damages costs
|
||||
begin
|
||||
--cycle through the quote items picking up each item to display on the
|
||||
--description of works section
|
||||
FOR quote_item_rec IN c_get_quote_item(p_quoteid) LOOP
|
||||
case quote_item_rec.quit_type
|
||||
when 'BQI' then --base item
|
||||
l_addons := l_addons || ', Base';
|
||||
--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 := 1; -- need to reference the bases table after AH has added the column
|
||||
|
||||
when 'HQI' then --housing item
|
||||
l_addons := l_addons || ', Housing';
|
||||
--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;
|
||||
when 'AQI' then --add-on item
|
||||
l_add_item_row := get_additional_item(quote_item_rec.adit_code);
|
||||
l_addons := l_addons || ', '||l_add_item_row.description;
|
||||
when 'MQI' then --module item
|
||||
l_module_row := get_module_row (quote_item_rec.modu_code);
|
||||
l_works(3) := 'Meter Type: '|| l_module_row.svcp_code || ' ' || l_module_row.metr_code;
|
||||
p_quote_data.outlet_termninal_size := l_module_row.outlet_size;
|
||||
|
||||
when 'LQI' then --labour item (job type)
|
||||
--get type of enquiry to display as works type
|
||||
IF NOT c_get_enquiry_type%ISOPEN THEN
|
||||
OPEN c_get_enquiry_type(quote_item_rec.enty_code);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_enquiry_type
|
||||
INTO l_enqu_type_row;
|
||||
CLOSE c_get_enquiry_type;
|
||||
|
||||
l_works(1) := 'Works Type: '||l_enqu_type_row.description;
|
||||
--get service pressure
|
||||
l_works(2) := 'Service Pressure: '|| quote_item_rec.svcpt_code;
|
||||
--get existing meter if appropriate
|
||||
if l_quote_item_row.enty_code <>'INSTALL' or l_quote_item_row.enty_code <>'STD INSTALL' then
|
||||
l_works(4) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||', '|| p_enqu_row.existing_meter_model;
|
||||
end if;
|
||||
if l_quote_item_row.enty_code <> 'OFMAT' or l_quote_item_row.enty_code <> 'ADVERSARIAL'then
|
||||
l_total_cost := p_quote_data.total_cost;
|
||||
if l_total_cost <= 1000 then
|
||||
p_quote_data.liquid_damage_day := 20;
|
||||
p_quote_data.liquid_damage_cap := 200;
|
||||
else
|
||||
p_quote_data.liquid_damage_day := (l_total_cost/100)*2.5;
|
||||
p_quote_data.liquid_damage_cap := (l_total_cost/100)*25;
|
||||
end if;
|
||||
end if;
|
||||
end case;
|
||||
|
||||
|
||||
END LOOP;
|
||||
--
|
||||
--add up all the addons and format the string
|
||||
l_works(5) := 'Add-Ons: '|| l_addons;
|
||||
p_quote_data.quote_works := l_works;
|
||||
end set_quote_items_data;
|
||||
|
||||
/*
|
||||
FUNCTION get_detailed_quote_data
|
||||
--This function should return all required data for the quotation.
|
||||
--The return value could be a type variable or perhaps an array?
|
||||
%param p_quoteid - the quotation we want to build a pdf for.
|
||||
%param possibly a few more params to get the required data in or change format of pdf
|
||||
%return return the quote data in the quote_data reocrd type
|
||||
*/
|
||||
FUNCTION get_detailed_quote_data(p_quoteid in number) RETURN quote_data is
|
||||
--Quote data
|
||||
l_quote_data quote_data;
|
||||
l_quote_row quotes%ROWTYPE;
|
||||
CURSOR c_get_quote(cp_quote_id number) IS
|
||||
SELECT *
|
||||
FROM quotes
|
||||
WHERE id = cp_quote_id;
|
||||
--Enquiry data
|
||||
l_enquiry_id number;
|
||||
l_enqu_row enquiries%ROWTYPE;
|
||||
CURSOR c_get_enquiry(cp_enqu_id number) IS
|
||||
SELECT *
|
||||
FROM enquiries
|
||||
WHERE id = cp_enqu_id;
|
||||
--supplier 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_supplier_id number;
|
||||
l_agent_id number;
|
||||
l_address_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;
|
||||
--Agent Name
|
||||
l_agent_first_name varchar2(80);
|
||||
l_agent_last_name varchar2(80);
|
||||
--suppler name
|
||||
l_supplier_name varchar2(80);
|
||||
--Meter data
|
||||
--l_meter_row meters%ROWTYPE;
|
||||
--CURSOR c_get_meter(cp_meter_id number) IS
|
||||
-- SELECT *
|
||||
-- FROM meters
|
||||
-- WHERE id = cp_meter_id;
|
||||
--housing data
|
||||
l_housing_row housings%ROWTYPE;
|
||||
|
||||
begin
|
||||
--probably call determine caveats here
|
||||
--we can start filling all the data for the quotation
|
||||
--will need data from the following tables
|
||||
--quotes
|
||||
--enquiries
|
||||
--parties
|
||||
--get the quote's data record
|
||||
IF NOT c_get_quote%ISOPEN THEN
|
||||
OPEN c_get_quote(p_quoteid);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_quote
|
||||
INTO l_quote_row;
|
||||
CLOSE c_get_quote;
|
||||
|
||||
--get the enquiry data
|
||||
l_enquiry_id := l_quote_row.enqu_id;
|
||||
|
||||
IF NOT c_get_enquiry%ISOPEN THEN
|
||||
OPEN c_get_enquiry(l_enquiry_id);
|
||||
END IF;
|
||||
|
||||
FETCH c_get_enquiry
|
||||
INTO l_enqu_row;
|
||||
CLOSE c_get_enquiry;
|
||||
--get the latest supplier address
|
||||
IF NOT c_get_address%ISOPEN THEN
|
||||
OPEN c_get_address(l_supplier_id,'OFFICE');
|
||||
END IF;
|
||||
|
||||
FETCH c_get_address
|
||||
INTO l_addr_row;
|
||||
CLOSE c_get_address;
|
||||
--get current supplier and agent ids for enquiry
|
||||
l_supplier_id := mip_enquiry.get_enquiry_role(l_enqu_row.id,'ENQ SUPP');
|
||||
l_agent_id := mip_enquiry.get_enquiry_role(l_enqu_row.id,'ENQ OWN');
|
||||
--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;
|
||||
--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;
|
||||
|
||||
|
||||
l_agent_first_name := l_party_row.first_name;
|
||||
l_agent_last_name := l_party_row.last_name;
|
||||
|
||||
l_quote_data.quote_ref := l_quote_row.id;
|
||||
l_quote_data.transaction_ref := l_enqu_row.transaction_reference;
|
||||
l_quote_data.mprn := l_enqu_row.mprn;
|
||||
l_quote_data.supplier_address(1) := l_agent_first_name||' '||l_agent_last_name;
|
||||
l_quote_data.supplier_address(2) := l_supplier_name;
|
||||
l_quote_data.supplier_address(3) := l_addr_row.sub_building;
|
||||
l_quote_data.supplier_address(4) := l_addr_row.building;
|
||||
l_quote_data.supplier_address(5) := l_addr_row.street;
|
||||
l_quote_data.supplier_address(6) := l_addr_row.city;
|
||||
l_quote_data.supplier_address(7) := l_addr_row.postcode;
|
||||
l_quote_data.current_date := sysdate;
|
||||
l_quote_data.agent_first_name := l_agent_first_name;
|
||||
l_quote_data.site_address(1) := l_enqu_row.install_sub_building;
|
||||
l_quote_data.site_address(2) := l_enqu_row.install_building;
|
||||
l_quote_data.site_address(3) := l_enqu_row.install_street;
|
||||
l_quote_data.site_address(4) := l_enqu_row.install_city;
|
||||
l_quote_data.site_address(5) := l_enqu_row.install_postcode;
|
||||
l_quote_data.mam := '<need to write routine to get mam>';
|
||||
set_quote_items_data(l_quote_data, l_quote_row.id,l_enqu_row);
|
||||
-- l_quote_data.quote_works := determine_works(l_quote_row.id, l_enqu_row);
|
||||
l_quote_data.lead_time := get_max_lead_time(l_quote_row.id);
|
||||
l_quote_data.total_cost := get_total_cost(l_quote_row.id);
|
||||
l_quote_data.quote_costs := get_quote_costs(l_quote_row.id);
|
||||
--if
|
||||
--l_housing_row := get_housing_row(l_quo
|
||||
--l_quote_data.house_length := l_housing_row
|
||||
return l_quote_data;
|
||||
end get_detailed_quote_data;
|
||||
|
||||
/*
|
||||
FUNCTION generate_detailed_quote_pdf
|
||||
--This function should return a data populated pdf of the detailed quotation.
|
||||
--The return value could be a pdf or reference to a pdf that it has stored in the system?
|
||||
%param p_quote_data - the data to build into the quote.
|
||||
%param possibly a few more params to get the required data in
|
||||
*/
|
||||
FUNCTION generate_detailed_quote_pdf(get_detailed_quote_data in number) RETURN BOOLEAN is
|
||||
begin
|
||||
null;
|
||||
end generate_detailed_quote_pdf;
|
||||
FUNCTION build_detailed_quote(p_enquiryid in number) RETURN BOOLEAN is
|
||||
begin
|
||||
null;
|
||||
end build_detailed_quote;
|
||||
|
||||
BEGIN
|
||||
-- Initialization
|
||||
NULL;
|
||||
END mip_quotation_document;
|
||||
/
|
||||
Reference in New Issue
Block a user