/**Begin D:\PDM_UPGRADE\PDM1\FA_table.sql **/
-- 折旧用途添加税务折旧字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_DEPREUSE' AND KSQL_COL_NAME IN ('FTAXDEPRE'))
ALTER TABLE T_FA_DEPREUSE ADD (FTAXDEPRE CHAR (1) DEFAULT '0' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CARD_FIN' AND KSQL_COL_NAME IN ('FSOURCETYPE'))
ALTER TABLE T_FA_CARD_FIN ADD (FSOURCETYPE VARCHAR (10) DEFAULT 'ADD' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CARD_FIN' AND KSQL_COL_NAME IN ('FBIZSTATUS'))
ALTER TABLE T_FA_CARD_FIN ADD (FBIZSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_CARDSYNCENTRY')
CREATE TABLE T_FA_CARDSYNCENTRY
(
    FENTRYID      BIGINT       DEFAULT 0   NOT NULL,
    FID           BIGINT       DEFAULT 0   NOT NULL,
    FSEQ          INT          DEFAULT 0   NOT NULL,
    FFINCARDID    BIGINT       DEFAULT 0   NOT NULL,
    FDEPREUSEID   BIGINT       DEFAULT 0   NOT NULL,
    FSYNCSTATUS   CHAR(1)      DEFAULT 'A' NOT NULL,
    FORGID        BIGINT       DEFAULT 0   NOT NULL,
    FSYNCINFO     VARCHAR(255) DEFAULT ' ' NOT NULL,
    FSYNCINFO_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_BOOKSYNCTASK')
CREATE TABLE T_FA_BOOKSYNCTASK
(
    FID             BIGINT       DEFAULT 0   NOT NULL,
    FBATCHNO        VARCHAR(100) DEFAULT ' ' NOT NULL,
    FTASKNO         VARCHAR(100) DEFAULT ' ' NOT NULL,
    FCREATETIME     DATETIME,
    FCREATORID      BIGINT       DEFAULT 0   NOT NULL,
    FBEGINTIME      DATETIME,
    FENDTIME        DATETIME,
    FSTATUS         CHAR(1)      DEFAULT 'A' NOT NULL,
    FORGID          BIGINT       DEFAULT 0   NOT NULL,
    FDESTDEPREUSEID BIGINT       DEFAULT 0   NOT NULL,
    FPERIODID       BIGINT       DEFAULT 0   NOT NULL,
    FSYNCTYPE       CHAR(1)      DEFAULT ' ' NOT NULL,
    FERRORMSG       VARCHAR(255) DEFAULT ' ' NOT NULL,
    FERRORMSG_TAG   NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_BOOKSYNCTASKENTRY')
CREATE TABLE T_FA_BOOKSYNCTASKENTRY
(
    FENTRYID       BIGINT       DEFAULT 0   NOT NULL,
    FID            BIGINT       DEFAULT 0   NOT NULL,
    FSEQ           INT          DEFAULT 0   NOT NULL,
    FENTITYTYPE    VARCHAR(100) DEFAULT ' ' NOT NULL,
    FBEGINTIME     DATETIME,
    FENDTIME       DATETIME,
    FSTATUS        CHAR(1)      DEFAULT 'A' NOT NULL,
    FBATCHCNT      INT          DEFAULT 0   NOT NULL,
    FBATCHSYNCCNT  INT          DEFAULT 0   NOT NULL,
    FINSTNODE      VARCHAR(255) DEFAULT ' ' NOT NULL,
    FBATCHCARD     VARCHAR(255) DEFAULT ' ' NOT NULL,
    FBATCHCARD_TAG NCLOB,
    FERRORMSG      VARCHAR(255) DEFAULT ' ' NOT NULL,
    FERRORMSG_TAG  NCLOB
);

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