/**Begin D:\PDM_UPGRADE\PDM1\BCM_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVSHEETENTRY') 
 CREATE TABLE T_BCM_INVSHEETENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FJOURNALTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FSCENARIOID BIGINT DEFAULT 0 NOT NULL,
FPROCESSID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATECATALOGID BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVSHEETROW') 
 CREATE TABLE T_BCM_INVSHEETROW (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FCHANGETYPEID BIGINT DEFAULT 0 NOT NULL,
FAUDITTRAILID BIGINT DEFAULT 0 NOT NULL,
FDATASOURCEID BIGINT DEFAULT 0 NOT NULL,
FMULTIGAAPID BIGINT DEFAULT 0 NOT NULL,
FENTITYCOMB VARCHAR(50) DEFAULT ' ' NOT NULL,
FCBMYCOMPANY VARCHAR(50) DEFAULT ' ' NOT NULL,
FCBINTERCOMPANY VARCHAR(50) DEFAULT ' ' NOT NULL,
FUSERDEFINE1 BIGINT DEFAULT 0 NOT NULL,
FUSERDEFINE2 BIGINT DEFAULT 0 NOT NULL,
FUSERDEFINE3 BIGINT DEFAULT 0 NOT NULL,
FUSERDEFINE4 BIGINT DEFAULT 0 NOT NULL,
FUSERDEFINE5 BIGINT DEFAULT 0 NOT NULL,
FUSERDEFINE6 BIGINT DEFAULT 0 NOT NULL,
FRULEEXPR VARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEEXPRDEPT VARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEEXPRSOURCE VARCHAR(255) DEFAULT ' ' NOT NULL
);





IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVSHEET') 
 CREATE TABLE T_BCM_INVSHEET (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FSCENARIOID BIGINT DEFAULT 0 NOT NULL,
FYEARID BIGINT DEFAULT 0 NOT NULL,
FPERIODID BIGINT DEFAULT 0 NOT NULL,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATECATALOG VARCHAR(50) DEFAULT ' ' NOT NULL,
FCSLSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FCATALOGID BIGINT DEFAULT 0 NOT NULL,
FFROM CHAR(1) DEFAULT '0' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVSHEETACCLAYOUT') 
 CREATE TABLE T_BCM_INVSHEETACCLAYOUT (
FID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FPOSITION VARCHAR(50) DEFAULT ' ' NOT NULL,
FEXTDIMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVSHEET_S') 
 CREATE TABLE T_BCM_INVSHEET_S (
FID BIGINT DEFAULT 0 NOT NULL,
FSPREADJSON NCLOB,
FDATA NCLOB,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL
);


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