--001
SELECT 
  V8_FNC_NUM_TO_CHAR_FORMATING((conf_rate)) as price,
  V8_FNC_NUM_TO_CHAR_FORMATING((calc_price)) as format_calc_price,
  EXP_ROOM_MOVE_TODAY as expmove,
  TODAY_ROOM_MOVE_FROM as move_from,
  XCID.XCID_ADDRGREET XCID_ADDRGREET,
  (select v8_rep_name.NAME2 from v8_rep_name where v8_rep_name.XCMS_ID=a.YRES_XCMS_ID) GUEST_NAME2,
  (SELECT XCMS_ID FROM XCMS,YCLN,YDET WHERE XCMS.XCMS_ID=YCLN.YCLN_XCMS_ID AND YCLN.YCLN_YDET_ID=YDET.YDET_ID AND YCLN.YCLN_XCCA_INTERNALCATEGORY=1 AND YDET.YDET_ID=a.YDET_ID) COMPANY_ID,
  (SELECT XCMS_ID FROM XCMS,YCLN,YDET WHERE XCMS.XCMS_ID=YCLN.YCLN_XCMS_ID AND YCLN.YCLN_YDET_ID=YDET.YDET_ID AND YCLN.YCLN_XCCA_INTERNALCATEGORY=3 AND YDET.YDET_ID=a.YDET_ID) SOURCE_XCMS_ID,
  (select WDCL_FILENAME from wdcl,wdcg,xcms where xcms_id=wdcl.WDCL_TABLE_ID and wdcl.WDCL_TABLENAME='XCMS' and wdcl.WDCL_WDCG_ID=wdcg.WDCG_ID and wdcg.WDCG_ROLE=2 and rownum=1 and xcms_id=yres_xcms_id) image,
  a.*
FROM 
  V8_REP_YRES_INFOS_ROOMANDBED a, xcid
WHERE 
  a.YRES_ID=:Parameter and
  yres_xcms_id =xcid.xcid_id(+);

--002
select
(case when(select wact.WACT_ID from 
wact,wala,waty,watg where 
wact.WACT_ID=wala.WALA_WACT_ID and
wala.WALA_XCMS_ID=yres.YRES_XCMS_ID and
wact.WACT_WATY_ID=waty.WATY_ID and
wact.WACT_WATY_ID=waty.WATY_ID and
waty.WATY_WATG_ID=watg.WATG_ID and
wact_yres_id = yres_id and
watg.WATG_ROLE in (4) and
wact.WACT_ENDTIME>sysdate and rownum=1) is not null 
then 1 else null end) LOCATOR,
(select wact.WACT_TODO from 
wact,waty,watg where 
wact.WACT_YRES_ID=yres.YRES_ID and
wact.WACT_WATY_ID=waty.WATY_ID and
wact.WACT_WATY_ID=waty.WATY_ID and
waty.WATY_WATG_ID=watg.WATG_ID and
watg.WATG_ROLE in (2) and
wact.WACT_COMPLTIME is null and rownum=1) TRACE
from 
yres
where
yres_id=:parameter;

--003
select
ymnt.YMNT_TEXT,
ymes.YMES_RECEIVEDTYPE,
to_char(ymes.ymes_DELIVEREDTIME,'DD.MM.YYYY') as Deliveredday,
to_char(ymes.ymes_DELIVEREDTIME,'HH24:MM:SS') as Deliveredtime,
ymes.YMES_FROMWHOM,
ymes.YMES_CONTACTINFO
from 
ymnt,
ymes
where 
ymnt.YMNT_YMES_ID=ymes.YMES_ID and
ymes.YMES_RECEIVEDTYPE not in (1,4) and
ymes.YMES_YRES_ID=:parameter;

--004

select zcur.zcur_shortdesc CURRENCY from zcur,wuss
where upper(wuss.WUSS_NAME)='BASECURRENCY' and
	  wuss.WUSS_VALUE=zcur.ZCUR_ID;

