/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\CAS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_CAS_AGENTPAYBILL' AND KSQL_COL_NAME IN ('FACCOUNTCASHID')) 
 ALTER TABLE T_CAS_AGENTPAYBILL ADD (FACCOUNTCASHID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_EXCHANGEBILL') 
 CREATE TABLE T_CAS_EXCHANGEBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBIZDATE DATETIME,
FBILLSTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FBIZTYPE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(50),
FBUYINGCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FBUYINGACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FBUYAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBUYINGEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FBUYINGLOCALAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FEXCHANGEGAINANDLOSS DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSELLINGCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FSELLINGACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FSELLAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSELLINGEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FSELLINGLOCALAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCOMMISSIONCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPAYCOMMISSIONACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FCOMMISSIONAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCOMMISSIONEXCHANGERATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCOMMISSIONLOCALAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FISVOUCHER CHAR(1) DEFAULT ' ' NOT NULL,
FISARCHIVE CHAR(1) DEFAULT ' ' NOT NULL
);



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