IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_WBS') 
CREATE TABLE T_PMTS_WBS
(
  FID BIGINT DEFAULT 0 NOT NULL,        
  FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL, 
  FSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL, 	
  FCREATORID BIGINT DEFAULT 0 NOT NULL,   	
  FMODIFIERID BIGINT DEFAULT 0 NOT NULL,  
  FENABLE NVARCHAR(1) DEFAULT ' ' NOT NULL,
  FCREATETIME DATETIME ,            
  FMODIFYTIME DATETIME ,                  
  FMASTERID BIGINT DEFAULT 0 NOT NULL,    
  FLONGNUMBER NVARCHAR(500) DEFAULT ' ' NOT NULL, 
  FLEVEL INT DEFAULT 0 NOT NULL,        
  FISLEAF CHAR(1) DEFAULT '0' NOT NULL,   
  FPARENTID BIGINT DEFAULT 0 NOT NULL,    
  FCREATEORGID BIGINT DEFAULT 0 NOT NULL, 	
  FORGID BIGINT DEFAULT 0 NOT NULL,       
  FCTRLSTRATEGY NVARCHAR(5) DEFAULT ' ' NOT NULL, 
  FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL, 	
  FBITINDEX INT DEFAULT 0 NOT NULL,       
  FSOURCEBITINDEX INT DEFAULT 0 NOT NULL, 
  FPROJECTID BIGINT DEFAULT 0 NOT NULL,   
  FWBSTYPE BIGINT DEFAULT 0 NOT NULL,    
  FPROJECTSTAGEID BIGINT DEFAULT 0 NOT NULL, 
  FESTIMATEDSTARTDATE DATETIME ,       
  FESTIMATEDENDDATE DATETIME ,            
  FESTIMATEDDAYS INT DEFAULT 0 NOT NULL,  
  FPLANSTARTDATE DATETIME ,               
  FPLANENDDATE DATETIME ,                
  FPLANDAYS INT DEFAULT 0 NOT NULL,    
  FACTUALSTARTDATE DATETIME ,            
  FACTUALENDDATE DATETIME ,         
  FACTUALDAYS INT DEFAULT 0 NOT NULL,     
  FRESPONSORGID BIGINT DEFAULT 0 NOT NULL, 
  FRESPONSPERSONID BIGINT DEFAULT 0 NOT NULL, 
  FBAC DECIMAL(23,10) DEFAULT 0 NOT NULL, 
  FPV DECIMAL(23,10) DEFAULT 0 NOT NULL, 
  FAC DECIMAL(23,10) DEFAULT 0 NOT NULL,  
  FWBSDESCRIPTIONS NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FAUDITORID BIGINT DEFAULT 0 NOT NULL,  
  FAUDITDATE DATETIME ,                   	
  FCHECKPURCHASE CHAR(1) DEFAULT '0' NOT NULL, 
  FCHECKOUTSOURCE CHAR(1) DEFAULT '0' NOT NULL, 
  FCHECKPRODUCT CHAR(1) DEFAULT '0' NOT NULL, 
  FCHECKREGISTER CHAR(1) DEFAULT '0' NOT NULL, 
  FBUSINESSSTATE NVARCHAR(5) DEFAULT ' ' NOT NULL,
  FTIMEUNIT NVARCHAR(5) DEFAULT ' ' NOT NULL, 
  FCOSTOBJ CHAR(1) DEFAULT '0' NOT NULL,  
  FACCOUNTINGORGID BIGINT DEFAULT 0 NOT NULL, 
  FPURCHASEORGID BIGINT DEFAULT 0 NOT NULL, 
  FSALEORGID BIGINT DEFAULT 0 NOT NULL,   	
  FPRODUCTORGID BIGINT DEFAULT 0 NOT NULL,
  FQUALITYORGID BIGINT DEFAULT 0 NOT NULL, 	
  FCAPITALORGID BIGINT DEFAULT 0 NOT NULL, 	
  FASSETSORGID BIGINT DEFAULT 0 NOT NULL, 	
  FHRORGID BIGINT DEFAULT 0 NOT NULL,     	
  FSHAREORGID BIGINT DEFAULT 0 NOT NULL,  
  FTAXORGID BIGINT DEFAULT 0 NOT NULL    	
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_WBS_L') 
CREATE TABLE T_PMTS_WBS_L
(
  FPKID NVARCHAR(255) DEFAULT ' ' NOT NULL,          
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FLOCALEID NVARCHAR(255) DEFAULT ' ' NOT NULL,       
  FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FFULLNAME NVARCHAR(500) DEFAULT ' ' NOT NULL 	
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_ORGPROSENTRY') 
CREATE TABLE T_PMTS_ORGPROSENTRY
(
  FID BIGINT DEFAULT 0 NOT NULL,         
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     
  FSEQ INT DEFAULT 0 NOT NULL,          
  FJOBNUMBERID BIGINT DEFAULT 0 NOT NULL 
);





