/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMDISTRIBUTE') 
 CREATE TABLE T_EB_PJOTEMDISTRIBUTE (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FENTITY BIGINT DEFAULT 0 NOT NULL,
FTEMPLATE BIGINT DEFAULT 0 NOT NULL,
FRANGE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPROPERTY BIGINT DEFAULT 0 NOT NULL,
FPROPERTYVALUE BIGINT DEFAULT 0 NOT NULL,
FTEXTNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMPLATE') 
 CREATE TABLE T_EB_PJOTEMPLATE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FTEMPLATECATAID BIGINT DEFAULT 0 NOT NULL,
FORGINFORMATION NVARCHAR(100) DEFAULT ' ' NOT NULL,
FINFORMATION NVARCHAR(500) DEFAULT ' ' NOT NULL,
FDATE DATETIME,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FORGNAME NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMPLATECATA') 
 CREATE TABLE T_EB_PJOTEMPLATECATA (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FMODEL BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BGM_PRODETAIL') 
 CREATE TABLE T_BGM_PRODETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSUBJECT BIGINT DEFAULT 0 NOT NULL,
FPERIOD BIGINT DEFAULT 0 NOT NULL,
FINTERNALCOMPANY BIGINT DEFAULT 0 NOT NULL,
FCURRENCY BIGINT DEFAULT 0 NOT NULL,
FAUDITTRAIL BIGINT DEFAULT 0 NOT NULL,
FCHANGETYPE BIGINT DEFAULT 0 NOT NULL,
FUSERDEF1 BIGINT DEFAULT 0 NOT NULL,
FUSERDEF2 BIGINT DEFAULT 0 NOT NULL,
FUSERDEF3 BIGINT DEFAULT 0 NOT NULL,
FUSERDEF4 BIGINT DEFAULT 0 NOT NULL,
FUSERDEF5 BIGINT DEFAULT 0 NOT NULL,
FUSERDEF6 BIGINT DEFAULT 0 NOT NULL,
FPROAMOUT DECIMAL(10) DEFAULT 0 NOT NULL,
FSCENARIO BIGINT DEFAULT 0 NOT NULL,
FPROCESS BIGINT DEFAULT 0 NOT NULL,
FDATADYPE BIGINT DEFAULT 0 NOT NULL,
FPRODESCRIBE NVARCHAR(255)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BGM_PROJECTAPPLY') 
 CREATE TABLE T_BGM_PROJECTAPPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FFISCALYEAE BIGINT DEFAULT 0 NOT NULL,
FAPPLYDATE DATETIME,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FUSERPHONE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMPANY NVARCHAR(100) DEFAULT ' ' NOT NULL,
FUSERDPT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FPOSITION NVARCHAR(100) DEFAULT ' ' NOT NULL,
FMODIFYDATE DATETIME,
FBILLSTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FAPPLIER BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCURTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEMODEL BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMCLODIM') 
 CREATE TABLE T_EB_PJOTEMCLODIM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDIMMEMBER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSELDIMENSION NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISVISIBLE CHAR(1) DEFAULT '0' NOT NULL,
FDIMENSIONID NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDIMNUMBER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FDIMMEMBERNUM NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FMEMID NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FDIMDESCRIPTION NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMPLATE_ORG') 
 CREATE TABLE T_EB_PJOTEMPLATE_ORG (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMPLATE_YERA') 
 CREATE TABLE T_EB_PJOTEMPLATE_YERA (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SHARESCHEME_ACCOUNT') 
 CREATE TABLE T_EB_SHARESCHEME_ACCOUNT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACCOUNT BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SHARESCHEME_GROUP') 
 CREATE TABLE T_EB_SHARESCHEME_GROUP (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPARENT BIGINT DEFAULT 0 NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FLONGNAME NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXECUTESHARE_LOG') 
 CREATE TABLE T_EB_EXECUTESHARE_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FSHARESCHEMEID BIGINT DEFAULT 0 NOT NULL,
FTABKEY NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FLOG NCLOB,
FSTATUS NVARCHAR(2) DEFAULT ' ' NOT NULL,
FEXECUTEINSTANCEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SHARESCHEME_ENTITY') 
 CREATE TABLE T_EB_SHARESCHEME_ENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBACKTOSENDER CHAR(1) DEFAULT '0' NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FSCHEMEGROUP BIGINT DEFAULT 0 NOT NULL,
FMETRIC BIGINT DEFAULT 0 NOT NULL,
FSTATUS NVARCHAR(2) DEFAULT ' ' NOT NULL,
FTABINFO NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SHARESCHEME_AUDIT') 
 CREATE TABLE T_EB_SHARESCHEME_AUDIT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



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