/**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_CLAIMBILL') 
 CREATE TABLE T_CAS_CLAIMBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) 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,
FCENTERORG BIGINT DEFAULT 0 NOT NULL,
FCLAIMNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTRADEDETAILNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTRADENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FRECPAYTYPE BIGINT DEFAULT 0 NOT NULL,
FPAYMENTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRECPAYER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FHANDLESTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCLAIMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTRADETIME DATETIME,
FDATASOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBANKID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTBANKID BIGINT DEFAULT 0 NOT NULL,
FOPPUNIT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPPBANKNUMBER NVARCHAR(200) DEFAULT ' ' NOT NULL,
FOPPBANK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSOURCETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSOURCEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREJECTREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTRADEID NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMBILL_L') 
 CREATE TABLE T_CAS_CLAIMBILL_L (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMDETAILENTRY') 
 CREATE TABLE T_CAS_CLAIMDETAILENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FRECEIVABLEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDISCOUNTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FFEE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FFUNDFLOWITEMID BIGINT DEFAULT 0 NOT NULL,
FSALEMAN BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FITEMNAMEID BIGINT DEFAULT 0 NOT NULL,
FCOREBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOREBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOREBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMNOTICEBILL') 
 CREATE TABLE T_CAS_CLAIMNOTICEBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTRADEDETAILNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FACCOUNTBANKID BIGINT DEFAULT 0 NOT NULL,
FBANKID BIGINT DEFAULT 0 NOT NULL,
FTRADETIME DATETIME,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FREAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FOPPUNIT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPPBANKNUMBER NVARCHAR(200) DEFAULT ' ' NOT NULL,
FOPPBANK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTRADENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDATASOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCLAIMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCLAIMSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FUNCLAIMAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FRECPAYTYPE BIGINT DEFAULT 0 NOT NULL,
FPAYMENTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FRECPAYER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFEE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FCREATETIME DATETIME,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSOURCEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCLAIMUSERS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FJOINCLAIM NVARCHAR(255) DEFAULT ' ' NOT NULL,
FJOINUNIT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FJOINRULE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FBANKCHECKFLAG NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCLAIMME CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMNOTICEBILL_E') 
 CREATE TABLE T_CAS_CLAIMNOTICEBILL_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCLAIMBILL NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCLAIMPERSONID BIGINT DEFAULT 0 NOT NULL,
FSETTLEORGID BIGINT DEFAULT 0 NOT NULL,
FCOREBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOREBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCOREBILLENTRYSEQ INT DEFAULT 0 NOT NULL,
FITEMNAMEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FRECEIVABLEAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDISCOUNTAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FEFEE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FACTAMT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FFUNDFLOWITEMID BIGINT DEFAULT 0 NOT NULL,
FSALEMAN BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHANDLESTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMNOTICEBILL_L') 
 CREATE TABLE T_CAS_CLAIMNOTICEBILL_L (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_CLAIMTYPE_E') 
 CREATE TABLE T_CAS_CLAIMTYPE_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCLAIMTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FCLAIMTYPEID NVARCHAR(80) DEFAULT ' ' NOT NULL
);



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