-- UPDATE SCRIPT CONTAINING ONLY VIEWS THAT HAVE CHANGED SINCE PREVIOUS RELEASE

CREATE OR REPLACE FORCE VIEW V8_IFC_ACCOUNTSEARCH 
AS
SELECT 
3 DEST_TYPE,
AACC.AACC_ID DEST_ID,
AACC.AACC_ID RESERVATIONNUMBER,
1 PRIMARY_GUEST,
AACC.AACC_XCMS_ID GUESTNUMBER,
(SELECT v8_rep_name.NAME2 FROM v8_rep_name WHERE v8_rep_name.XCMS_ID = AACC.AACC_XCMS_ID) FORMATTEDNAME,
(SELECT XCMS.XCMS_NAME1 FROM XCMS WHERE XCMS.XCMS_ID = AACC.AACC_XCMS_ID) LASTNAME,
(SELECT UPPER (XCMS.XCMS_NAME1) FROM XCMS WHERE XCMS.XCMS_ID = AACC.AACC_XCMS_ID) UPLASTNAME,
(SELECT XCMS.XCMS_NAME3 FROM XCMS WHERE XCMS.XCMS_ID = AACC.AACC_XCMS_ID) FIRSTNAME,
(SELECT XCID.XCID_ADDRGREET FROM XCID WHERE XCID.XCID_ID = AACC.AACC_XCMS_ID) TITLE,
(SELECT XCID.XCID_TITLE FROM XCID WHERE XCID.XCID_ID = AACC.AACC_XCMS_ID) FREETITLE,
NVL(AACC.AACC_NUMBER, AACC.AACC_ID) ROOMNUMBER,
(SELECT ATYP.ATYP_SHORTDESC FROM ATYP WHERE ATYP.ATYP_ID = AACC.AACC_ATYP_ID) ROOMTYPE,
NULL ycatid,
TO_DATE (NULL) ARRIVALDATE,
TO_DATE (NULL) DEPARTUREDATE,
TO_DATE (NULL) ARRIVALTIME,
TO_DATE (NULL) DEPARTURETIME,
TO_NUMBER (NULL) SHARENUMBER,
0 NOPOSTFLAG,
0 ADULTS,
0 KIDS,
(SELECT WLAN.WLAN_SHORTDESC FROM WLAN WHERE WLAN.WLAN_ID = (SELECT XCMS.XCMS_WLAN_ID FROM XCMS WHERE XCMS.XCMS_ID = AACC.AACC_XCMS_ID)) LANGUAGE,
NULL GROUPID,
'' GROUPNAME,
1 GUESTRESSTATUS,
NVL((SELECT XPDA.XPDA_SHORTDESC FROM XPDA, XPAL WHERE XPDA.XPDA_ID = XPAL.XPAL_XPDA_ID AND XPAL.XPAL_XPAC_ID = 11 AND XPAL.XPAL_XCMS_ID = AACC.AACC_XCMS_ID AND ROWNUM = 1),'')
VIP,
'' MARKETCODE,
'' REMARK1,
'' REMARK2,
'' PAYMETHOD,
0 MESSAGES,
'' RATECODE,
'' COMPANY,
'' TRAVELAGENTNAME,
'' CRS_SYSTEM,
'' CRS_NUMBER,
AACC.AACC_CREDITLIMIT CREDITLIMIT,
'' ZTRA_NUMBER
FROM AACC
WHERE AACC.AACC_OBSOLETE = 0;


