/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TPO_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_RULE_CONFIGS') 
 CREATE TABLE T_TPO_RULE_CONFIGS (
FID BIGINT DEFAULT 0 NOT NULL,
FBIZNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUBNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FISCHILD CHAR(1) DEFAULT ' ' NOT NULL,
FTAXTYPE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_RULE_CONFIGS_ENTRY') 
 CREATE TABLE T_TPO_RULE_CONFIGS_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUBNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRICE VARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZSUBNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATE CHAR(1) DEFAULT ' ' NOT NULL,
FWHERESTATE CHAR(1) DEFAULT ' ' NOT NULL,
FISAMOUNT CHAR(1) DEFAULT ' ' NOT NULL,
FORGSTATE CHAR(1) DEFAULT ' ' NOT NULL,
FDATASTATE CHAR(1) DEFAULT ' ' NOT NULL,
FYEARSTATE CHAR(1) DEFAULT ' ' NOT NULL,
FMONTHSTATE CHAR(1) DEFAULT ' ' NOT NULL
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TPO_RULE_CONFIGS_ENTRY' AND KSQL_COL_NAME ='FYEARSTATE') 
 ALTER TABLE T_TPO_RULE_CONFIGS_ENTRY ADD (FYEARSTATE CHAR(1) DEFAULT ' ' NOT NULL);
  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TPO_RULE_CONFIGS_ENTRY' AND KSQL_COL_NAME ='FMONTHSTATE') 
 ALTER TABLE T_TPO_RULE_CONFIGS_ENTRY ADD (FMONTHSTATE CHAR(1) DEFAULT ' ' NOT NULL);


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