/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_XLA_MERGE_CUSTFLDS')
CREATE TABLE T_FAH_XLA_MERGE_CUSTFLDS (
                                          FID BIGINT DEFAULT 0 NOT NULL,
                                          FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                          FSEQ INT DEFAULT 0 NOT NULL,
                                          FSRCBILLTYPE VARCHAR(36) DEFAULT ' ' NOT NULL,
                                          FCUSTOMFIELD VARCHAR(1000) DEFAULT ' ' NOT NULL,
                                          FCUSTOMFIELDDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_XLA_MERGE_RULE')
CREATE TABLE T_FAH_XLA_MERGE_RULE (
                                      FID BIGINT DEFAULT 0 NOT NULL,
                                      FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
                                      FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                      FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
                                      FENABLE CHAR(1) DEFAULT '0' NOT NULL,
                                      FCREATETIME DATETIME,
                                      FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                      FMODIFYTIME DATETIME,
                                      FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                                      FACCTPURPOSEID BIGINT DEFAULT 0 NOT NULL,
                                      FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                      FGRPSAME_BOOKDATE CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPSAME_BIZDATE CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPSAME_CREATOR CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPSAME_BILLNUM CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPSAME_CUSTOMFIELD CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPDIFF_EXCHANGERATE CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPDIFF_UNITPRICE CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPDIFF_DC CHAR(1) DEFAULT ' ' NOT NULL,
                                      FGRPDIFF_CUSTOMFIELD CHAR(1) DEFAULT ' ' NOT NULL,
                                      FCUSTOM_GRPFIELD VARCHAR(100) DEFAULT ' ' NOT NULL,
                                      FPOSTZEROAMTLINETOGL CHAR(1) DEFAULT ' ' NOT NULL,
                                      FSUMMARYTYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_XLA_VCH_REWRTRULE')
CREATE TABLE T_FAH_XLA_VCH_REWRTRULE (
                                         FID BIGINT DEFAULT 0 NOT NULL,
                                         FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                         FSEQ INT DEFAULT 0 NOT NULL,
                                         FSRCFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                         FSRCFIELDKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
                                         FFIELDSET VARCHAR(50) DEFAULT ' ' NOT NULL,
                                         FFIELDSETVAL VARCHAR(50) DEFAULT ' ' NOT NULL,
                                         FFIELDSETTYPE CHAR(1) DEFAULT ' ' NOT NULL,
                                         FSRCFIELDENABLE CHAR(1) DEFAULT ' ' NOT NULL,
                                         FDATATYPE VARCHAR(2) DEFAULT ' ' NOT NULL
);


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



/**End D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
