/**Begin D:\PDM_UPGRADE\PDM1\FPM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_EXECUTEPLAN')
CREATE TABLE T_FPM_EXECUTEPLAN (
                                   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,
                                   FBODYSYS BIGINT DEFAULT 0 NOT NULL,
                                   FPLANEXECUTEOP NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FEXECUTEDATE DATETIME,
                                   FOLDEXECUTERECORDNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FEXECUTEOPERATORSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
                                   FBILLMATCHRULE BIGINT DEFAULT 0 NOT NULL,
                                   FBIZBILLID BIGINT DEFAULT 0 NOT NULL,
                                   FEXECTUEFAILREASON NVARCHAR(1000) DEFAULT ' ' NOT NULL,
                                   FREPORTORG BIGINT DEFAULT 0 NOT NULL,
                                   FVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FREPORTTYPE BIGINT DEFAULT 0 NOT NULL,
                                   FREPORTPERIOD BIGINT DEFAULT 0 NOT NULL,
                                   FORGMEM BIGINT DEFAULT 0 NOT NULL,
                                   FCURRENCYMEM BIGINT DEFAULT 0 NOT NULL,
                                   FPERIODMEM BIGINT DEFAULT 0 NOT NULL,
                                   FSUBJECTMEM BIGINT DEFAULT 0 NOT NULL,
                                   FCOMPANYMEM BIGINT DEFAULT 0 NOT NULL,
                                   FSETTLETYPEMEM BIGINT DEFAULT 0 NOT NULL,
                                   FREALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                   FRATEDATE DATETIME,
                                   FOPUSERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FOPUSERNAME BIGINT DEFAULT 0 NOT NULL,
                                   FBANKCATE BIGINT DEFAULT 0 NOT NULL,
                                   FCONTRACTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FCONTRACTNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FPLANDATE DATETIME,
                                   FDETAILEXT1 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT2 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT3 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT4 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT5 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT6 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT7 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FDETAILEXT8 NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                   FREPORTDATAID BIGINT DEFAULT 0 NOT NULL,
                                   FDELETEFLAG CHAR(1) DEFAULT '0' NOT NULL,
                                   FREALAMTBASE BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_EXECUTEPLAN_BIZINFO')
CREATE TABLE T_FPM_EXECUTEPLAN_BIZINFO (
                                           FID BIGINT DEFAULT 0 NOT NULL,
                                           FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                           FSEQ INT DEFAULT 0 NOT NULL,
                                           FBIZPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                           FBIZVALUE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_EXECUTEPLAN_E')
CREATE TABLE T_FPM_EXECUTEPLAN_E (
                                     FID BIGINT DEFAULT 0 NOT NULL,
                                     FBIZBILLAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                     FBILLBIZETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FBIZBILLCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FENTRYTYPENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FENTRYTYPENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FEXECUTEINFO NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FBIZBILLCURRENCY BIGINT DEFAULT 0 NOT NULL,
                                     FBIZBILLCURRENCYTEXT NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                     FBIZORG NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_MATCHRULE')
CREATE TABLE T_FPM_MATCHRULE (
                                 FID BIGINT DEFAULT 0 NOT NULL,
                                 FNUMBER CHAR(50) DEFAULT ' ' NOT NULL,
                                 FSTATUS CHAR(5) 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,
                                 FBODYSYS BIGINT DEFAULT 0 NOT NULL,
                                 FBUSINESSBILL VARCHAR(50) DEFAULT ' ' NOT NULL,
                                 FABNORMALCONDITION NVARCHAR(1024) DEFAULT ' ' NOT NULL,
                                 FABNORMALCONDITIONREAL NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                 FABNORMALCONDITIONREAL_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_MATCHRULE_RULE')
CREATE TABLE T_FPM_MATCHRULE_RULE (
                                      FID BIGINT DEFAULT 0 NOT NULL,
                                      FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                      FSEQ INT DEFAULT 0 NOT NULL,
                                      FBUSINESSBILLFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
                                      FDIMENSIONMEMBERMAP BIGINT DEFAULT 0 NOT NULL,
                                      FALLOWEMPTY CHAR(1) DEFAULT '0' NOT NULL,
                                      FMAPRELATION VARCHAR(50) DEFAULT ' ' NOT NULL,
                                      FSECONDBUSINESSBILL VARCHAR(50) DEFAULT ' ' NOT NULL,
                                      FDIMENSIONTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                      FDIMENSIONDETAIL BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FPM_MATCHRULE_L')
CREATE TABLE T_FPM_MATCHRULE_L (
                                   FPKID CHAR(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
);



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