/**Begin D:\pdm\PDM_UPGRADE\pdm1\BDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_EP_RELATE_SERVER') 
 CREATE TABLE T_BDM_EP_RELATE_SERVER (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSERVERINFO BIGINT DEFAULT 0 NOT NULL,
FMASTERSLAVEMARK VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_INVOICE_APPLY_AGENT') 
 CREATE TABLE T_BDM_INVOICE_APPLY_AGENT (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FCERTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCERTNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_TAXCLASSIFICATION') 
 CREATE TABLE T_BDM_TAXCLASSIFICATION (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(19) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FMERGECODE VARCHAR(19) DEFAULT ' ' NOT NULL,
FTAXSUB VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXRATE BIGINT DEFAULT 0 NOT NULL,
FVATSPECMANAGE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUMMARK CHAR(1) DEFAULT ' ' NOT NULL,
FCODEVERSION VARCHAR(10) DEFAULT ' ' NOT NULL,
FTAXPREDESC VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXPREMARK CHAR(1) DEFAULT ' ' NOT NULL,
FZEROTAXMARK VARCHAR(2) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_EP_MONITOR_INFO') 
 CREATE TABLE T_BDM_EP_MONITOR_INFO (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINVOICETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FISSUESTARTTIME DATETIME,
FISSUEENDTIME DATETIME,
FDATADECLARESTARTTIME DATETIME,
FDATADECLAREENDTIME DATETIME,
FISSUELIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOSITIVELIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNEGATIVELIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOFFLINEDURATION DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOFFLINECOUNT BIGINT DEFAULT 0 NOT NULL,
FOFFPOSLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOFFNEGALIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDECLAREDATE DATETIME,
FDECLARETIME DATETIME,
FRSPTIME DATETIME,
FUPLOADENDTIME DATETIME,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FCOUNTLIMIT BIGINT DEFAULT 0 NOT NULL,
FPOSITIVECOUNTLIMIT BIGINT DEFAULT 0 NOT NULL,
FNEGATIVECOUNTLIMIT BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_EP_CHECKED_TAX') 
 CREATE TABLE T_BDM_EP_CHECKED_TAX (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINVOICETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATENAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXFLAG VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_EP_INVOICE_APPLY') 
 CREATE TABLE T_BDM_EP_INVOICE_APPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINVOICEKINDCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICEKINDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FHIGHESTHOLDERCOUNT BIGINT DEFAULT 0 NOT NULL,
FBUYLIMITEACH BIGINT DEFAULT 0 NOT NULL,
FBUYLIMITMONTHLY BIGINT DEFAULT 0 NOT NULL,
FINVOICEKIND VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_SERVICE_REGISTER') 
 CREATE TABLE T_BDM_SERVICE_REGISTER (
FID BIGINT DEFAULT 0 NOT NULL,
FEPINFO BIGINT DEFAULT 0 NOT NULL,
FUKEYNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FUKEYPWD VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FORG BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_ENTERPRISE_BASEINFO') 
 CREATE TABLE T_BDM_ENTERPRISE_BASEINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FPROVINCE VARCHAR(30) DEFAULT ' ' NOT NULL,
FDEVNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FDEVISSUETIME DATETIME,
FDEVISSUERID BIGINT DEFAULT 0 NOT NULL,
FDEVISSUER VARCHAR(50) DEFAULT ' ' NOT NULL,
FCERTISSUERID BIGINT DEFAULT 0 NOT NULL,
FCERTISSUER VARCHAR(50) DEFAULT ' ' NOT NULL,
FCERTSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCERTISSUETIME DATETIME,
FCERTEXPIRETIME DATETIME,
FREGISTERTIME DATETIME,
FINVOICETYPES VARCHAR(30) DEFAULT ' ' NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FCURRENTTIME DATETIME,
FVIRTUALDEVID VARCHAR(40) DEFAULT ' ' NOT NULL,
FDEVPWD VARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_ENTERPRISE_INFO') 
 CREATE TABLE T_BDM_ENTERPRISE_INFO (
FID BIGINT DEFAULT 0 NOT NULL,
FZGSWJGDM VARCHAR(50) DEFAULT ' ' NOT NULL,
FZGSWJGMC VARCHAR(50) DEFAULT ' ' NOT NULL,
FINPUTAUTHMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FEPTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FISSUEMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FVERSIONNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUEDEVNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FREGISTERSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FSPECIFICEPMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FAROPRODEPMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FTELECOMEPMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FXGMKJZPBS VARCHAR(30) DEFAULT ' ' NOT NULL,
FSECONDCARMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FRAREEARTHEPMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FOILMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FOILEXPIRESTARTTIME DATETIME,
FOILEXPIREENDTIME DATETIME,
FOILWHITELISTMARK VARCHAR(30) DEFAULT ' ' NOT NULL,
FOILWLISTEXPSTARTTIME DATETIME,
FOILWLISTEXPENDTIME DATETIME,
FEPINFO BIGINT DEFAULT 0 NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_TAXRATE_CODE') 
 CREATE TABLE T_BDM_TAXRATE_CODE (
FID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(4) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(4) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FLONGNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FLEVEL BIGINT DEFAULT 0 NOT NULL,
FISLEAF CHAR(1) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FTAXRATE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSIMPLECODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FZZSTSGL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FXFSZCYJ NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FZZSZCYJ NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FZZSTSNRDM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBMBBBH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGJZ NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FXFSGL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FYHZC NVARCHAR(150) DEFAULT ' ' NOT NULL,
FYHZCMC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLSLVBS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FHZX NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCODE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_GOODS_INFO') 
 CREATE TABLE T_BDM_GOODS_INFO (
FID BIGINT DEFAULT 0 NOT NULL,
FGOODSNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FGOODSCODE NVARCHAR(32) DEFAULT ' ' NOT NULL,
FTAXCODE BIGINT DEFAULT 0 NOT NULL,
FSPECIFICATIONS NVARCHAR(40) DEFAULT ' ' NOT NULL,
FUNIT NVARCHAR(32) DEFAULT ' ' NOT NULL,
FTAXRATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPRIVILEGEFLAG NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPRIVILEGETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_TAX_EQUIPMENT') 
 CREATE TABLE T_BDM_TAX_EQUIPMENT (
FID BIGINT DEFAULT 0 NOT NULL,
FTAXNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEQUIPMENTNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEQUIPMENTPWD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMBOFIELD NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCONNTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISSUETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FEQUIPMENTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDEFAULTEQUIPMENT VARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_PARAM_CONFIG') 
 CREATE TABLE T_BDM_PARAM_CONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FCONFIG_TYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIG_KEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIG_VALUE VARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_ORG') 
 CREATE TABLE T_BDM_ORG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FPARENT VARCHAR(50) DEFAULT ' ' NOT NULL,
FPARENTNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FLONGNUMBER VARCHAR(200) DEFAULT ' ' NOT NULL,
FEPINFO BIGINT DEFAULT 0 NOT NULL,
FEQUIPMENTTYPE VARCHAR(60) DEFAULT ' ' NOT NULL,
FISSUETYPE VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_PREMISSION_INFO') 
 CREATE TABLE T_BDM_PREMISSION_INFO (
FID BIGINT DEFAULT 0 NOT NULL,
FIMCAPPID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FIMCSECRET NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILEURL NVARCHAR(200) DEFAULT ' ' NOT NULL,
FREQUESTURL NVARCHAR(200) DEFAULT ' ' NOT NULL,
FTEXTFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FIMSCSECRET NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVALIDSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDM_INVOICE_PERMISSION') 
 CREATE TABLE T_BDM_INVOICE_PERMISSION (
FID BIGINT DEFAULT 0 NOT NULL,
FEPINFO BIGINT DEFAULT 0 NOT NULL,
FAUTHSTATE VARCHAR(4) DEFAULT ' ' NOT NULL,
FUSERFIELD BIGINT DEFAULT 0 NOT NULL,
FAUTHDATE DATETIME,
FSERVERGROUP VARCHAR(8) DEFAULT ' ' NOT NULL,
FEQUIPMENTNO VARCHAR(100) DEFAULT ' ' NOT NULL,
FEQUIPMENTTYPE VARCHAR(60) DEFAULT ' ' NOT NULL,
FISSUETYPE VARCHAR(60) DEFAULT ' ' NOT NULL,
FREGISTERCODE VARCHAR(500) DEFAULT ' ' NOT NULL,
FRESULTURL VARCHAR(100) DEFAULT ' ' NOT NULL,
FVALIDENDTIME DATETIME,
FVALIDSTARTTIME DATETIME,
FEQUIPMENT BIGINT DEFAULT 0 NOT NULL
);



/**End D:\pdm\PDM_UPGRADE\pdm1\BDM_table.sql **/
