/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTS_LAYOUTFIELDCTL') 
 CREATE TABLE T_CTS_LAYOUTFIELDCTL (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ SMALLINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FFIELDKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FMUSTINPUT CHAR(1) DEFAULT '0' NOT NULL,
FDEFAULTVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDEFAULTFUNCPARAM VARCHAR(36) DEFAULT ' ' NOT NULL,
FENABLED CHAR(1) DEFAULT '0' NOT NULL,
FEDITENABLED CHAR(1) DEFAULT '0' NOT NULL,
FSUBMITENABLED CHAR(1) DEFAULT '0' NOT NULL,
FAUDITENABLED CHAR(1) DEFAULT '0' NOT NULL,
FVINIT CHAR(1) DEFAULT '0' NOT NULL,
FVNEW CHAR(1) DEFAULT '0' NOT NULL,
FVEDIT CHAR(1) DEFAULT '0' NOT NULL,
FVVIEW CHAR(1) DEFAULT '0' NOT NULL,
FVSUBMIT CHAR(1) DEFAULT '0' NOT NULL,
FVAUDIT CHAR(1) DEFAULT '0' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTS_LAYOUTSCHEME') 
 CREATE TABLE T_CTS_LAYOUTSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(36) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFORMNUMBER VARCHAR(36) DEFAULT ' ' NOT NULL,
FLAYOUTNUMBER VARCHAR(36) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME DEFAULT GETDATE() NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISDEFAULT CHAR(1) DEFAULT '1' NOT NULL,
flayoutnumber_d VARCHAR(36) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTS_LAYOUTSCHEME_L') 
 CREATE TABLE T_CTS_LAYOUTSCHEME_L (
FPKID VARCHAR(36) 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_CTS_LAYOUTSCHEMEASSIGN') 
 CREATE TABLE T_CTS_LAYOUTSCHEMEASSIGN (
FID BIGINT DEFAULT 0 NOT NULL,
FLAYOUTSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCLOUDID VARCHAR(36) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(36) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME DEFAULT GETDATE() NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINCLUDESUBORG CHAR(1) DEFAULT '0' NOT NULL
);

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


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