--数据快报
create table UR_FARPT_PLAN  (
   FANA_ID              VARCHAR2(36)                     not null,
   FANA_NAME            VARCHAR2(120),
   SEQ_NO               INTEGER                        default 1,
   G_FANA_ID            VARCHAR2(36),
   G_ARPT_ID            VARCHAR2(36),
   ARPT_ID              VARCHAR2(36),
   REF_TYPE             VARCHAR2(1)                    default '0',
   LAST_REF_PERD_CODE   VARCHAR2(30),
   LAST_REF_TIME        VARCHAR2(20),
   REF_START_TIME       VARCHAR2(8),
   USER_SCOPE           VARCHAR2(1)                    default '0',
   constraint PK_UR_FARPT_PLAN primary key (FANA_ID)
);

create table UR_FARPT_PLAN_G  (
   G_FANA_ID            VARCHAR2(36)                     not null,
   G_FANA_NAME          VARCHAR2(120),
   SEQ_NO               INTEGER                        default 1,
   constraint PK_UR_FARPT_PLAN_G primary key (G_FANA_ID)
);

create table UR_FARPT_PLAN_PARAM  (
   FANA_ID              VARCHAR2(36)                     not null,
   PARAM_CODE           VARCHAR2(30)                     not null,
   PARAM_VAL            VARCHAR2(4000),
   constraint PK_UR_FARPT_PLAN_PARAM primary key (FANA_ID, PARAM_CODE)
);

create table UR_FARPT_PLAN_USER  (
   FANA_ID              VARCHAR2(36)                     not null,
   USER_ID              VARCHAR2(36)                     not null,
   constraint PK_UR_FARPT_PLAN_USER primary key (FANA_ID, USER_ID)
);

--数据快报菜单
Insert into ur_sys_menu
   (mod_id, l_code, is_end, mod_code, mod_name, mod_type, form_name, pack_name, param, mod_tag, user_id)
 Values
   ('SYS_FRPT_DESIGN', '00030006', '1', 'SYS_FRPT_DESIGN', '数据快报设计', 
    'MOD', 'TfrmFRPTD', 'RptQuery.exe', NULL, 4, 
    '*');
Insert into ur_sys_menu
   (mod_id, l_code, is_end, mod_code, mod_name, mod_type, form_name, pack_name, param, mod_tag, user_id)
 Values
   ('SYS_FRPT_QUERY', '00030007', '1', 'SYS_FRPT_QUERY', '数据快报查询', 
    'MOD', 'TfrmFRPTQ', 'RptQuery.exe', NULL, 4, 
    '*');


Insert into ur_sys_res
   (lang_type, mod_id, res_id, res_type, seq_no, org_name, disp_name, mark)
 Values
   ('chi', 'SYS_FRPT_DESIGN', 'FUNC_SAVE', 'F', 2, 
    '设置', '设置', '设置');
Insert into ur_sys_res
   (lang_type, mod_id, res_id, res_type, seq_no, org_name, disp_name, mark)
 Values
   ('chi', 'SYS_FRPT_DESIGN', 'FUNC_SEARCH', 'F', 1, 
    '查询', '查询', '查询');
Insert into ur_sys_res
   (lang_type, mod_id, res_id, res_type, seq_no, org_name, disp_name, mark)
 Values
   ('chi', 'SYS_FRPT_DESIGN', 'MOD', 'R', 1, 
    '数据快报设置', '数据快报设置', '数据快报设置');
Insert into ur_sys_res
   (lang_type, mod_id, res_id, res_type, seq_no, org_name, disp_name, mark)
 Values
   ('chi', 'SYS_FRPT_QUERY', 'FUNC_SEARCH', 'F', 1, 
    '查询', '查询', '查询');
Insert into ur_sys_res
   (lang_type, mod_id, res_id, res_type, seq_no, org_name, disp_name, mark)
 Values
   ('chi', 'SYS_FRPT_QUERY', 'MOD', 'R', 1, 
    '数据快报查询', '数据快报查询', '数据快报查询');


--启用任务时可以调整公式
alter table ur_task add IS_UPD_FML_IN_USE varchar2(1) default '0';

--系统调度表
create table UR_SYS_SCHEDULE  (
   SCH_CODE             VARCHAR2(10)                     not null,
   SCH_NAME             VARCHAR2(120),
   REF_TYPE             VARCHAR2(1)                    default '2',
   REF_START_TIME       VARCHAR2(8),
   LAST_REF_TIME        VARCHAR2(20),
   IS_USE               VARCHAR2(1)                    default '0',
   constraint PK_UR_SYS_SCHEDULE primary key (SCH_CODE)
);

alter table UR_SYS_SCHEDULE add LAST_REF_STATUS varchar2(1) default '0';

Insert into ur_sys_schedule
   (sch_code, sch_name, ref_type, ref_start_time, last_ref_time, is_use)
 Values
   ('SCH_DEF', '系统缺省调度', '0', '22:00:00', NULL, 
    '0');
