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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_QUOTACATEGORY') 
 CREATE TABLE T_FMM_QUOTACATEGORY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) NOT NULL DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) NOT NULL DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(50) NOT NULL DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FISDEFAULT CHAR(1) DEFAULT '0' NOT NULL,
FCONDIMENSION VARCHAR(255) NOT NULL DEFAULT ' ' NOT NULL,
FCONDIMENSIONJSON VARCHAR(1000) NOT NULL DEFAULT ' ' NOT NULL,
FRESULTDIMENSION VARCHAR(255) NOT NULL DEFAULT ' ' NOT NULL,
FRESULTDIMENSIONJSON VARCHAR(1000) NOT NULL DEFAULT ' ' NOT NULL
);


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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PURQUOTA') 
 CREATE TABLE T_FMM_PURQUOTA (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) NOT NULL DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) NOT NULL DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(50) NOT NULL DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITTIME DATETIME,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FQUOTACATEGORYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PURQUOTAENTRY') 
 CREATE TABLE T_FMM_PURQUOTAENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FQUOTARATE  DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPPLYRANK BIGINT DEFAULT 0 NOT NULL,
FPROCEDUREID BIGINT DEFAULT 0 NOT NULL,
FEFFECTDATE DATETIME,
FEXPIRYDATE DATETIME,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FENTRYCREATORID BIGINT DEFAULT 0 NOT NULL,
FENTRYCREATETIME DATETIME,
FENTRYMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENTRYMODIFYTIME DATETIME
);
