IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK')
 CREATE TABLE T_PMTS_TASK (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY NVARCHAR(5) DEFAULT ' ' NOT NULL,
FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL,
FBITINDEX INT DEFAULT 0 NOT NULL,
FSOURCEBITINDEX INT DEFAULT 0 NOT NULL,
FPROJECTNUMID BIGINT DEFAULT 0 NOT NULL,
FSCHEDULETYPE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FTASKTYPEID BIGINT DEFAULT 0 NOT NULL,
FTASKLEVEL NVARCHAR(5) DEFAULT ' ' NOT NULL,
FPRIORITY INT DEFAULT 0 NOT NULL,
FTASKSTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FEXECUTESTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FTIMETYPE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FPERCENTTYPE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FTASKCALENDARLD BIGINT DEFAULT 0 NOT NULL,
FPLANTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTUALTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNEEDTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTIMEUNIT NVARCHAR(5) DEFAULT ' ' NOT NULL,
FFINISHTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFINISHPERCENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWORKLOADUNIT NVARCHAR(5) DEFAULT ' ' NOT NULL,
FWBSID BIGINT DEFAULT 0 NOT NULL,
FVIEWSCHEM BIGINT DEFAULT 0 NOT NULL,
FISCRUX CHAR(1) DEFAULT '0' NOT NULL,
FRESPONSORGID BIGINT DEFAULT 0 NOT NULL,
FRESPONSPERSONID BIGINT DEFAULT 0 NOT NULL,
FWORKSPACE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFLOATTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTALFLOATTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFREEFLOATTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASELINENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBASELINETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISMAXPATH CHAR(1) DEFAULT '0' NOT NULL,
FISAUTONUMBER CHAR(1) DEFAULT '0' NOT NULL,
FAUDITOR BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FORDERNO BIGINT DEFAULT 0 NOT NULL,
FBSPLANDATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBSPLANEQHOUR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBSPLANERHOUR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPFACILITYHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAFACILITYHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNFACILITYHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFFACILITYHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFINISHHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNEEDHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTUALHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLANHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLIMITTWO NVARCHAR(5) DEFAULT ' ' NOT NULL,
FLIMITTWODATE DATETIME,
FLIMITONE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FLIMITONEDATE DATETIME,
FISBASELINE CHAR(1) DEFAULT '0' NOT NULL,
FPLANSTARTDATE DATETIME,
FPLANENDDATE DATETIME,
FACTUALSTARTDATE DATETIME,
FACTUALENDDATE DATETIME,
FNFIRSTSTARTDATE DATETIME,
FNFIRSTENDDATE DATETIME,
FNLASTSTARTDATE DATETIME,
FNLASTENDDATE DATETIME,
FHOPEENDDATE DATETIME,
FFIRSTSTARTDATE DATETIME,
FFIRSTENDDATE DATETIME,
FLASTSTARTDATE DATETIME,
FLASTENDDATE DATETIME,
FBSSTARTDATE DATETIME,
FBSENDDATE DATETIME,
FBSEARLYDATE DATETIME,
FBSLATERDATE DATETIME,
FISPUSHDEMAND CHAR(1) DEFAULT '0' NOT NULL,
FISPUSHPRODUCT CHAR(1) DEFAULT '0' NOT NULL,
FISLCB CHAR(1) DEFAULT '0' NOT NULL,
FREPORTTIME DATETIME,
FWORKCENTERID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK_L')
 CREATE TABLE T_PMTS_TASK_L (
FPKID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK_STOPENTRY')
 CREATE TABLE T_PMTS_TASK_STOPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSTOPREASON NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTOPTIME DATETIME,
FRESTARTTIME DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_POST_TASK')
 CREATE TABLE T_PMTS_POST_TASK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPOSTPOSITIONTASKID BIGINT DEFAULT 0 NOT NULL,
FTASKRELATIONTWO NVARCHAR(5) DEFAULT ' ' NOT NULL,
FPOSTDELAYED DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_PRE_TASK')
 CREATE TABLE T_PMTS_PRE_TASK (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPREPOSITIONTASKID BIGINT DEFAULT 0 NOT NULL,
FTASKRELATION NVARCHAR(5) DEFAULT ' ' NOT NULL,
FPREDELAYED DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_DOCUMENTENTRY')
 CREATE TABLE T_PMTS_DOCUMENTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDOCNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDOCTYPE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FDOCNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBASEDATAFIELD BIGINT DEFAULT 0 NOT NULL,
FORDERNO BIGINT DEFAULT 0 NOT NULL,
FDOCPLANDATE DATETIME,
FWEIGHT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUPLOADPERSON BIGINT DEFAULT 0 NOT NULL,
FUPLOADDATE DATETIME,
FDONESTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FTASKREPORTID BIGINT DEFAULT 0 NOT NULL,
FISFROMPD CHAR(1) DEFAULT '0' NOT NULL,
FDELIVERABLESID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_FLOATPATHENTRY')
 CREATE TABLE T_PMTS_FLOATPATHENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFLOATPATH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFLOATPATHSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK_HS')
 CREATE TABLE T_PMTS_TASK_HS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FHSTYPE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FHSUSER BIGINT DEFAULT 0 NOT NULL,
FHSROLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FHSMAIN CHAR(1) DEFAULT '0' NOT NULL,
FHSPLANABILITYTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHSPLANNEEDTIME DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK_CODE')
 CREATE TABLE T_PMTS_TASK_CODE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FTASKSTRING NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTASKSTEP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINITDATA INT DEFAULT 0 NOT NULL,
FPOSITIONNUMBER INT DEFAULT 0 NOT NULL,
FMAXVALUE INT DEFAULT 0 NOT NULL,
FMAXNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTASKID NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK_CODE_L')
 CREATE TABLE T_PMTS_TASK_CODE_L (
FPKID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);
