-- C- ACM, D-ADM
select TICKET_FILE_REFERENCE,TICKET_IATA_CODE,TICKET_BSP_DATE, ticket_number,ticket_currency, ticket_market_fare, ticket_total_tax, ticket_payable from id_ticket_details_bsp
where ticket_number not in (select ticket_number from id_ticket_details)
and TICKET_BSP_DATE between '01-jan-2020' and '15-may-2020'
and ticket_payable>0 and ticket_status not in ('C','D','R') and TICKET_IATA_CODE='41223475'
order by TICKET_IATA_CODE,ticket_date, ticket_number


select Ticket_No,Void_status, void_date, BKCLERK, (select exec_name from id_executive_master where exec_code=bkclerk and rownum=1) TC_Name, STOCK_STATUS
from (SELECT substr(AIRT_0,8,16) Ticket_No, SUBSTR(air_2, 1, 4) void_status, LTRIM(RTRIM(SUBSTR(air_2, 5, 5))) void_date,
          SUBSTR(air_3, 1, 2) bkclerk,decode(stock_status, 'S', 'SOLD','N', 'NOT SOLD','V','VOIDED') STOCK_STATUS
     FROM
     id_air_amadeus,id_air_t, id_ticket_stock_master
where AIR_KEY=AIRT_KEY
and STOCK_TICKET=substr(AIRT_0,8,16))
 where trim(void_status) is not null and stock_status<>'VOIDED'

