
/**增加字段：业务凭证号**/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_AI_BIZVOUCHER ADD (FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_AI_BIZVOUCHER ADD (FSOURCETYPE VARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FVDESCRIPTION') 
 ALTER TABLE T_AI_BIZVOUCHER ADD (FVDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FGLBILLNO') 
 ALTER TABLE T_AI_BIZVOUCHER ADD (FGLBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FDEBITLOCAMOUNT') 
ALTER TABLE T_AI_BIZVOUCHER ADD (FDEBITLOCAMOUNT decimal(22,6) DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FCREDITLOCAMOUNT') 
ALTER TABLE T_AI_BIZVOUCHER ADD (FCREDITLOCAMOUNT decimal(22,6) DEFAULT 0 NOT NULL );

/** 主附表指定情况 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FMAINSTATUS') 
 ALTER TABLE T_AI_BIZVOUCHER ADD (FMAINSTATUS CHAR(10) DEFAULT '0' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHER' AND KSQL_COL_NAME ='FSUPPSTATUS') 
 ALTER TABLE T_AI_BIZVOUCHER ADD (FSUPPSTATUS CHAR(10) DEFAULT '0' NOT NULL );
	


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHERENTRY' AND KSQL_COL_NAME ='FEXPIREDATE') 
ALTER TABLE T_AI_BIZVOUCHERENTRY ADD (FEXPIREDATE datetime NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHERENTRY' AND KSQL_COL_NAME ='FBUSINESSNUM') 
ALTER TABLE T_AI_BIZVOUCHERENTRY ADD (FBUSINESSNUM VARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHERENTRY' AND KSQL_COL_NAME ='FSUPFAMOUNT') 
ALTER TABLE T_AI_BIZVOUCHERENTRY ADD (FSUPFAMOUNT decimal(19,6) DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BIZVOUCHERENTRY' AND KSQL_COL_NAME ='FSUPCFITEMID') 
ALTER TABLE T_AI_BIZVOUCHERENTRY ADD (FSUPCFITEMID BIGINT DEFAULT 0 NOT NULL );


/**增加字段：生成报告 **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BUILDREPORT' AND KSQL_COL_NAME ='FBIZVOUCHERNO') 
 ALTER TABLE T_AI_BUILDREPORT ADD (FBIZVOUCHERNO VARCHAR(80) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_BUILDREPORT' AND KSQL_COL_NAME ='FBUILDVOUCHERTYPE') 
 ALTER TABLE T_AI_BUILDREPORT ADD (FBUILDVOUCHERTYPE  CHAR(1) DEFAULT ' ' NOT NULL);










