/**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_ISOMERISM_BILL_DATA') 
 CREATE TABLE T_SIM_ISOMERISM_BILL_DATA (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPUSHSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSYSTEM_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSYSTEM_NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORG_CODE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FORG_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCUSTOM_NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILL_CREATE_TIME DATETIME,
FBILL_DATE DATETIME,
FUSER_PHONE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWX_OPEN_ID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FUSER_EMAIL NVARCHAR(70) DEFAULT ' ' NOT NULL,
FIS_SPLIT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTOTAL_AMOUNT DECIMAL(19,4) DEFAULT 0 NOT NULL,
FINVOICABLE_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICE_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAIN_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICE_STATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTABLE_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FROOM_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILL_JSON_DATA NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILL_JSON_DATA_TAG NCLOB,
FBUYERNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUYERTAXNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUYERADDR NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUYERTELNO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUYERBANK NVARCHAR(120) DEFAULT ' ' NOT NULL,
FBUYERBANKACC NVARCHAR(100) DEFAULT ' ' NOT NULL,
FHSBZ CHAR(1) DEFAULT ' ' NOT NULL,
FBUYERPROPERTY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FINVOICETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_ISOMERISM_BILL_INV') 
 CREATE TABLE T_SIM_ISOMERISM_BILL_INV (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FINVOICECODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUETIME DATETIME,
FINVOICEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTALTAX DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_ISOMERISM_ITEM_DATA') 
 CREATE TABLE T_SIM_ISOMERISM_ITEM_DATA (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FSPLITKEY NVARCHAR(100) DEFAULT ' ' NOT NULL,
FPRODUCT_ID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRODUCT_NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRODUCT_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRODUCT_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRODUCT_NUM BIGINT DEFAULT 0 NOT NULL,
FPRODUCT_PRICE DECIMAL(14,2) DEFAULT 0 NOT NULL,
FPRODUCT_AMOUNT DECIMAL(14,2) DEFAULT 0 NOT NULL,
FAVG_AMOUNT DECIMAL(14,2) DEFAULT 0 NOT NULL,
FTAX_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_RATE DECIMAL(14,2) DEFAULT 0 NOT NULL,
FTAX_AMOUNT DECIMAL(14,2) DEFAULT 0 NOT NULL,
FINVOICABLE_SWITCH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCONSUME_TIME DATETIME,
FSUB_ORDER_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTC_GROUP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFOLIO_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPLY_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FUNPUSHAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNPUSHTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNPUSHNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FROWPUSHSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SIM_ISOMERISM_PAY_DATA') 
 CREATE TABLE T_SIM_ISOMERISM_PAY_DATA (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPAY_NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAY_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAY_AMOUNT DECIMAL(14,2) DEFAULT 0 NOT NULL,
FPAY_DESC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FIS_INVOICED NVARCHAR(50) DEFAULT ' ' NOT NULL
);



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