/**Begin D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HRPTMC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTC_USERPERM')
CREATE TABLE T_HRPTC_USERPERM (
                                  FUSERPERMID BIGINT DEFAULT 0 NOT NULL,
                                  FDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                  FUSERID BIGINT DEFAULT 0 NOT NULL,
                                  FSTATUS VARCHAR(2) DEFAULT '1' NOT NULL,
                                  FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                  FCREATETIME DATETIME,
                                  FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                                  FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTC_USERPERM_L')
CREATE TABLE T_HRPTC_USERPERM_L (
                                    FUSERPERMID BIGINT DEFAULT 0 NOT NULL,
                                    FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
                                    FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
                                    FDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTC_FIELDDISABLEENTRY')
CREATE TABLE T_HRPTC_FIELDDISABLEENTRY (
                                           FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                           FSEQ INT DEFAULT 0 NOT NULL,
                                           FDISABLEFIELDID BIGINT DEFAULT 0 NOT NULL,
                                           FDISABLEFIELDREPORTID BIGINT DEFAULT 0 NOT NULL,
                                           FUSERPERMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTC_RPTPERMDATA')
CREATE TABLE T_HRPTC_RPTPERMDATA (
                                     FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                     FSEQ INT DEFAULT 0 NOT NULL,
                                     FUSERID BIGINT DEFAULT 0 NOT NULL,
                                     FREPORTID BIGINT DEFAULT 0 NOT NULL,
                                     FQUERYFIELDID BIGINT DEFAULT 0 NOT NULL,
                                     FISMERGE CHAR(1) DEFAULT '0' NOT NULL,
                                     FSTARTDATE DATETIME,
                                     FENDDATE DATETIME,
                                     FDATA NCLOB,
                                     FREPORTPERMID BIGINT DEFAULT 0 NOT NULL,
                                     FPERMGROUP VARCHAR(200) DEFAULT ' ' NOT NULL,
                                     FADMINORGSTRUCTID BIGINT DEFAULT 0 NOT NULL,
                                     FNOLIMIT CHAR(1) DEFAULT '0' NOT NULL,
                                     FDISMODIFYUSERID BIGINT DEFAULT 0 NOT NULL,
                                     FINCLUDESUB CHAR(1) DEFAULT '0' NOT NULL,
                                     FUSERPERMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTC_SELECTREPORTENTRY')
CREATE TABLE T_HRPTC_SELECTREPORTENTRY (
                                           FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                           FSEQ INT DEFAULT 0 NOT NULL,
                                           FSELECTREPORTID BIGINT DEFAULT 0 NOT NULL,
                                           FSELECTREPORTISMERGE CHAR(1) DEFAULT '0' NOT NULL,
                                           FUSERID BIGINT DEFAULT 0 NOT NULL,
                                           FSTARTDATE DATETIME,
                                           FENDDATE DATETIME,
                                           FADMINUSERID BIGINT DEFAULT 0 NOT NULL,
                                           FUSERPERMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTC_SELECTREPORTGROUP')
CREATE TABLE T_HRPTC_SELECTREPORTGROUP (
                                           FDETAILID BIGINT DEFAULT 0 NOT NULL,
                                           FSEQ INT DEFAULT 0 NOT NULL,
                                           FSELECTREPORTGROUPKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
                                           FENTRYID BIGINT DEFAULT 0 NOT NULL
);



/**End D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HRPTMC_table.sql **/
