/**Begin D:\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_RED_CONFIRM_BILL') 
 CREATE TABLE T_SIM_RED_CONFIRM_BILL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) 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,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FUSEORG BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY VARCHAR(30) DEFAULT '7' NOT NULL,
FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL,
FBITINDEX BIGINT DEFAULT 0 NOT NULL,
FSOURCEBITINDEX BIGINT DEFAULT 0 NOT NULL,
FSALERNAME VARCHAR(150) DEFAULT ' ' NOT NULL,
FSALERTAXNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FBUYERNAME VARCHAR(150) DEFAULT ' ' NOT NULL,
FBUYERTAXNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FORDERNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FHSBZ VARCHAR(30) DEFAULT '0' NOT NULL,
FREDREASON VARCHAR(30) DEFAULT '01' NOT NULL,
FORIGINALINVOICENO VARCHAR(30) DEFAULT ' ' NOT NULL,
FORIGINALISSUETIME DATETIME,
FORIGINALINVOICETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FINVOICEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTALAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTALTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FGOVUUID VARCHAR(50) DEFAULT ' ' NOT NULL,
FUPLOADDATE DATETIME,
FSOURCE VARCHAR(30) DEFAULT '1' NOT NULL,
FINVOICETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FUPLOADSTATUS VARCHAR(30) DEFAULT '0' NOT NULL,
FINVOICENO VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUESTATUS VARCHAR(30) DEFAULT '2' NOT NULL,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPLICANT VARCHAR(30) DEFAULT '2' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_RED_CONFIRM_ITEMS') 
 CREATE TABLE T_SIM_RED_CONFIRM_ITEMS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FGOODSNAME VARCHAR(150) DEFAULT ' ' NOT NULL,
FSPECIFICATION VARCHAR(60) DEFAULT ' ' NOT NULL,
FUNIT VARCHAR(60) DEFAULT ' ' NOT NULL,
FNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXUNITPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE VARCHAR(30) DEFAULT ' ' NOT NULL,
FGOODSCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FROWTYPE VARCHAR(30) DEFAULT ' ' NOT NULL
);



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