
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PROCHANGES')
 CREATE TABLE T_FMM_PROCHANGES
(
	  FID               BIGINT         DEFAULT 0   NOT NULL,                 
	  FBILLNO           NVARCHAR(30)   DEFAULT ' ' NOT NULL, 	   
	  FBILLSTATUS       NVARCHAR(1)    DEFAULT ' ' NOT NULL, 
	  FCREATORID        BIGINT         DEFAULT 0   NOT NULL,        
	  FMODIFIERID       BIGINT         DEFAULT 0   NOT NULL,  	     
	  FAUDITORID        BIGINT         DEFAULT 0   NOT NULL,           
	  FCREATETIME       DATETIME ,                  	       
	  FMODIFYTIME       DATETIME ,                  	      
	  FAUDITDATE        DATETIME ,                   	       
	  FPRONUMBERID      BIGINT         DEFAULT 0   NOT NULL,         
	  FAPPLICANTID      BIGINT         DEFAULT 0   NOT NULL,        
	  FORGID            BIGINT         DEFAULT 0   NOT NULL,       	      
	  FRATIFIERID       BIGINT         DEFAULT 0   NOT NULL,       	   
	  APPLICATIONDATE   DATETIME ,                  	    
	  FAPPROVEDDATE     DATETIME ,                  	    
	  FPROPLANTYPEID    BIGINT         DEFAULT 0   NOT NULL,       
	  FREMARKS          NVARCHAR(255)  DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PC_CHANGEDETAIL')
CREATE TABLE T_FMM_PC_CHANGEDETAIL
(
	  FID               BIGINT          DEFAULT 0    NOT NULL,               
	  FENTRYID          BIGINT          DEFAULT 0    NOT NULL,            
	  FSEQ              INT             DEFAULT 0    NOT NULL,            	       
	  FTASKNUMBER       NVARCHAR(50)    DEFAULT ' '  NOT NULL, 
	  FTASKNAME         NVARCHAR(50)    DEFAULT ' '  NOT NULL, 	    
	  FSCHEDULETYPE     NVARCHAR(5)     DEFAULT ' '  NOT NULL, 	
	  FPLANINGAREAID    BIGINT          DEFAULT 0    NOT NULL,        
	  FPLANINGTIME      DECIMAL(23,2)   DEFAULT 0    NOT NULL, 	
	  FTIMEUNITID       BIGINT          DEFAULT 0    NOT NULL,          
	  FSTARTTIME        DATETIME ,                  	   
	  FFINNISHTIME      DATETIME ,                  	      
	  FCHANGESTYPE      NVARCHAR(5)     DEFAULT ' '  NOT NULL, 	
	  FCHANGESOURCE     NVARCHAR(50)    DEFAULT ' '  NOT NULL, 
	  FCHANGEREASON     NVARCHAR(50)    DEFAULT ' '  NOT NULL, 	
	  FREMARKS          NVARCHAR(255)   DEFAULT ' '  NOT NULL, 	 
	  FTASKID           BIGINT          DEFAULT 0    NOT NULL,              
	  FMODIFIERFIELD    BIGINT          DEFAULT 0    NOT NULL,        
	  FMODIFYDATEFIELD  DATETIME
);
