/**Begin D:\PDM_UPGRADE\PDM1\FPM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_REPORTPLAN_ADJUST')
CREATE TABLE T_FPM_REPORTPLAN_ADJUST (
                                         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,
                                         FREPORTORGID BIGINT DEFAULT 0 NOT NULL,
                                         FREPORTTYPEID BIGINT DEFAULT 0 NOT NULL,
                                         FREPORTPERIODID BIGINT DEFAULT 0 NOT NULL,
                                         FADJUSTTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                         FAPPLYDATE DATETIME,
                                         FADJUSTREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                         FORIGINALREPORTIDS NVARCHAR(2000) DEFAULT ' ' NOT NULL,
                                         FPAGEDIMENSIONTYPE1 NVARCHAR(30) DEFAULT ' ' NOT NULL,
                                         FPAGEDIMENSIONTYPE2 NVARCHAR(30) DEFAULT ' ' NOT NULL,
                                         FMAINREPORTID BIGINT DEFAULT 0 NOT NULL,
                                         FAMOUNTUNIT VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_CHGREPORTDATAMAIN')
CREATE TABLE T_FPM_CHGREPORTDATAMAIN (
                                         FID BIGINT DEFAULT 0 NOT NULL,
                                         FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                         FSEQ INT DEFAULT 0 NOT NULL,
                                         FBODYSYSID BIGINT DEFAULT 0 NOT NULL,
                                         FORGMEMID BIGINT DEFAULT 0 NOT NULL,
                                         FCURRENCYMEMID BIGINT DEFAULT 0 NOT NULL,
                                         FPERIODMEMID BIGINT DEFAULT 0 NOT NULL,
                                         FSUBJECTMEMID BIGINT DEFAULT 0 NOT NULL,
                                         FCOMPANYMEMID BIGINT DEFAULT 0 NOT NULL,
                                         FSETTLETYPEMEMID BIGINT DEFAULT 0 NOT NULL,
                                         FEXTMEM1ID BIGINT DEFAULT 0 NOT NULL,
                                         FEXTMEM2ID BIGINT DEFAULT 0 NOT NULL,
                                         FEXTMEM3ID BIGINT DEFAULT 0 NOT NULL,
                                         FPLANAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                         FLOCKAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                         FREALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                         FCURRENTADJUSTAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                         FADJUSTEDPLANAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                         FORIGINALPLANAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                         FORIGINDATAROW INT DEFAULT 0 NOT NULL,
                                         FORIGINDATACOL INT DEFAULT 0 NOT NULL,
                                         FEFFECTFLAG CHAR(1) DEFAULT '0' NOT NULL,
                                         FREPORTPERIOD BIGINT DEFAULT 0 NOT NULL,
                                         FMAINTABLE CHAR(1) DEFAULT '0' NOT NULL,
                                         FAMOUNTUNIT VARCHAR(50) DEFAULT ' ' NOT NULL,
                                         FORIGINALREPORTID BIGINT DEFAULT 0 NOT NULL,
                                         FORIGINALREPORTDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_CHGREPORTDATADETAIL')
CREATE TABLE T_FPM_CHGREPORTDATADETAIL (
                                           FID BIGINT DEFAULT 0 NOT NULL,
                                           FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                           FSEQ INT DEFAULT 0 NOT NULL,
                                           FMAINDIMDATAID BIGINT DEFAULT 0 NOT NULL,
                                           FOPUSERTYPE NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                           FOPUSERNAME BIGINT DEFAULT 0 NOT NULL,
                                           FBANKCATE BIGINT DEFAULT 0 NOT NULL,
                                           FBUSINESSPARTNER BIGINT DEFAULT 0 NOT NULL,
                                           FCONTRACTNO NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FCONTRACTNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FPLANDATE DATETIME,
                                           FBANKACCOUNT BIGINT DEFAULT 0 NOT NULL,
                                           FDETAILEXT1 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT2 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT3 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT4 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT5 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT6 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT7 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FDETAILEXT8 NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                           FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_ADJUSTAMTINFO')
CREATE TABLE T_FPM_ADJUSTAMTINFO (
                                     FID BIGINT DEFAULT 0 NOT NULL,
                                     FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                     FSEQ INT DEFAULT 0 NOT NULL,
                                     FCURRENCY BIGINT DEFAULT 0 NOT NULL,
                                     FCUSTOMPAGE1 BIGINT DEFAULT 0 NOT NULL,
                                     FCUSTOMPAGE2 BIGINT DEFAULT 0 NOT NULL,
                                     FAMTUNIT VARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FADJUSTSUMAMTIN DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                     FADJUSTSUMAMTOUT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                     FADJUSTSUMAMTBAL DECIMAL(23,10) DEFAULT 0 NOT NULL
);



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