/**Begin D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_BATCH') 
 CREATE TABLE T_SIM_BATCH (
FID BIGINT DEFAULT 0 NOT NULL,
FBUYERNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUYERTAXNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUYERADDR NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUYERBANK NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUYERPHONE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUYEREMAIL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSALERNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSALERTAXNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSALERADDR NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSALERBANK NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTOTALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTALTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICECODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUETIME DATETIME,
FORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSPECIALTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDEDUCTION DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FISSUETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTAXEDTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FHSBZ NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINVOICETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYEE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREVIEWER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDRAWER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUESOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FJQBH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FBILLSTATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FBATCHBELONG NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINREASON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOPYFLAG BIGINT DEFAULT 0 NOT NULL,
FBATCHSTATE NVARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_BATCH_E') 
 CREATE TABLE T_SIM_BATCH_E (
FID BIGINT DEFAULT 0 NOT NULL,
FCHECKCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGINALINVOICECODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGINALINVOICENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGINALISSUETIME DATETIME,
FORIGINALINVOICETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBUYERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINVENTORYMARK NVARCHAR(30) DEFAULT ' ' NOT NULL,
FINVALIDER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVALIDDATE DATETIME,
FREMAINREDAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_BATCH_ITEM') 
 CREATE TABLE T_SIM_BATCH_ITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FROWTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FGOODSCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGOODSNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSPECIFICATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FUNIT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FZEROTAXMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXPREMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FZZSTSGL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FZXBM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSIMPLEGOODSNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDISCOUNTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDISCOUNTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPOLICYCONTANTS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPOLICYLOGO NVARCHAR(30) DEFAULT ' ' NOT NULL
);



/**End D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
