/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_INVOICECFG') 
 CREATE TABLE T_AR_INVOICECFG (
FID BIGINT DEFAULT 0 NOT NULL,
FLOGINADDR NVARCHAR(100) DEFAULT ' ' NOT NULL,
FLOGINNAME NVARCHAR(30) DEFAULT ' ' NOT NULL,
FAPPID BIGINT DEFAULT 0 NOT NULL,
FMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMESSAGE_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_INVOICECFGENTRY') 
 CREATE TABLE T_AR_INVOICECFGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCONFIGID BIGINT DEFAULT 0 NOT NULL,
FREVENUENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_AR_INVOICE_E' AND KSQL_COL_NAME ='FBILLSRCTYPE') 
 ALTER TABLE T_AR_INVOICE_E ADD (FBILLSRCTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );

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