/**Begin D:\pdm\PDM_UPGRADE\pdm_new\RIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INV_TRAIN_ELE') 
 CREATE TABLE T_RIM_INV_TRAIN_ELE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(4) 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,
FORG_ID BIGINT DEFAULT 0 NOT NULL,
FTENANT_NO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FINVOICE_TYPE BIGINT DEFAULT 0 NOT NULL,
FINVOICE_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICE_DATE DATETIME,
FINVOICE_UNIT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FINVOICE_UNIT_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUSINESS_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEPARTURE_STATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEPARTURE_STATION_PHONIC NVARCHAR(150) DEFAULT ' ' NOT NULL,
FDESTINATION_STATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTIN_STATION_PHONICS NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTRAIN_NUM NVARCHAR(16) DEFAULT ' ' NOT NULL,
FTRAVEL_DATE DATETIME,
FDEPARTURE_TIME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTICKET_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAIR_CONDI_CHARACTERISTIC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSEAT_LEVEL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCARRIAGE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTEXTFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDISCOUNT_MARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTOTAL_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT_REFUNDED DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORIGINAL_TICKET_FARE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORI_TICKET_DEPARTUREST NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORI_TICKET_DESTINATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FELE_TICKET_NUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID_NUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPASSENGER_NAME NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDETAIL_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_RATE DECIMAL(23,4) DEFAULT 0 NOT NULL,
FTAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPURCHASER_NAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FPURCH_UNIFIE_SOC_CRE_COD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPURCHASER_ADDR_PHONE_NUM NVARCHAR(150) DEFAULT ' ' NOT NULL,
FPURC_DEPOSIT_BANK_ACC NVARCHAR(150) DEFAULT ' ' NOT NULL,
FSELLER_NAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FSELLER_UNIF_SOC_CRE_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSELLER_ADDR_PHONE_NUM NVARCHAR(150) DEFAULT ' ' NOT NULL,
FSELLER_DEPOSIT_BANK_ACC NVARCHAR(150) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(300) DEFAULT ' ' NOT NULL,
FTAX_ORG BIGINT DEFAULT 0 NOT NULL,
FAWS_SERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FORIGINAL_STATE NVARCHAR(4) DEFAULT ' ' NOT NULL,
FEXPENSE_STATUS NVARCHAR(4) DEFAULT ' ' NOT NULL,
FRESOURCE NVARCHAR(20) DEFAULT ' ' NOT NULL,
FDELETE NVARCHAR(4) DEFAULT ' ' NOT NULL,
FORIGINAL_INVOICE_NO NVARCHAR(32) DEFAULT ' ' NOT NULL,
FACCOUNT_DATE DATETIME,
FTAX_PERIOD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INV_AIR_ELE') 
 CREATE TABLE T_RIM_INV_AIR_ELE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(4) 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,
FINTERNATIONAL_FLAG NVARCHAR(10) DEFAULT ' ' NOT NULL,
FORG_ID BIGINT DEFAULT 0 NOT NULL,
FTENANT_NO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FGP_ORDER_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FINVOICE_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUING_STATUS NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCUSTOMER_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCUSTOMER_IDENTITY_NUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENDORSEMENT NVARCHAR(32) DEFAULT ' ' NOT NULL,
FPLACE_OF_DEPARTURE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESTINATION NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFLIGHT_SEGMENT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCARRIER NVARCHAR(32) DEFAULT ' ' NOT NULL,
FFLIGHT_NUM NVARCHAR(32) DEFAULT ' ' NOT NULL,
FSEAT_GRADE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCARRIER_DATE DATETIME,
FAIR_TIME NVARCHAR(10) DEFAULT ' ' NOT NULL,
FFARE_BASIS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEFFECTIVE_DATE DATETIME,
FEXPIRATION_DATE DATETIME,
FFREE_BAG_ALLOWANCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVOICE_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFUEL_SURCHARGE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_RATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAIRPORT_CONSTRUCTION_FEE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTAL_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOTHER_TOTAL_TAX_AMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVERIFICATION_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROMPTINFORMATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINSURANCE_PREMIUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSALES_UNIT_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILLING_UNIT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSUE_DATE DATETIME,
FSELLER_NAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPURCHASER_NAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FPUR_UNIFIED_CRE_CODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FRUSH_RED_REASON NVARCHAR(50) DEFAULT ' ' NOT NULL,
FELECTRONIC_TICKET_NUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTAX_ORG BIGINT DEFAULT 0 NOT NULL,
FINVOICE_TYPE BIGINT DEFAULT 0 NOT NULL,
FAWS_SERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FORIGINAL_STATE NVARCHAR(4) DEFAULT ' ' NOT NULL,
FEXPENSE_STATUS NVARCHAR(4) DEFAULT ' ' NOT NULL,
FRESOURCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDELETE NVARCHAR(4) DEFAULT ' ' NOT NULL,
FORIGINAL_INVOICE_NO NVARCHAR(32) DEFAULT ' ' NOT NULL,
FACCOUNT_DATE DATETIME,
FTAX_PERIOD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INV_AIR_ELE_ITEM') 
 CREATE TABLE T_RIM_INV_AIR_ELE_ITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTRY_PLACE_OF_DEPARTURE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_DESTINATION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_FLIGHT_SEGMENT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_CARRIER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_FLIGHT_NUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_SEAT_GRADE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_CARRIER_DATE DATETIME,
FENTRY_AIR_TIME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_FARE_BASIS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRY_EFFECTIVE_DATE DATETIME,
FENTRY_EXPIRATION_DATE DATETIME,
FENTRY_FREE_BAG_ALLOWANCE NVARCHAR(50) DEFAULT ' ' NOT NULL
);



/**End D:\pdm\PDM_UPGRADE\pdm_new\RIM_table.sql **/
