Commit 4b1fbe62 authored by Frank Bergmann's avatar Frank Bergmann

- Many changes at draco

- Changed im_cost_items to im_costs
- Started with repeating costs index
parent 6635d7da
...@@ -201,39 +201,6 @@ select category_id as partner_type_id, category as partner_type ...@@ -201,39 +201,6 @@ select category_id as partner_type_id, category as partner_type
from im_categories from im_categories
where category_type = 'Intranet Partner Type'; where category_type = 'Intranet Partner Type';
------------------------------------------------------
-- HR
--
create or replace view im_prior_experiences as
select category_id as experience_id, category as experience
from im_categories
where category_type = 'Intranet Prior Experience';
create or replace view im_hiring_sources as
select category_id as source_id, category as source
from im_categories
where category_type = 'Intranet Hiring Source';
create or replace view im_job_titles as
select category_id as job_title_id, category as job_title
from im_categories
where category_type = 'Intranet Job Title';
create or replace view im_departments as
select category_id as department_id, category as department
from im_categories
where category_type = 'Intranet Department';
create or replace view im_qualification_processes as
select category_id as qualification_id, category as qualification
from im_categories
where category_type = 'Intranet Qualification Process';
create or replace view im_employee_pipeline_states as
select category_id as state_id, category as state
from im_categories
where category_type = 'Intranet Employee Pipeline State';
------------------------------------------------------ ------------------------------------------------------
-- Offices -- Offices
-- --
...@@ -422,32 +389,6 @@ insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGO ...@@ -422,32 +389,6 @@ insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGO
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', 134, 'Full Time', 'Intranet Task Board Time Frame'); ('', 'f', 134, 'Full Time', 'Intranet Task Board Time Frame');
-- Intranet Departments
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '201', 'Administration', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '202', 'Business Development', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '203', 'Client services', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '204', 'Finance', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '205', 'Internal IT Support', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '206', 'Legal', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '207', 'Marketing', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '208', 'Office management', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '209', 'Operations', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '210', 'Human Resources', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '211', 'Sales', 'Intranet Department');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values
('', 'f', '212', 'Senior Management', 'Intranet Department');
-- Intranet Anual Revenue -- Intranet Anual Revenue
......
...@@ -266,81 +266,92 @@ prompt *** intranet-potransdemo-data - Project/Open Translation Demo Data ...@@ -266,81 +266,92 @@ prompt *** intranet-potransdemo-data - Project/Open Translation Demo Data
-- im_start_blocks record the dates these blocks will start for -- im_start_blocks record the dates these blocks will start for
-- this system. -- this system.
create table im_start_blocks ( create table im_start_weeks (
start_block date not null, start_block date not null
block_type varchar(50) constraint im_start_weeks_pk
constraint im_start_blocks_type_ck primary key,
check(block_type in ('week','month')),
-- We might want to tag a larger unit -- We might want to tag a larger unit
-- For example, if start_block is the first -- For example, if start_block is the first
-- Sunday of a week, those tagged with -- Sunday of a week, those tagged with
-- start_of_larger_unit_p might tag -- start_of_larger_unit_p might tag
-- the first Sunday of a month -- the first Sunday of a month
start_of_larger_unit_p char(1) default 'f' start_of_larger_unit_p char(1) default 'f'
constraint im_start_blocks_larger_ck constraint im_start_weeks_larger_ck
check (start_of_larger_unit_p in ('t','f')), check (start_of_larger_unit_p in ('t','f')),
note varchar(4000), note varchar(4000)
constraint im_start_blocks_pk
primary key (start_block, block_type)
); );
create table im_start_months (
start_block date not null
constraint im_start_months_pk
primary key,
-- We might want to tag a larger unit
-- For example, if start_block is the first
-- Sunday of a week, those tagged with
-- start_of_larger_unit_p might tag
-- the first Sunday of a month
start_of_larger_unit_p char(1) default 'f'
constraint im_start_months_larger_ck
check (start_of_larger_unit_p in ('t','f')),
note varchar(4000)
);
-- Populate im_start_blocks with weeks. Start with Sunday, -- Populate im_start_weeks. Start with Sunday,
-- Jan 7th 1996 and end after inserting 1000 weeks. Note -- Jan 7th 1996 and end after inserting 1000 weeks. Note
-- that 1000 is a completely arbitrary number. -- that 1000 is a completely arbitrary number.
DECLARE DECLARE
v_max integer; v_max integer;
v_i integer; v_i integer;
v_first_block_of_month integer; v_first_block_of_month integer;
v_next_start_block date; v_next_start_week date;
BEGIN BEGIN
v_max := 1000; v_max := 1000;
FOR v_i IN 0..v_max-1 LOOP FOR v_i IN 0..v_max-1 LOOP
-- for convenience, select out the next start block to insert into a variable -- for convenience, select out the next start block to insert into a variable
select to_date('1996-01-07','YYYY-MM-DD') + v_i*7 select to_date('1996-01-07','YYYY-MM-DD') + v_i*7
into v_next_start_block into v_next_start_week
from dual; from dual;
insert into im_start_blocks ( insert into im_start_weeks (
start_block, start_block
block_type
) values ( ) values (
to_date(v_next_start_block), to_date(v_next_start_week)
'week'
); );
-- set the start_of_larger_unit_p flag if this is the first -- set the start_of_larger_unit_p flag if this is the first
-- start block of the month -- start block of the month
update im_start_blocks update im_start_weeks
set start_of_larger_unit_p='t' set start_of_larger_unit_p='t'
where start_block=to_date(v_next_start_block) where start_block=to_date(v_next_start_week)
and not exists ( and not exists (
select 1 select 1
from im_start_blocks from im_start_weeks
where to_char(start_block,'YYYY-MM') = where to_char(start_block,'YYYY-MM') =
to_char(v_next_start_block,'YYYY-MM') to_char(v_next_start_week,'YYYY-MM')
and start_of_larger_unit_p='t'); and start_of_larger_unit_p='t');
END LOOP; END LOOP;
END;
/
show errors;
-- Populate im_start_months. Start with im_start_weeks
-- dates and check for the beginning of a new month.
BEGIN
for row in ( for row in (
select unique concat(to_char(start_block, 'YYYY-MM'),'-01') as first_day_in_month select unique concat(to_char(start_block, 'YYYY-MM'),'-01') as first_day_in_month
from im_start_blocks from im_start_weeks
where block_type = 'week'
) loop ) loop
insert into im_start_blocks ( insert into im_start_months (
start_block, start_block
block_type
) values ( ) values (
to_date(row.first_day_in_month), to_date(row.first_day_in_month)
'month'
); );
end loop; end loop;
END; END;
/ /
show errors; show errors;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment