-- ============================================================
--   DBMS NAME:      ORACLE VERSION 7.X
--   CREATED ON:     25/08/97  10:22
--   PROGRAMADOR:    LEANDRO AUGUSTO
-- ============================================================

-- ============================================================
--   VIEW: MANUAL_SERVICOMA1
-- ============================================================
CREATE OR REPLACE VIEW MANUAL_SERVICOMA1
(CDMANCIA, CDCIA, SGCIA, NMCIA, CDFILIAL, NMFILIAL, CDSERVICO, CDCLASSE,
 CDCICLO,DSSERVICO, DSSERVIN, DSSERVES,CDEXTSE, IDSERVICO, TPMANUAL,
 TXCOMENTASE, CDSUBGRU, DSSUBGRU, DSSUBGRUIN, DSSUBGRUES,
 TXCOMENTASUB, PELOADING, /*NRPROPAX,*/ TIPO, CDITEM, SGUNIDADE,
 NMITEM, NMITEMIN, NMITEMES, DSUNIDADE, QTPADRAO) AS
  SELECT
    SERVMANUAL.CDMANCIA, COMPANHIA.CDCIA, COMPANHIA.SGCIA, COMPANHIA.NMCIA,
    FILIAL.CDFILIAL, FILIAL.NMFILIAL, SERVICOCIA.CDSERVICO,
    SERVMANUAL.CDCLASSE, SERVMANUAL.CDCICLO, SERVICOCIA.DSSERVICO,
    SERVICOCIA.DSSERVIN, SERVICOCIA.DSSERVES, SERVICOCIA.CDEXTSE,
    SERVICOCIA.IDSERVICO, SERVICOCIA.IDTIPMANUAL, SERVICOCIA.TXCOMENTASE,
    SUBGRUSEMA.CDSUBGRU, SUBGRUPO.DSSUBGRU, SUBGRUPO.DSSUBGRUIN,
    SUBGRUPO.DSSUBGRUES, SUBGRUSEMA.TXCOMSUMA,
    SUBGRUSEMA.VRPELOADSUMA, /*SUBGRUSEMA.NRPROPAXSUMA,*/
    'R', RECSUBSEMA.CDRECEITA, RECEITA.SGUNIDADE,
    RECEITA.DSRECEITA, RECEITA.DSRECIN, RECEITA.DSRECES,
    UNIDMEDIDA.DSUNIDADE, RECSUBSEMA.QTRECSUMA
  FROM COMPANHIA, SERVICOCIA, SUBGRUPO, SUBGRUSEMA,
       RECSUBSEMA, RECEITA, UNIDMEDIDA, SERVMANUAL, FILIAL
  WHERE SERVMANUAL.CDCIA     = COMPANHIA.CDCIA        AND
        SERVICOCIA.CDCIA     = SERVMANUAL.CDCIA       AND
        SERVMANUAL.CDFILIAL  = FILIAL.CDFILIAL        AND
        SERVMANUAL.CDFILIAL  = SUBGRUSEMA.CDFILIAL    AND
        SERVMANUAL.CDFILIAL  = RECSUBSEMA.CDFILIAL    AND
        SERVICOCIA.CDSERVICO = SERVMANUAL.CDSERVICO     AND
        SERVICOCIA.CDSERVICO = SUBGRUSEMA.CDSERVICO     AND
        SUBGRUSEMA.CDCIA     = SERVMANUAL.CDCIA         AND
        SUBGRUSEMA.CDMANCIA  = SERVMANUAL.CDMANCIA      AND
        SUBGRUSEMA.CDSUBGRU  = SUBGRUPO.CDSUBGRU        AND
        SUBGRUSEMA.CDSERVICO = RECSUBSEMA.CDSERVICO(+)  AND
        SUBGRUSEMA.CDSUBGRU  = RECSUBSEMA.CDSUBGRU (+)  AND
        SERVMANUAL.CDCIA     = RECSUBSEMA.CDCIA         AND
        SERVMANUAL.CDMANCIA  = RECSUBSEMA.CDMANCIA      AND
        RECSUBSEMA.CDRECEITA = RECEITA.CDRECEITA (+)    AND
        RECEITA.SGUNIDADE    = UNIDMEDIDA.SGUNIDADE (+) AND
        ((SERVICOCIA.IDTIPMANUAL = '1') OR
        (SERVICOCIA.IDTIPMANUAL = '2'))
/
