-- 资产卡片财务分录
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_ASSET_FINENTRY')
CREATE TABLE T_FA_ASSET_FINENTRY (
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,
FFINACCOUNTDATE DATETIME,
FDEPREMETHODID BIGINT DEFAULT 0 NOT NULL,
FORIGINALVAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACCUMDEPRE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNETWORTH DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDECVAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRERESIDUALVAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPREUSINGAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEPREDAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FADDUPYEARDEPRE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL
);

EXEC p_DropIdx 'IDX_FA_CARREA_BILLNO', 'T_FA_CARD_REAL';

EXEC P_ALTERPK 'PK_T_FA_ASSET_FINENTRY', 'T_FA_ASSET_FINENTRY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ASSET_CARD_FIN_ENTRY_FID') CREATE INDEX IDX_ASSET_CARD_FIN_ENTRY_FID ON T_FA_ASSET_FINENTRY ( FID );