/**Begin D:\PDM_UPGRADE\PDM1\FCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_BILLDIMBALANCE_IE') 
 CREATE TABLE T_FCS_BILLDIMBALANCE_IE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTBILLPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZDATEPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNTPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLOANSIGN NVARCHAR(10) DEFAULT ' ' NOT NULL,
FFILTER_TAG NCLOB,
FFILTER NVARCHAR(400) DEFAULT ' ' NOT NULL,
FFILTERSET NVARCHAR(400) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_BILLDIMBALANCE') 
 CREATE TABLE T_FCS_BILLDIMBALANCE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLSTATUS 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,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FBILLENTITY NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLBALENTITY NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLIDPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCURRENCYPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTARTDATEPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENDDATEPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMENPROPS NVARCHAR(400) DEFAULT ' ' NOT NULL,
FCREATEBALCYCLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLASTBALTIME DATETIME,
FBILLFILTER NVARCHAR(800) DEFAULT ' ' NOT NULL,
FBILLFILTER_TAG NCLOB
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_BILLDIMBALANCE_AE') 
 CREATE TABLE T_FCS_BILLDIMBALANCE_AE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTBILLPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZDATEPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNTPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLOANSIGN NVARCHAR(10) DEFAULT ' ' NOT NULL,
FFILTER_TAG NCLOB,
FFILTER NVARCHAR(400) DEFAULT ' ' NOT NULL,
FFILTERSET NVARCHAR(400) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_BILLDIMBALANCE_FE') 
 CREATE TABLE T_FCS_BILLDIMBALANCE_FE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTBILLPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZDATEPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNTPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFREEZETYPEPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTER_TAG NCLOB,
FFILTER NVARCHAR(400) DEFAULT ' ' NOT NULL,
FFILTERSET NVARCHAR(400) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_BILLDIMBALANCE_BE') 
 CREATE TABLE T_FCS_BILLDIMBALANCE_BE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBALSELPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBALPROP NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_BANKQUERYDETAIL' AND KSQL_COL_NAME IN ('FTYPE'))
 ALTER TABLE T_FCS_BANKQUERYDETAIL ADD (FTYPE NVARCHAR(30) DEFAULT '1' NOT NULL );

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


