/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\TPO_table.sql **/
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_ASSIST') 
 create table T_TPO_TCVAT_ASSIST (
   FID                  bigint               not null default 0,
   FNAME                varchar(50)          not null default '',
   FNUMBER              varchar(50)          not null default '',
   FPOLICYBASIS         varchar(2000)        not null default '',
   FSTARTDATE           datetime             null,
   FENDDATE             datetime             null,
   FDESCRIPTION         varchar(2000)        not null default '',
   FMODIFIERID          bigint               not null default 0,
   FMODIFYTIME          datetime             null,
   FGROUPID             bigint               not null default 0
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_ASSIST_TREE') 
 create table T_TPO_TCVAT_ASSIST_TREE (
   FID                  bigint               not null default 0,
   FNAME                varchar(50)          not null default '',
   FNUMBER              varchar(50)          not null default '',
   FMODIFIERID          bigint               not null default 0,
   FCREATETIME          datetime             null,
   FMODIFYTIME          datetime             null,
   FLONGNUMBER          varchar(255)         not null default '',
   FFULLNAME            varchar(50)          not null default '',
   FISLEAF              char(1)              not null default '',
   FPARENTID            bigint               not null default 0,
   FMASTERID            bigint               not null default 0,
   FLEVEL               int                  not null default 0,
   FENABLE              char(1)              not null default '',
   FCREATORID           bigint               not null default 0,
   FSTATUS              char(1)              not null default ''
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_ASSISTENTRY') 
 create table T_TPO_TCVAT_ASSISTENTRY (
   FID                  bigint               not null default 0,
   FENTRYID             bigint               not null default 0,
   FSEQ                 int                  not null default 0,
   FVALUE               varchar(50)          not null default '',
   FDESCRIPTION         varchar(2000)        null default '',
   FSTATUS              varchar(30)          not null default ''
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_BIZDEF') 
 create table T_TPO_TCVAT_BIZDEF (
   FID                  bigint               not null default 0,
   FNAME                varchar(50)          not null default '',
   FNUMBER              varchar(50)          not null default '',
   FMODIFYTIME          datetime             null,
   FDESCRIPTION         varchar(2000)        not null default '',
   FMODIFIERID          bigint               not null default 0,
   FGROUPID             bigint               not null default 0
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_BIZDEF_TREE') 
 create table T_TPO_TCVAT_BIZDEF_TREE (
   FID                  bigint               not null default 0,
   FNAME                varchar(50)          not null default '',
   FNUMBER              varchar(50)          not null default '',
   FMODIFIERID          bigint               not null default 0,
   FCREATETIME          datetime             null,
   FMODIFYTIME          datetime             null,
   FLONGNUMBER          varchar(255)         not null default '',
   FFULLNAME            varchar(50)          not null default '',
   FISLEAF              char(1)              not null default '',
   FPARENTID            bigint               not null default 0,
   FMASTERID            bigint               not null default 0,
   FLEVEL               int                  not null default 0,
   FENABLE              char(1)              not null default '',
   FCREATORID           bigint               not null default 0,
   FSTATUS              char(1)              not null default ''
);
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_BIZDEFENTRY') 
create table T_TPO_TCVAT_BIZDEFENTRY (
   FID                  bigint               not null default 0,
   FENTRYID             bigint               not null default 0,
   FVALUE               varchar(50)          not null default '',
   FSEQ                 int                  not null default 0,
   FNUMBER              varchar(50)          not null default '',
   FSTATUS              varchar(30)          not null default '',
   FDESCRIPTION         varchar(2000)        null default ''
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TAXITEMRATE') 
 CREATE TABLE T_TPO_TAXITEMRATE (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FPOLICYBASIS VARCHAR(2000) DEFAULT ' ',
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FDESCRIPTION VARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TAXITEMRATEENTRY') 
 CREATE TABLE T_TPO_TAXITEMRATEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FCOMBINECODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXRATE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXMETHOD VARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(2000) DEFAULT ' ',
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FSUMITEM CHAR(1) DEFAULT ' ' NOT NULL,
FPERONTID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


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


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


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


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


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


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


 --- drop TABLE --------- 请认真检查该脚本 ------------------- 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_RATEENTRY') 
 DROP TABLE T_TPO_TCVAT_RATEENTRY;

 --- drop TABLE --------- 请认真检查该脚本 ------------------- 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TPO_TCVAT_RATE') 
 DROP TABLE T_TPO_TCVAT_RATE;


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\TPO_table.sql **/
