/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_CUSTOMERTAX') 
 CREATE TABLE T_BD_CUSTOMERTAX (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTAXCERTIFICATE BIGINT DEFAULT 0 NOT NULL,
FEFFECTIVEDATE DATETIME,
FEXPIRYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_SUPPLIERTAX') 
 CREATE TABLE T_BD_SUPPLIERTAX (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTAXCERTIFICATE BIGINT DEFAULT 0 NOT NULL,
FEFFECTIVEDATE DATETIME,
FEXPIRYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FTAXREGISTPLACE') 
 ALTER TABLE T_BD_CUSTOMER ADD (FTAXREGISTPLACE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FTAXNO') 
 ALTER TABLE T_BD_CUSTOMER ADD (FTAXNO NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FTAXREGISTPLACE') 
 ALTER TABLE T_BD_SUPPLIER ADD (FTAXREGISTPLACE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FTAXNO') 
 ALTER TABLE T_BD_SUPPLIER ADD (FTAXNO NVARCHAR(60) DEFAULT ' ' NOT NULL );

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