/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_REGBASEBILL') 
 CREATE TABLE T_HDM_REGBASEBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FISEXISTSWORKFLOW CHAR(1) DEFAULT '0' NOT NULL,
FAUDITSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FISSUBMIT CHAR(1) DEFAULT '0' NOT NULL,
FREGSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FISDIRECTREGULAR CHAR(1) DEFAULT '0' NOT NULL,
FBEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FEFFECTDATE DATETIME,
FLABORRELTYPEID BIGINT DEFAULT 0 NOT NULL,
FBDEPENDENCYTYPEID BIGINT DEFAULT 0 NOT NULL,
FREGCATEGORYID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FPROBATIONUNIT VARCHAR(2) DEFAULT ' ' NOT NULL,
FREGCOMMENTID BIGINT DEFAULT 0 NOT NULL,
FREGBILLTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FENTRYDATE DATETIME,
FBPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FPOSTPONEDATE DATETIME,
FPROBATIONUNITEX VARCHAR(2) DEFAULT ' ' NOT NULL,
FWORKSUM NVARCHAR(512) DEFAULT ' ' NOT NULL,
FISMOBILE CHAR(1) DEFAULT '0' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FKEYEVENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPROBATION INT DEFAULT 0 NOT NULL,
FBADMINORGID BIGINT DEFAULT 0 NOT NULL,
FPROBATIONEX INT DEFAULT 0 NOT NULL,
FERMANFILEID BIGINT DEFAULT 0 NOT NULL,
FAFFRECORDID BIGINT DEFAULT 0 NOT NULL,
FAFFACTIONID BIGINT DEFAULT 0 NOT NULL,
FPREACTUALDATE DATETIME,
FPOSTYPEID BIGINT DEFAULT 0 NOT NULL,
FLABORRELSTATUSID BIGINT DEFAULT 0 NOT NULL,
FPOSSTATUSID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_REGBASEBILL_A') 
 CREATE TABLE T_HDM_REGBASEBILL_A (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS VARCHAR(2) DEFAULT 'A' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT '1' NOT NULL,
FBEMPGROUPID BIGINT DEFAULT 0 NOT NULL,
FBAFFILIATEADMINORGID BIGINT DEFAULT 0 NOT NULL,
FBHRBUID BIGINT DEFAULT 0 NOT NULL,
FBATCHID BIGINT DEFAULT 0 NOT NULL,
FBJOBID BIGINT DEFAULT 0 NOT NULL,
FBDEPENDENCYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_REGBASEBILL_L') 
 CREATE TABLE T_HDM_REGBASEBILL_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FKEYEVENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


 --- drop TABLE --------- 不允许删除表T_HDM_REGULARAPPLYBILL_L，请恢复pdm ------------------- 
 --- drop TABLE --------- 不允许删除表T_HDM_REGULARAPPLYBILL，请恢复pdm ------------------- 

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