/**Begin D:\PDM_UPGRADE\PDM1\IFM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_DEDUCTION') 
 CREATE TABLE T_IFM_DEDUCTION (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FSCORGID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FDEDUCTIONTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISBACKFILL CHAR(1) DEFAULT '0' NOT NULL,
FRECEIVEACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FRECEIVECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FRECEIVEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FRECEIVECOMPANYID BIGINT DEFAULT 0 NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCENTERID BIGINT DEFAULT 0 NOT NULL,
FSOURCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FREALAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSOURCEBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FBIZSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_DEDUCTION_L') 
 CREATE TABLE T_IFM_DEDUCTION_L (
FPKID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_DEDUCTION_ENTRY') 
 CREATE TABLE T_IFM_DEDUCTION_ENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPAYCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FPAYACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FPAYCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPAYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTRANSFERCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPAYSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRETURNCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSOURCEENTRYID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_DEDUCTION_ENTRY_L') 
 CREATE TABLE T_IFM_DEDUCTION_ENTRY_L (
FPKID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTRANSFERCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);



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