create or replace FUNCTION TRANSFERENCIA_OL
   (P_CDFILIAL   IN NOTAFISCAL.CDFILIAL%TYPE,
    P_NRLANCTOESTQ  IN  varchar2) RETURN VARCHAR2
AS
    V_CDFILIAL float;
    V_CDFILIRECE FLOAT;
    v_vrcust   float;
    V_RETURN   VARCHAR2(01);
begin
   begin
    select NF.CDFILIEMIT
      INTO V_CDFILIAL
      from lanctoestoq l, notafiscal nf
     where l.cdfilial   = P_CDFILIAL
       and l.NRLANCESTQ = P_NRLANCTOESTQ
       and l.cdfilial = nf.cdfilial
       and l.nrlanctonf = nf.nrlanctonf;
   EXCEPTION
    when no_data_found then
     V_CDFILIAL := 0;
   END;

   V_RETURN := 'N';	
   IF V_CDFILIAL IN ('3950','3951', '3952', '3953', '3954', '3955','3956','3957','3958','3959','3960') THEN
      V_RETURN := 'S';
   END IF;

   return(V_RETURN);
end;


