/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HPDI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SALARYVBILLDETAIL') 
 CREATE TABLE T_HPDI_SALARYVBILLDETAIL (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFIELDNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FFIELDVALUE VARCHAR(255) DEFAULT ' ' NOT NULL,
FGROUPINDEX INT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SALARYVERBILL') 
 CREATE TABLE T_HPDI_SALARYVERBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FISEXISTSWORKFLOW CHAR(1) DEFAULT '0' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FORGTEAMID BIGINT DEFAULT 0 NOT NULL,
FPERSONNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FEMPNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FACTIONID BIGINT DEFAULT 0 NOT NULL,
FFLOWTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FDUTYWORKROLEID BIGINT DEFAULT 0 NOT NULL,
FORGMSGRECVCENTERID BIGINT DEFAULT 0 NOT NULL,
FTASKRULEID BIGINT DEFAULT 0 NOT NULL,
FTASKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPERSONVID BIGINT DEFAULT 0 NOT NULL,
FEMPLOYEEVID BIGINT DEFAULT 0 NOT NULL,
FDEPEMPVID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRELBILLID BIGINT DEFAULT 0 NOT NULL,
FCMPEMPVID BIGINT DEFAULT 0 NOT NULL,
FCHANGETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SALARYVERBILLENT') 
 CREATE TABLE T_HPDI_SALARYVERBILLENT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FBIZOBJECTID VARCHAR(36) DEFAULT ' ' NOT NULL,
FCARDTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FTRIGGERCOLLAID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SINSURVBILLDETAIL') 
 CREATE TABLE T_HPDI_SINSURVBILLDETAIL (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFIELDNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FFIELDVALUE VARCHAR(255) DEFAULT ' ' NOT NULL,
FGROUPINDEX INT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SINSURVERBILL') 
 CREATE TABLE T_HPDI_SINSURVERBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FISEXISTSWORKFLOW CHAR(1) DEFAULT '0' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FORGTEAMID BIGINT DEFAULT 0 NOT NULL,
FPERSONNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FEMPNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FACTIONID BIGINT DEFAULT 0 NOT NULL,
FFLOWTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FDUTYWORKROLEID BIGINT DEFAULT 0 NOT NULL,
FORGMSGRECVCENTERID BIGINT DEFAULT 0 NOT NULL,
FTASKRULEID BIGINT DEFAULT 0 NOT NULL,
FTASKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPERSONVID BIGINT DEFAULT 0 NOT NULL,
FEMPLOYEEVID BIGINT DEFAULT 0 NOT NULL,
FDEPEMPVID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRELBILLID BIGINT DEFAULT 0 NOT NULL,
FCMPEMPVID BIGINT DEFAULT 0 NOT NULL,
FCHANGETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SINSURVERBILLENT') 
 CREATE TABLE T_HPDI_SINSURVERBILLENT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FBIZOBJECTID VARCHAR(36) DEFAULT ' ' NOT NULL,
FCARDTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FTRIGGERCOLLAID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_SUMMARYVBILL') 
 CREATE TABLE T_HPDI_SUMMARYVBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FISEXISTSWORKFLOW CHAR(1) DEFAULT '0' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FORGTEAMID BIGINT DEFAULT 0 NOT NULL,
FPERSONNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FEMPNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FACTIONID BIGINT DEFAULT 0 NOT NULL,
FFLOWTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FDUTYWORKROLEID BIGINT DEFAULT 0 NOT NULL,
FORGMSGRECVCENTERID BIGINT DEFAULT 0 NOT NULL,
FTASKRULEID BIGINT DEFAULT 0 NOT NULL,
FTASKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPERSONVID BIGINT DEFAULT 0 NOT NULL,
FEMPLOYEEVID BIGINT DEFAULT 0 NOT NULL,
FDEPEMPVID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRELBILLID BIGINT DEFAULT 0 NOT NULL,
FCMPEMPVID BIGINT DEFAULT 0 NOT NULL,
FCHANGETIME DATETIME,
FEXECUTESEQ INT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TAXVBILLDETAIL') 
 CREATE TABLE T_HPDI_TAXVBILLDETAIL (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFIELDNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FFIELDVALUE VARCHAR(255) DEFAULT ' ' NOT NULL,
FGROUPINDEX INT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TAXVERBILL') 
 CREATE TABLE T_HPDI_TAXVERBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FISEXISTSWORKFLOW CHAR(1) DEFAULT '0' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FORGTEAMID BIGINT DEFAULT 0 NOT NULL,
FPERSONNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FEMPNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FACTIONID BIGINT DEFAULT 0 NOT NULL,
FFLOWTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FDUTYWORKROLEID BIGINT DEFAULT 0 NOT NULL,
FORGMSGRECVCENTERID BIGINT DEFAULT 0 NOT NULL,
FTASKRULEID BIGINT DEFAULT 0 NOT NULL,
FTASKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPERSONVID BIGINT DEFAULT 0 NOT NULL,
FEMPLOYEEVID BIGINT DEFAULT 0 NOT NULL,
FDEPEMPVID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRELBILLID BIGINT DEFAULT 0 NOT NULL,
FCMPEMPVID BIGINT DEFAULT 0 NOT NULL,
FCHANGETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TAXVERBILLENT') 
 CREATE TABLE T_HPDI_TAXVERBILLENT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FBIZOBJECTID VARCHAR(36) DEFAULT ' ' NOT NULL,
FCARDTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FTRIGGERCOLLAID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_VERIFYBILLCONFIG') 
 CREATE TABLE T_HPDI_VERIFYBILLCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FCLOUDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FVERIFYAPP VARCHAR(50) DEFAULT ' ' NOT NULL,
FSERVICENAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FFORMID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FFLOWTYPE') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FFLOWTYPE VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FORGTEAMID') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FORGTEAMID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FDUTYWORKROLEID') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FDUTYWORKROLEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FCHANGETIME') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FCHANGETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FSUMVERIFYBILLID') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FSUMVERIFYBILLID BIGINT DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULEENT' AND KSQL_COL_NAME ='FISMANUALVERIFY') 
 ALTER TABLE T_HPDI_TASKRULEENT ADD (FISMANUALVERIFY CHAR(1) DEFAULT '0' NOT NULL );

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