/**Begin D:\softwaresetup\PDM_UPGRADE\PDM1\FPM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATEINFO_BAK')
 CREATE TABLE T_FPM_TEMPLATEINFO_BAK (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTARTCELL VARCHAR(50) DEFAULT ' ' NOT NULL,
FMAXNUM INT DEFAULT 0 NOT NULL,
FAMOUNTUNIT VARCHAR(50) DEFAULT ' ' NOT NULL,
FISMAINTABLE CHAR(1) DEFAULT '0' NOT NULL,
FSUBTEMPLATECOUNT INT DEFAULT 0 NOT NULL,
FRELEASESTATUS CHAR(1) DEFAULT '0' NOT NULL,
FSPREADDATA VARCHAR(500) DEFAULT ' ' NOT NULL,
FSPREADDATA_TAG NCLOB,
FISINCLUDESUM CHAR(1) DEFAULT '0' NOT NULL,
FISSHOWCOMBINE CHAR(1) DEFAULT '0' NOT NULL,
FISDISTINGUISH CHAR(1) DEFAULT '0' NOT NULL,
FISSHOWNOTE CHAR(1) DEFAULT '0' NOT NULL,
FNOTENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATEINFO_BAK_L') 
 CREATE TABLE T_FPM_TEMPLATEINFO_BAK_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMMENT VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATEBAKUSER') 
 CREATE TABLE T_FPM_TEMPLATEBAKUSER (
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_FPM_TPLBAK_CURRENCY') 
 CREATE TABLE T_FPM_TPLBAK_CURRENCY (
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_FPM_TEMPLATEBAK_DIMSET') 
 CREATE TABLE T_FPM_TEMPLATEBAK_DIMSET (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FDIMID BIGINT DEFAULT 0 NOT NULL,
FTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONTAINSUBTOTAL CHAR(1) DEFAULT '0' NOT NULL,
FISOPEN CHAR(1) DEFAULT '0' NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FISHIDE CHAR(1) DEFAULT '0' NOT NULL,
FDIMBDTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMBDID BIGINT DEFAULT 0 NOT NULL,
FSEQUENCE INT DEFAULT 0 NOT NULL,
FISDETAILDIM CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TEMPLATEBAK_LAYOUT') 
 CREATE TABLE T_FPM_TEMPLATEBAK_LAYOUT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLAYOUTDIM BIGINT DEFAULT 0 NOT NULL,
FDIMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMLEVEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FISEXPANDMEM CHAR(1) DEFAULT '0' NOT NULL,
FDIMHIDE CHAR(1) DEFAULT '0' NOT NULL,
FISCONTAINTOTAL CHAR(1) DEFAULT '0' NOT NULL
);


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


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_TPLBAK_REPORTTYPE') 
 CREATE TABLE T_FPM_TPLBAK_REPORTTYPE (
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_FPM_TEMPLATEBAK_SUBJECT') 
 CREATE TABLE T_FPM_TEMPLATEBAK_SUBJECT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUBJECTID BIGINT DEFAULT 0 NOT NULL,
FSUBTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FFORMULA VARCHAR(1000) DEFAULT ' ' NOT NULL,
FFORMULA_TAG NCLOB,
FREPORTWAYS VARCHAR(50) DEFAULT ' ' NOT NULL,
FISLEAF CHAR(1) DEFAULT '1' NOT NULL
);


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



/**End D:\softwaresetup\PDM_UPGRADE\PDM1\FPM_table.sql **/
