/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\GL_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AI_MIDLEBIZVOUCHER') 
 CREATE TABLE T_AI_MIDLEBIZVOUCHER (
FID BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FVOUCHERID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE NVARCHAR(36) DEFAULT ' ' NOT NULL,
FVCHTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBOOKTYPEID BIGINT DEFAULT 0 NOT NULL,
FPERIODID BIGINT DEFAULT 0 NOT NULL,
FREOPER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZVOUCHERID BIGINT DEFAULT 0 NOT NULL
);

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

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