<%@ language = "JavaScript" %>

<%
DOCTYPE_Disable = 1;
Session("customerId") = 'PZHO';
Response.expires = -1

%>

<!-- #include file="../../../appl/Shared/common.inc" -->

<%

sql = 
  " CREATE OR REPLACE VIEW pzho_v_noti_noshowbudgeth (code, "
+ "                                                   sender, "
+ "                                                   receiver, "
+ "                                                   text, "
+ "                                                   KEY, "
+ "                                                   xkey "
+ "                                                  ) "
+ " AS "
+ " SELECT 'CUST04' code, "
+ "        NULL sender, "
+ "        kp.prs_perslid_key receiver, "
+ "        'Facilitaire Zaken: NoShow reservering' text, "
+ "        rrr.res_reservering_key key, "
+ "        rrr.res_rsv_ruimte_key xkey "
+ "   FROM fac_tracking t, "
+ "        fac_srtnotificatie s, "
+ "        res_rsv_ruimte rrr, "
+ "        prs_kostenplaats kp, "
+ "        (SELECT p2.prs_perslid_key, "
+ "                COALESCE ( "
+ "                   (SELECT fac.safe_to_number (prs_kenmerklink_waarde) "
+ "                      FROM prs_kenmerklink kl "
+ "                     WHERE kl.prs_link_key(+) = p2.prs_perslid_key "
+ "                           AND prs_kenmerk_key = 1160), "
+ "                   6) "
+ "                   waarde  "
+ "           FROM prs_perslid p2) mail "
+ "  WHERE     t.fac_srtnotificatie_key = s.fac_srtnotificatie_key "
+ "        AND s.fac_srtnotificatie_code = 'RESNOS' "
+ "        AND fac_tracking_refkey = res_rsv_ruimte_key "
+ "        AND rrr.prs_kostenplaats_key = kp.prs_kostenplaats_key "
+ "        AND kp.prs_perslid_key = mail.prs_perslid_key "
+ "        AND mail.waarde = 6 "
+ "        AND fac_tracking_datum BETWEEN TRUNC (SYSDATE) - 1 "
+ "                                   AND  TRUNC (SYSDATE) "
+ "  GROUP BY kp.prs_perslid_key, rrr.res_reservering_key, rrr.res_rsv_ruimte_key ";

Oracle.Execute(sql);

Response.end;
%>