/**Begin D:\PDM_UPGRADE\PDM1\HRPTMC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_CALREFFIELD') 
 CREATE TABLE T_HRPTMC_CALREFFIELD (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FREFTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FREFFIELDALIAS VARCHAR(300) DEFAULT ' ' NOT NULL,
FREFCALFIELDID BIGINT DEFAULT 0 NOT NULL,
FPREINDEXID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_CALCULATEFIELD_L') 
 CREATE TABLE T_HRPTMC_CALCULATEFIELD_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_CALCULATEFIELD') 
 CREATE TABLE T_HRPTMC_CALCULATEFIELD (
FID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(20) DEFAULT 'simple' NOT NULL,
FVALUETYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FCONTROLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FEXPR NCLOB,
FSOURCE VARCHAR(20) DEFAULT ' ' NOT NULL,
FORDER INT DEFAULT 0 NOT NULL,
FISSELECTED CHAR(1) DEFAULT '1' NOT NULL,
FANOBJID BIGINT DEFAULT 0 NOT NULL,
FREPORTID BIGINT DEFAULT 0 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_HRPTMC_ANOBJQUERYFIELD_L') 
 CREATE TABLE T_HRPTMC_ANOBJQUERYFIELD_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ANALYSISOBJECT_L') 
 CREATE TABLE T_HRPTMC_ANALYSISOBJECT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ANOBJJOINCOND') 
 CREATE TABLE T_HRPTMC_ANOBJJOINCOND (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FLEFTPROP VARCHAR(300) DEFAULT ' ' NOT NULL,
FCOMPARETYPE VARCHAR(50) DEFAULT '=' NOT NULL,
FRIGHTPROP VARCHAR(300) DEFAULT ' ' NOT NULL,
FRIGHTPROPTYPE VARCHAR(10) DEFAULT 'field' NOT NULL,
FRIGHTPROPVAL NCLOB,
FLOGICTYPE VARCHAR(10) DEFAULT 'and' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ANOBJENTJOINREL') 
 CREATE TABLE T_HRPTMC_ANOBJENTJOINREL (
FID BIGINT DEFAULT 0 NOT NULL,
FANOBJID BIGINT DEFAULT 0 NOT NULL,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FJOINTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FJOINENTITYID BIGINT DEFAULT 0 NOT NULL,
FISV VARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION INT DEFAULT 0 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_HRPTMC_ANOBJJOINENTITY') 
 CREATE TABLE T_HRPTMC_ANOBJJOINENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FANOBJID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYALIAS VARCHAR(50) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FISV VARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION INT DEFAULT 0 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_HRPTMC_ANOBJQUERYFIELD') 
 CREATE TABLE T_HRPTMC_ANOBJQUERYFIELD (
FID BIGINT DEFAULT 0 NOT NULL,
FANOBJID BIGINT DEFAULT 0 NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFIELDALIAS VARCHAR(300) DEFAULT ' ' NOT NULL,
FFIELDPATH VARCHAR(300) DEFAULT ' ' NOT NULL,
FVALUETYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FCOMPLEXTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FCONTROLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FDIMCOUNT INT DEFAULT 0 NOT NULL,
FSTOREFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FISV VARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION INT DEFAULT 0 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_HRPTMC_COLFIELD') 
 CREATE TABLE T_HRPTMC_COLFIELD (
FID BIGINT DEFAULT 0 NOT NULL,
FBIZINDEX INT DEFAULT 0 NOT NULL,
FDISPLAYNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNUMBERALIAS VARCHAR(300) DEFAULT ' ' NOT NULL,
FRPTMANAGEID BIGINT DEFAULT 0 NOT NULL,
FANOBJFIELDID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_COLFIELD_L') 
 CREATE TABLE T_HRPTMC_COLFIELD_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDISPLAYNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_REPORTCONFIG') 
 CREATE TABLE T_HRPTMC_REPORTCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FTYPE VARCHAR(10) DEFAULT '0' NOT NULL,
FTOTAL CHAR(1) DEFAULT '0' NOT NULL,
FSUBTOTAL CHAR(1) DEFAULT '0' NOT NULL,
FPAGE CHAR(1) DEFAULT '0' NOT NULL,
FSHOWSEQ CHAR(1) DEFAULT '0' NOT NULL,
FMERGECELL CHAR(1) DEFAULT '0' NOT NULL,
FROWCOLTRANSPOSITION NCLOB,
FHEADERMERGE NCLOB,
FRPTMANAGEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_REPORTMANAGE') 
 CREATE TABLE T_HRPTMC_REPORTMANAGE (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FPUBLISHSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FDISABLEDATE DATETIME,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FCLOUDID VARCHAR(60) DEFAULT '0' NOT NULL,
FANOBJID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_REPORTMANAGE_L') 
 CREATE TABLE T_HRPTMC_REPORTMANAGE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ROWFIELD') 
 CREATE TABLE T_HRPTMC_ROWFIELD (
FID BIGINT DEFAULT 0 NOT NULL,
FBIZINDEX INT DEFAULT 0 NOT NULL,
FDISPLAYNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNUMBERALIAS NVARCHAR(300) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(10) DEFAULT '0' NOT NULL,
FALGORITHM VARCHAR(10) DEFAULT ' ' NOT NULL,
FDISPLAYMODE VARCHAR(10) DEFAULT 'tile' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FRPTMANAGEID BIGINT DEFAULT 0 NOT NULL,
FMERGETYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FANOBJFIELDID BIGINT DEFAULT 0 NOT NULL,
FCALCIDXFIELDID BIGINT DEFAULT 0 NOT NULL,
FPREIDXFIELDID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ROWFIELD_L') 
 CREATE TABLE T_HRPTMC_ROWFIELD_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDISPLAYNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_SUBTOTRFIELDREF') 
 CREATE TABLE T_HRPTMC_SUBTOTRFIELDREF (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRPTMC_ANALYSISOBJECT') 
 CREATE TABLE T_HRPTMC_ANALYSISOBJECT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FDATAFILTER NCLOB,
FSTORESTATUS VARCHAR(2) DEFAULT '-1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FSTOREENTITY VARCHAR(50) DEFAULT ' ' NOT NULL,
FISV VARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION INT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);



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