SELECT
replace(replace(replace(replace(replace(TBK_TMP_CUST_NAME,',','-'),'/','-'),chr(9),'-'),chr(10),'-'),chr(13),'-') Traveller_Name,
(replace(replace(replace(replace(replace((select tbpm_name from id_tb_provider_master where tbpm_provider=tbrd_provider and rownum=1),',','-'),'/','-'),chr(9),'-'),chr(10),'-'),chr(13),'-')||' '||
replace(replace(replace(replace(replace(tbrd_supplier,',','-'),'/','-'),chr(9),'-'),chr(10),'-'),chr(13),'-'))Hotel_Name,
replace(replace(replace(replace(replace((decode(tbk_booking_Type,'IB','Domestic : ','International: ')||' City: '||(tbrd_city||'-'||TBRD_FLEX_V_1||' CID: '||TBRD_FROM_DATE||' COD: '||TBRD_TO_DATE||' - Nights : '||
to_char((to_date(TBRD_TO_DATE,'dd-MM-yyyy'))-(to_date(TBRD_from_DATE,'dd-MM-yyyy')))||' Units: '||TBRD_NO_OF_UNITS)),',','-'),'/','-'),chr(9),'-'),chr(10),'-'),chr(13),'-') Service_Description,
TBT_DOC_NUMBER Invoice_No,
tbt_doc_date Invoice_Date,
tbt_currency,
((round((TBRD_INVOICE_VALUE/tbrd_ex_rate),2))-TBRD_MARKUP_VALUE ) Service_Cost,
TBRD_MARKUP_VALUE Markup,
round((TBRD_INVOICE_VALUE/tbrd_ex_rate),2) Invoice_Amount,
TBT_OTHER_REFERENCE LPO,
TBK_DATE Booking_Date,
TBK_CUSTOMER Customer_Code,
TBT_CREATED_ON Created_On,
tbrd_service
FROM
ID_TB_TRANS,
ID_TB_BOOKING_HEADER,
id_tb_provider_master,
id_tb_booking_rate_details,
id_ar_trans
where
TBRD_REFERENCE=TBK_REFERENCE
and TBT_BOOK_NUMBER = TBK_BOOKING_NUMBER
and TBPM_PROVIDER = TBT_PROVIDER
AND TBK_CUSTOMER in ('S0185')
and TBT_DOC_TYPE = 'TIN'
and tbt_status='P'
and TBRD_SYS_TYPE='SV'
and tbrd_status<>'V'
and TBT_FOREIGN_AMOUNT=round((TBRD_INVOICE_VALUE/tbrd_ex_rate),2)
and art_number=TBT_DOC_NUMBER
--and art_foreign_balance<>0 and ART_BALANCE_STATUS<>'C'
and TBRD_FLEX_V_1 not in ('CAR','TRANSFERS')
--and tbrd_service not in ('CAR','TRANSFERS')
and tbk_booking_number='OB18110061'

select * from id_tb_trans where tbt_book_number='OB18110061' and tbt_doc_type='TIN'

select * from id_ar_trans where art_number='TIN19040646'

select * from id_tb_booking_rate_details where tbrd_reference='38026'
and TBRD_SYS_TYPE='SV'
and tbrd_status<>'V'

select to_date('01/01/2000','DD/MM/YYYY') from dual

select * from id_tb_trans WHERE TBT_DOC_NUMBER LIKE 'TIN19060433'

select * from tab where tname like 'ID_TB%'

select * from ID_TB_AR_DETAILS
select * from ID_TB_AR_HEADER where SUB_AR_DOC_NUMBER='TIN19060433'
select * from ID_TB_BOOKING_DETAIL_VIEW_NEW where TBRD_INVOICE='TIN19060433'
select * from ID_TB_BOOKING_SUPPLY_DETAIL
select * from ID_TB_TRANS where TBT_DOC_TYPE='TIN' and TBT_DOC_NUMBER='TIN19060433'

select * from id_ticket_details

update id_payment_allocation_details set aloc_detail_7='' where aloc_doc_number='BPV190700116'
select * from id_payment_header where PH_DOC_NUMBER='BPV190700116'

select * from id_payment_allocation_details where aloc_doc_number='BPV190700116'


Delete from ke014t3_support.BCD_ICT_SAFARICOM_PRPO_temp

insert into ke014t3_support.BCD_ICT_SAFARICOM_PRPO_DETAILS select * from ke014t3_support.BCD_ICT_SAFARICOM_PRPO_TEMP where pr_number not in (select pr_number from ke014t3_support.BCD_ICT_SAFARICOM_PRPO_DETAILS)

select * from ke014t3_support.bcd_ict_prpo_po_update

select * from id_common_code_master where ccm_type='CAR'

select * from id_fa_master

select * from ke014t3.id_ap_trans where apt_code='PPP01' and apt_type in ('BPV','BPVS')  and APT_DETAIL_4='IB18020551'
union all
select * from ke074t3.id_ap_trans where apt_code='PPP01' and apt_type in ('BPV','BPVS') and APT_DETAIL_4='IB18020551'
