select TBRD_SYSTEM, tbk_booking_number, TBT_DOC_NUMBER,tbrd_rate_serial,tbk_date,
TBK_CUSTOMER, TBT_DOC_DATE, TBK_BOOKING_TYPE,TBT_BOOK_NUMBER, TBT_DOC_NUMBER INV, TBK_FLEX_6 EMPNO, TBK_FLEX_7 COSTCENTRE,TBK_FLEX_8 PROJECT_CODE,tbk_flex_12 HOT_RSN_CODE,
TBK_FLEX_9 Reason_4_Trip, TBK_FLEX_21 SALESCHANNEL, tbt_city CITY, TBT_provider PROVIDER, TBT_Service SERVICE,tbk_remarks_1 PNR_RL,tbk_flex_19 Approval_code,
tbk_flex_22 Approver, tbk_flex_14 Order_ref, TBK_FLEX_13 Dept,TBK_TMP_CUST_NAME PAX,
(SELECT TBSM_SERVICE_TYPE FROM id_tb_service_master WHERE TBSM_SERVICE_CODE=TBT_Service AND ROWNUM=1) SERVICE_CLASS,tbt_created_on INV_CREATED
from
id_tb_booking_header, id_tb_trans,id_tb_booking_rate_details,id_tb_service_voucher_header
where
tbrd_reference=tbk_reference
AND tbrd_provider = tbt_provider
and tbt_book_number=tbk_booking_number
and tbrd_system=tbsvh_sv_number
and tbk_customer in ('B0093','B0104','B0105','F0043')
and tbrd_sys_type='SV'
and tbrd_status<>'V'
and TBT_CREATED_ON between '18-NOV-2019' and '24-NOV-2019'
and TBT_BASE_DOC_TYPE='INV'
and (SELECT TBSM_SERVICE_TYPE FROM id_tb_service_master WHERE TBSM_SERVICE_CODE=TBT_Service AND ROWNUM=1) not in ('CAR','TRAIN')
and tbrd_system in
order by tbt_book_number
