/**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_ENDPARTEVENT') 
 CREATE TABLE T_HDM_ENDPARTEVENT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSOURCEAPP VARCHAR(100) DEFAULT ' ' NOT NULL,
FSOURCEENTITY VARCHAR(100) DEFAULT '1' NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLENTRY BIGINT DEFAULT 0 NOT NULL,
FEVENTCLS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT '0' NOT NULL,
FSTRATEGYID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTBILLEVENT') 
 CREATE TABLE T_HDM_PARTBILLEVENT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSOURCEAPP VARCHAR(100) DEFAULT ' ' NOT NULL,
FSOURCEENTITY VARCHAR(100) DEFAULT '1' NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLENTRY BIGINT DEFAULT 0 NOT NULL,
FEVENTCLS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT '0' NOT NULL,
FSTRATEGYID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEAPPLYBILL') 
 CREATE TABLE T_HDM_PARTTIMEAPPLYBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(2) DEFAULT '  ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FISMULTIENTRY CHAR(1) DEFAULT ' ' NOT NULL,
FISEXISTSWORKFLOW CHAR(1) DEFAULT ' ' NOT NULL,
FISEXCEPTION CHAR(1) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(2) DEFAULT '  ' NOT NULL,
FACMPEMPID BIGINT DEFAULT 0 NOT NULL,
FADEPEMPID BIGINT DEFAULT 0 NOT NULL,
FBJOBID BIGINT DEFAULT 0 NOT NULL,
FBJOBSCMID BIGINT DEFAULT 0 NOT NULL,
FBLABORRELTYPEID BIGINT DEFAULT 0 NOT NULL,
FBLABORRELSTATUSID BIGINT DEFAULT 0 NOT NULL,
FACOMPANYID BIGINT DEFAULT 0 NOT NULL,
FAADMINORGID BIGINT DEFAULT 0 NOT NULL,
FAPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FACITYID BIGINT DEFAULT 0 NOT NULL,
FEFFECTDATE DATETIME,
FPARTTIMESTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYHRBUID BIGINT DEFAULT 0 NOT NULL,
FCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FJOBID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYAFTADMINORGID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYCMPEMPID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYDEPEMPID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYEMPGROUPID BIGINT DEFAULT 0 NOT NULL,
FPRIMARYCITYID BIGINT DEFAULT 0 NOT NULL,
FPARTTIMEREASONID BIGINT DEFAULT 0 NOT NULL,
FHRBUID BIGINT DEFAULT 0 NOT NULL,
FEMPGROUPID BIGINT DEFAULT 0 NOT NULL,
FAFFILIATEADMINORGID BIGINT DEFAULT 0 NOT NULL,
FERMANFILEID BIGINT DEFAULT 0 NOT NULL,
FERMANFILEVID BIGINT DEFAULT 0 NOT NULL,
FDEPENDENCYID BIGINT DEFAULT 0 NOT NULL,
FDEPENDENCYTYPEID BIGINT DEFAULT 0 NOT NULL,
FFILLINERID BIGINT DEFAULT 0 NOT NULL,
FFILLINDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEAPPLYBILL_A') 
 CREATE TABLE T_HDM_PARTTIMEAPPLYBILL_A (
FID BIGINT DEFAULT 0 NOT NULL,
FISSUBMIT CHAR(1) DEFAULT '0' NOT NULL,
FEVENTEFFECTDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEENDBILL') 
 CREATE TABLE T_HDM_PARTTIMEENDBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(2) DEFAULT '  ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FISMULTIENTRY CHAR(1) DEFAULT ' ' NOT NULL,
FISEXISTSWORKFLOW CHAR(1) DEFAULT ' ' NOT NULL,
FISEXCEPTION CHAR(1) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(2) DEFAULT '  ' NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FBEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FBDEPEMPID BIGINT DEFAULT 0 NOT NULL,
FBADMINORGID BIGINT DEFAULT 0 NOT NULL,
FBPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FEFFECTDATE DATETIME,
FENDDATE DATETIME,
FLASTWORKDATE DATETIME,
FPARTENDSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FISSUBMIT CHAR(1) DEFAULT '0' NOT NULL,
FEVENTEFFECTDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEKEYINFO') 
 CREATE TABLE T_HDM_PARTTIMEKEYINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FOCCURDATE DATETIME,
FDEPEMPID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEREASON') 
 CREATE TABLE T_HDM_PARTTIMEREASON (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEREASON_L') 
 CREATE TABLE T_HDM_PARTTIMEREASON_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEWORKROLE') 
 CREATE TABLE T_HDM_PARTTIMEWORKROLE (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FWORKROLE BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FISCONPOS CHAR(1) DEFAULT '0' NOT NULL
);


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