/**Begin D:\PDM_UPGRADE\PDM1\FPM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_REPORTPLANSUM') 
 CREATE TABLE T_FPM_REPORTPLANSUM (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FBODYSYSID BIGINT DEFAULT 0 NOT NULL,
FSUMMARYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREPORTORGID BIGINT DEFAULT 0 NOT NULL,
FREPORTTYPEID BIGINT DEFAULT 0 NOT NULL,
FREPORTPERIODID BIGINT DEFAULT 0 NOT NULL,
FREPORTCOUNT BIGINT DEFAULT 0 NOT NULL,
FOFFSETORNOT CHAR(1) DEFAULT '0' NOT NULL,
FDECLARESTARTDATE DATETIME,
FDECLAREDEADLINE DATETIME,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPLANSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCHANGESTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREPORTNUM INT DEFAULT 0 NOT NULL,
FPLANNUM INT DEFAULT 0 NOT NULL,
FNEXTNUM INT DEFAULT 0 NOT NULL,
FSBPLANNUM INT DEFAULT 0 NOT NULL,
FSBNEXTNUM INT DEFAULT 0 NOT NULL,
FAMOUNTUNIT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXRATETABLE BIGINT DEFAULT 0 NOT NULL,
FEXCHANGERATEDATE DATETIME,
FORIGINALREPORTIDS NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FMAINREPORTID BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_REPORTPLANSUM_C') 
 CREATE TABLE T_FPM_REPORTPLANSUM_C (
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_REPORTPLANSUM_L') 
 CREATE TABLE T_FPM_REPORTPLANSUM_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_PLANSUM_ATTACHTPL') 
 CREATE TABLE T_FPM_PLANSUM_ATTACHTPL (
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_PLANSUM_PERIOD') 
 CREATE TABLE T_FPM_PLANSUM_PERIOD (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



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