/**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_ACCTMAPTABLEENTRY') 
 CREATE TABLE T_AI_ACCTMAPTABLEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FENTRYACCTTABLE BIGINT DEFAULT 0 NOT NULL,
FFIELDKEY VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AI_ACCTMAPTYPE_ACCTTAB') 
 CREATE TABLE T_AI_ACCTMAPTYPE_ACCTTAB (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AI_ACCOUNTMAPENTRY' AND KSQL_COL_NAME ='FROWINDEX') 
 ALTER TABLE T_AI_ACCOUNTMAPENTRY ADD (FROWINDEX INT DEFAULT 0 NOT NULL );

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