/**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_RECWARNSET') 
 CREATE TABLE T_CAS_RECWARNSET (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDAY INT DEFAULT 0 NOT NULL,
FPAYER CHAR(1) DEFAULT ' ' NOT NULL,
FPAYNUM CHAR(1) DEFAULT ' ' NOT NULL,
FRECNUM CHAR(1) DEFAULT ' ' NOT NULL,
FRECAMOUNT CHAR(1) DEFAULT ' ' NOT NULL,
FBIZDATE CHAR(1) DEFAULT ' ' NOT NULL,
FTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL
);


 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL', 'FISCOMMITBE', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL', 'FISBITBACK', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL', 'FISVOUCHER', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL', 'FISARCHIVE', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL_E', 'FISSINGLECA', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL_E', 'FISPERSONPAY', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL_E', 'FISDIFFCUR', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL_C', 'FISCROSSPAY', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL_E', 'FISAGENCYPERSONPAY', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL_E', 'FISSINGLECA', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL_E', 'FISPERSONPAY', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL_E', 'FISENCRYPTION', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL_E', 'FISDIFFCUR', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILL_E', 'FISCROSSPAY', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILLENTRY', 'FISSUCCESS', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILLENTRY', 'FISREPAID', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_AGENTPAYBILLENTRY', 'FISREFUND', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FISSINGLE', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FISCOMMITBE', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FISVOUCHER', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FISREFUND', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

 EXEC p_AlterColumn 'T_CAS_PAYMENTBILL', 'FISARCHIVE', 'CHAR(1)', 'NOT NULL', '0001', '''0''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECWARNENTRY') 
 CREATE TABLE T_CAS_RECWARNENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECWARNRESULT') 
 CREATE TABLE T_CAS_RECWARNRESULT (
FID BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ',
FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CAS_RECWARNRESULTENTRY') 
 CREATE TABLE T_CAS_RECWARNRESULTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZDATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYER NVARCHAR(200) DEFAULT ' ' NOT NULL,
FPAYERNUM NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCURRENCY BIGINT DEFAULT 0 NOT NULL,
FRECAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME NVARCHAR(30) DEFAULT ' ' NOT NULL,
FHASSAVE CHAR(1) DEFAULT ' ' NOT NULL
);



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