/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_AUTOMATCHRESULT') 
 CREATE TABLE T_CAS_AUTOMATCHRESULT (
FID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FENABLE INT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FMATCHSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FSMARTMATCH BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_AUTOMATCHRESULT_E') 
 CREATE TABLE T_CAS_AUTOMATCHRESULT_E (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FRECORD VARCHAR(30) DEFAULT ' ' NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FBANKACCT BIGINT DEFAULT 0 NOT NULL,
FACCTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACCT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FNUM NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRECTYPE BIGINT DEFAULT 0 NOT NULL,
FSETTLESTYLE BIGINT DEFAULT 0 NOT NULL,
FSETTLENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_SMARTMATCH') 
 CREATE TABLE T_CAS_SMARTMATCH (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCREATEORG BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FENABLE INT DEFAULT 0 NOT NULL,
FUSEORG BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY INT DEFAULT 0 NOT NULL,
FBIZTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FAUTOREC CHAR(1) DEFAULT '0' NOT NULL,
FAUTOPAY CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_SMARTMATCH_E') 
 CREATE TABLE T_CAS_SMARTMATCH_E (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FRULESNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FMATCHPLAN NVARCHAR(1024) DEFAULT ' ' NOT NULL,
FMATCHPLAN_REAL NCLOB,
FMATCHPLAN_REAL_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_AUTOMATCHRESULT_L') 
 CREATE TABLE T_CAS_AUTOMATCHRESULT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_SMARTMATCH_L') 
 CREATE TABLE T_CAS_SMARTMATCH_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);

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