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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_BALANCEMODEL_TYPE' AND KSQL_COL_NAME IN ('FTYPE'))
 ALTER TABLE T_FCS_BALANCEMODEL_TYPE ADD (FTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_COUNTMODEL')
 CREATE TABLE T_FCS_COUNTMODEL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_COUNTMODEL_BIZ')
 CREATE TABLE T_FCS_COUNTMODEL_BIZ (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBIZBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACCOUNTBANK NVARCHAR(80) DEFAULT ' ' NOT NULL,
FACCOUNTBANKPROP NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_COUNTMODEL_ENTRY')
 CREATE TABLE T_FCS_COUNTMODEL_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCALFORMULA NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCALBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCALCOUNT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOUNTPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCALACCOUNT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACCOUNTPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCALCURRENCY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCURRENCYPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPLYCONDITIONDESC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPLYCONDITION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FAPPLYCONDITION_TAG NCLOB,
FEXPLAIN NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCUSTOM CHAR(1) DEFAULT '0' NOT NULL,
FMICROSERVICE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMSERVICECONFIG NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMSERVICECONFIG_TAG NCLOB
);



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