/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRICECONF') 
 CREATE TABLE T_IM_PRICECONF (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FIMBILL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLENTRY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLENTRYKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATIONNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRICEOBJECT CHAR(1) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'C' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FBILLFILTER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLFILTERSCRIPT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLFILTERSCRIPT_TAG NCLOB,
FBILLFILTERJSON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLFILTERJSON_TAG NCLOB,
FPRICEFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRICEFIELDKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXRATEDATEFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXRATEDATEFIELDKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXRATETABLE BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRICECONF_AMOUNT') 
 CREATE TABLE T_IM_PRICECONF_AMOUNT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAMOUNTFIELD NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAMOUNTFIELDKEY NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFORMULA NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFORMULAJSON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFORMULAJSON_TAG NCLOB,
FFORMULASCRIPT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFORMULASCRIPT_TAG NCLOB
);


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


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


 --- drop TABLE --------- 不允许删除表T_CAL_BAL_DW，请恢复pdm ------------------- 

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