/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\IFM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTAPPLY') 
 CREATE TABLE T_IFM_INNERACCTAPPLY (
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,
FORGID BIGINT DEFAULT 0 NOT NULL,
FAPPLYCOMPID BIGINT DEFAULT 0 NOT NULL,
FOPENCOMPID BIGINT DEFAULT 0 NOT NULL,
FFINORGID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYDLFTID BIGINT DEFAULT 0 NOT NULL,
FACCTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCTPROP NVARCHAR(30) DEFAULT ' ' NOT NULL,
FREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPENDATE DATETIME,
FEASYCODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMGRSTRATGID BIGINT DEFAULT 0 NOT NULL,
FACCTUSAGEID BIGINT DEFAULT 0 NOT NULL,
FCENTERACCTDLFTID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYMGRFEEID BIGINT DEFAULT 0 NOT NULL,
FMGRFEE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCT_LK') 
 CREATE TABLE T_IFM_INNERACCT_LK (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSTABLEID BIGINT DEFAULT 0 NOT NULL,
FSBILLID BIGINT DEFAULT 0 NOT NULL,
FSID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCT_WB') 
 CREATE TABLE T_IFM_INNERACCT_WB (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRULEVERID BIGINT DEFAULT 0 NOT NULL,
FRULEITEMID BIGINT DEFAULT 0 NOT NULL,
FOPERATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTABLEID BIGINT DEFAULT 0 NOT NULL,
FSID BIGINT DEFAULT 0 NOT NULL,
FSBILLID BIGINT DEFAULT 0 NOT NULL,
FWRITEVALUE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTAPPLY_L') 
 CREATE TABLE T_IFM_INNERACCTAPPLY_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTEXC') 
 CREATE TABLE T_IFM_INNERACCTEXC (
FDATAID BIGINT DEFAULT 0 NOT NULL,
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCT_TC') 
 CREATE TABLE T_IFM_INNERACCT_TC (
FID BIGINT DEFAULT 0 NOT NULL,
FTBILLID BIGINT DEFAULT 0 NOT NULL,
FTTABLEID BIGINT DEFAULT 0 NOT NULL,
FTID BIGINT DEFAULT 0 NOT NULL,
FSBILLID BIGINT DEFAULT 0 NOT NULL,
FSTABLEID BIGINT DEFAULT 0 NOT NULL,
FSID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTAPPLY_LK') 
 CREATE TABLE T_IFM_INNERACCTAPPLY_LK (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSTABLEID BIGINT DEFAULT 0 NOT NULL,
FSBILLID BIGINT DEFAULT 0 NOT NULL,
FSID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTAPPLY_TC') 
 CREATE TABLE T_IFM_INNERACCTAPPLY_TC (
FID BIGINT DEFAULT 0 NOT NULL,
FTBILLID BIGINT DEFAULT 0 NOT NULL,
FTTABLEID BIGINT DEFAULT 0 NOT NULL,
FTID BIGINT DEFAULT 0 NOT NULL,
FSBILLID BIGINT DEFAULT 0 NOT NULL,
FSTABLEID BIGINT DEFAULT 0 NOT NULL,
FSID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTAPPLY_WB') 
 CREATE TABLE T_IFM_INNERACCTAPPLY_WB (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRULEVERID BIGINT DEFAULT 0 NOT NULL,
FRULEITEMID BIGINT DEFAULT 0 NOT NULL,
FOPERATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTABLEID BIGINT DEFAULT 0 NOT NULL,
FSID BIGINT DEFAULT 0 NOT NULL,
FSBILLID BIGINT DEFAULT 0 NOT NULL,
FWRITEVALUE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTUSEREG') 
 CREATE TABLE T_IFM_INNERACCTUSEREG (
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FDATAID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISASSIGN CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCTAPPLY_CR') 
 CREATE TABLE T_IFM_INNERACCTAPPLY_CR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCT_CR') 
 CREATE TABLE T_IFM_INNERACCT_CR (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IFM_INNERACCT') 
 CREATE TABLE T_IFM_INNERACCT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FAPPLYCOMPID BIGINT DEFAULT 0 NOT NULL,
FOPENCOMPID BIGINT DEFAULT 0 NOT NULL,
FFINORGID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYDFLTID BIGINT DEFAULT 0 NOT NULL,
FACCTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCTPROP NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCTUSEAGEID BIGINT DEFAULT 0 NOT NULL,
FEASYCODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCTSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMGRSTRATGID BIGINT DEFAULT 0 NOT NULL,
FCENTERACCTDLFTID BIGINT DEFAULT 0 NOT NULL,
FMGRFEE DECIMAL(23,10) DEFAULT 0.0000000000 NOT NULL,
FCURRENCYMGRFEE BIGINT DEFAULT 0 NOT NULL,
FBEIINTERF CHAR(1) DEFAULT '0' NOT NULL,
FBEIFUNC NVARCHAR(80) DEFAULT ' ' NOT NULL,
FONLINEBANK CHAR(1) DEFAULT '0' NOT NULL,
FONLINEBANKFUNC NVARCHAR(80) DEFAULT ' ' NOT NULL,
FOPENDATE DATETIME
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\IFM_table.sql **/
