/**Begin D:\PDM_UPGRADE\PDM1\FA_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_MERGEBILL')
CREATE TABLE T_FA_MERGEBILL (
                                FID BIGINT DEFAULT 0 NOT NULL,
                                FORGID BIGINT DEFAULT 0 NOT NULL,
                                FBILLNO NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                FMERGEDATE DATETIME,
                                FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
                                FREALCARDID BIGINT DEFAULT 0 NOT NULL,
                                FMERGEPERIODID BIGINT DEFAULT 0 NOT NULL,
                                FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
                                FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                FVOUCHERFLAG CHAR(1) DEFAULT 'A' NOT NULL,
                                FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                FCREATETIME DATETIME,
                                FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                                FMODIFYTIME DATETIME,
                                FAUDITORID BIGINT DEFAULT 0 NOT NULL,
                                FAUDITDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_MERGE_IN')
CREATE TABLE T_FA_MERGE_IN (
                               FID BIGINT DEFAULT 0 NOT NULL,
                               FENTRYID BIGINT DEFAULT 0 NOT NULL,
                               FSEQ INT DEFAULT 0 NOT NULL,
                               FINDEPREUSEID BIGINT DEFAULT 0 NOT NULL,
                               FINREALCARDBAK BIGINT DEFAULT 0 NOT NULL,
                               FINREALCARDID BIGINT DEFAULT 0 NOT NULL,
                               FINREALUNITID BIGINT DEFAULT 0 NOT NULL,
                               FINREALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                               FINORIGINALVAL DECIMAL(19,6) DEFAULT 0 NOT NULL,
                               FINACCUMDEPRE DECIMAL(19,6) DEFAULT 0 NOT NULL,
                               FINDECVAL DECIMAL(19,6) DEFAULT 0 NOT NULL,
                               FINPRERESIDUALVAL DECIMAL(19,6) DEFAULT 0 NOT NULL,
                               FINDEPREDAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
                               FAFTERINFINID BIGINT DEFAULT 0 NOT NULL,
                               FBEFOREINFINID BIGINT DEFAULT 0 NOT NULL,
                               FINREALCARDMASTERID BIGINT DEFAULT 0 NOT NULL,
                               FINBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
                               FINFINCARDID BIGINT DEFAULT 0 NOT NULL,
                               FINCOMPFIELDSV NVARCHAR(200) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_MERGE_OUT')
CREATE TABLE T_FA_MERGE_OUT (
                                FDETAILID BIGINT DEFAULT 0 NOT NULL,
                                FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                FSEQ INT DEFAULT 0 NOT NULL,
                                FOUTDEPREUSEID BIGINT DEFAULT 0 NOT NULL,
                                FOUTREALCARDID BIGINT DEFAULT 0 NOT NULL,
                                FOUTREALUNITID BIGINT DEFAULT 0 NOT NULL,
                                FOUTREALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                FOUTORIGINALVAL DECIMAL(19,6) DEFAULT 0 NOT NULL,
                                FOUTACCUMDEPRE DECIMAL(19,6) DEFAULT 0 NOT NULL,
                                FOUTDECVAL DECIMAL(19,6) DEFAULT 0 NOT NULL,
                                FOUTPRERESIDUALVAL DECIMAL(19,6) DEFAULT 0 NOT NULL,
                                FOUTPREUSINGAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
                                FAFTEROUTFINID BIGINT DEFAULT 0 NOT NULL,
                                FBEFOREOUTFINID BIGINT DEFAULT 0 NOT NULL,
                                FOUTREALCARDMASTERID BIGINT DEFAULT 0 NOT NULL,
                                FOUTBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
                                FOUTFINCARDID BIGINT DEFAULT 0 NOT NULL,
                                FOUTCOMPFIELDSV NVARCHAR(200) DEFAULT ' ' NOT NULL
);

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