/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_ASSETINFOADDENTRY') 
 CREATE TABLE T_FA_ASSETINFOADDENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBDPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTARGET NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORIGINALVAL DECIMAL(19,4) DEFAULT 0 NOT NULL,
FASSETCAT BIGINT DEFAULT 0 NOT NULL,
FASSETNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FASSETQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMODEL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTOREPLACEID BIGINT DEFAULT 0 NOT NULL,
FUSEDEPARTMENTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_ASSETINFOCHANGEENTRY') 
 CREATE TABLE T_FA_ASSETINFOCHANGEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBDPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTARGET NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREALCARDID BIGINT DEFAULT 0 NOT NULL,
FORIGINALVALCHANGE DECIMAL(19,4) DEFAULT 0 NOT NULL,
FREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBIZDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ENGINEERINGBILL' AND KSQL_COL_NAME ='FBUSINESSTYPE') 
 ALTER TABLE T_FA_ENGINEERINGBILL ADD (FBUSINESSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ENGINEERINGBILL' AND KSQL_COL_NAME ='FCURRENCYFIELDID') 
 ALTER TABLE T_FA_ENGINEERINGBILL ADD (FCURRENCYFIELDID BIGINT DEFAULT 0 NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_table.sql **/
