/**Begin D:\PDM_UPGRADE\PDM1\HOM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HOM_ONBRDBILL_B' AND KSQL_COL_NAME IN ('FPRBATCHBILLID')) 
 ALTER TABLE T_HOM_ONBRDBILL_B ADD (FPRBATCHBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HOM_ONBRDBILL_B' AND KSQL_COL_NAME IN ('FPRBILLID')) 
 ALTER TABLE T_HOM_ONBRDBILL_B ADD (FPRBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HOM_PREBATCHONBRDBILL_L') 
 CREATE TABLE T_HOM_PREBATCHONBRDBILL_L (
FPKID VARCHAR(36) 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_HOM_PREBATCHONBRDBILL') 
 CREATE TABLE T_HOM_PREBATCHONBRDBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FISEXISTSWORKFLOW CHAR(1) DEFAULT '0' NOT NULL,
FAUDITSTATUS VARCHAR(50) DEFAULT '0' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FISSUBMIT CHAR(1) DEFAULT '0' NOT NULL,
FAFFILIATIONORGID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HOM_PREONBRDBILL') 
 CREATE TABLE T_HOM_PREONBRDBILL (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAADMINORGID BIGINT DEFAULT 0 NOT NULL,
FEMPLOYEENO VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FACOMPANYID BIGINT DEFAULT 0 NOT NULL,
FBASELOCATIONID BIGINT DEFAULT 0 NOT NULL,
FAPOSITION BIGINT DEFAULT 0 NOT NULL,
FSTDPOSITION BIGINT DEFAULT 0 NOT NULL,
FAJOBID BIGINT DEFAULT 0 NOT NULL,
FJOBGRADESCMID BIGINT DEFAULT 0 NOT NULL,
FJOBGRADEID BIGINT DEFAULT 0 NOT NULL,
FJOBLEVELSCMID BIGINT DEFAULT 0 NOT NULL,
FONBRDTYPEID BIGINT DEFAULT 0 NOT NULL,
FPLABORRELTYPEID BIGINT DEFAULT 0 NOT NULL,
FPLABORRELSTATUSID BIGINT DEFAULT 0 NOT NULL,
FPPOSSTATUSID BIGINT DEFAULT 0 NOT NULL,
FDEPENDENCYID BIGINT DEFAULT 0 NOT NULL,
FDEPENDENCYTYPEID BIGINT DEFAULT 0 NOT NULL,
FEMPGROUPID BIGINT DEFAULT 0 NOT NULL,
FVALIDUNTIL DATETIME,
FPROBATIONTIME INT DEFAULT 0 NOT NULL,
FOFFERNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FONBRDID BIGINT DEFAULT 0 NOT NULL,
FPPOSTYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HOM_PREONBRDBILL_A') 
 CREATE TABLE T_HOM_PREONBRDBILL_A (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FCERTIFICATETYPEID BIGINT DEFAULT 0 NOT NULL,
FCERTIFICATENUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FGENDERID BIGINT DEFAULT 0 NOT NULL,
FPHONE VARCHAR(50) DEFAULT ' ' NOT NULL,
FPEREMAIL VARCHAR(70) DEFAULT ' ' NOT NULL,
FENTERPRISEID BIGINT DEFAULT 0 NOT NULL,
FMANAGEMENTSCOPEID BIGINT DEFAULT 0 NOT NULL,
FWORKCALENDARID BIGINT DEFAULT 0 NOT NULL,
FPAFFACTIONID BIGINT DEFAULT 0 NOT NULL,
FONBRDTCITYID BIGINT DEFAULT 0 NOT NULL,
FEFFECTDATE DATETIME,
FHANDLERID BIGINT DEFAULT 0 NOT NULL,
FTRANSDATE DATETIME,
FRECRUITTYPEID BIGINT DEFAULT 0 NOT NULL,
FRECRUITSOURCEID BIGINT DEFAULT 0 NOT NULL,
FRESUMENO VARCHAR(50) DEFAULT ' ' NOT NULL,
FTEACHERID BIGINT DEFAULT 0 NOT NULL,
FNATIONALITYID BIGINT DEFAULT 0 NOT NULL,
FCONTRACTLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FAPOSITIONTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FISPROBATION CHAR(1) DEFAULT '0' NOT NULL
);


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



/**End D:\PDM_UPGRADE\PDM1\HOM_table.sql **/
