/*****************************************************************************
*
* Filename         - $Workfile : reflight_setup_v.sql $
*
* Project Name     - ULTRATRAK(Oracle Database)
*
* Source Code
* Identifier       - FAS/FARFL
*
* Description      - Re-flighting Module
*
* Language         - SQL Script
*
* File History     - For the development history run the Show History report in PVCS
*
* Coptright Ultra Electronics Airport Systems 2004
*
*****************************************************************************/
/****************************************************************************
* View             reflight_setup_v
*
* Description:     Re-flighting module addition.
*                  This view is used from the "Re-flighting Setup" screen to 
*                  retrieve the entire re-flighting configuration data for a carrier.
*
* CA History
* Date      Name              CA Number               CA Description
* 07/04/04  Jacqui Bruce      FALCP/CA/461       Initial development of the re-flighting module.
*
*****************************************************************************/
PROMPT Creating view reflight_setup_v

CREATE OR REPLACE FORCE VIEW reflight_setup_v
(user_id,
 agent_code,
 carrier,
 site_id,
 bags_per_flight,
 mins_in_future,
 send_wt_msg,
 tag_default,
 tag_other,
 accept_from_carrier,
 add_rush_auth,
 avoid_dest,
 teletype_dest,
 teletype_address,
 printing_enabled,
 reflighting_enabled)
AS SELECT tu.user_id,
          tu.agent_code,
          rs.carrier,
          rs.site_id,
          rs.bags_per_flight,
          rs.mins_in_future,
          rs.send_wt_msg,
          rs.tag_default,
          rs.tag_other,
          af.accept_from_carrier,
          af.add_rush_auth,
          ad.avoid_dest,
          dt.dest,
          dt.teletype_address,
          dc.db_value,
          cs.config_value
FROM reflight_setup       rs,
     reflight_accept_from af,
     reflight_avoid_dest  ad,
     reflight_dest_tx     dt,
     db_config            dc,
     carrier_site_config  cs,
     tagtrak_users        tu,
     contracted_agents    ca
WHERE ad.site_id(+)         = rs.site_id
AND   ad.carrier(+)         = rs.carrier
AND   dt.site_id(+)         = rs.site_id
AND   dt.carrier(+)         = rs.carrier
AND   dc.db_item(+)         = 'ALLOW_TAG_PRINTING'
AND   af.site_id(+)         = rs.site_id
AND   af.carrier(+)         = rs.carrier
AND   ca.agent_code         = tu.agent_code
AND   ca.airline_alpha_code = rs.carrier
AND   cs.site_id            = rs.site_id
AND   cs.alpha_code         = rs.carrier
AND   cs.config_item        = 'REFLIGHTING'
/
