ALIAS se_movnf

VARIAVEL #TEXTO_FONTE
   Private zDe:=Date(), zAte:=Date(), zMatric:=0

   if .not. QuickDialog("Lst_SeMovNfConsumos", "Parametros", ;
        {{"Data Inicial:", "@zDe", @zDe, "99.99.9999", "", ""},;
         {"Data Final..:", "@zAte", @zAte, "99.99.9999", "", ""},;
         {"Solicitante.:", "@zMatric", @zMatric, "9999", "", ""} })
      Return
   endif

   Abra('0NOIDX', r_siga, 'fp_ptfun', 'fp_ptfun', 'fp_ptfun', 'FNUMERO')
   Abra("0NOIDX",r_siga,"se_prod","se_prod","seip_c","pcod")
   DbSelectArea("se_movnf")
   DbGoTop()

   oLst:lOutputFr3 := .f.
   oLst:cTemplateFr3 := 'skel_' + 'ListaComGrp' +'.fr3'
   oLst:lPortrait  := .t.

   oLst:cAlias_DataCols := '_lstmov'
   oLst:cAliasMaster := oLst:cAlias_DataCols
   oLst:SetDbLst('mem:_lstmov')

   oLst:Cab1( "Consumos do Periodo "+Dtoc(zDe)+" ate "+Dtoc(zAte) )
   oLst:AddCab( {"style"=>"font:Helvetica#size:11", "COLS"=>"0,C"}, 'Emitida em ' + dtoc (s_datual) + ' `as ' + time () + ' horas')
   oLst:AddCab( '_LINHA_FINA_' )
   oLst:AddCab( '_CABCOLS_' )
   oLst:AddCab( '_LINHA_GROSSA_' )

   oLst:AddCol('Data;mData;D;99.99.9999;10;;')
   oLst:AddCol('Produto;se_prod->(dbseek(se_movnf->pCod),pdesc);P;@S30;30;;')
   oLst:AddCol('Quant;mQuant;N;999999.999;10;S;;Direita;NaoSome;')
   oLst:AddCol('Un;se_prod->pUNIDADE;P;XXX;3;;')
   oLst:AddCol('Valor;mValor;N;99999999.99;12;S;;Direita;Some;')
   oLst:AddCol('Funcionario;StrZero(FNUMERO,4)+"-"+fp_ptfun->(dbseek(se_movnf->FNUMERO),fnome);P;@S30;30;S;')
   oLst:AddCol('cProd;Pcod;N;999999;6;;;')
   // oLst:AddCol('l;mFgEs;C;X;1;;')
   // oLst:AddCol('*;if(mTipoVen="C","Cancelado","");P;@S9;9;;')

   oLst:AddRodape( '_LINHA_FINA_', "", {|| "Pagina "+Str(++pag,4)+" / ####"} )

   se_movnf->( DbSetFilter({||mFgEs="S".and.(FNUMERO>0.and.(zMatric=0.or.FNUMERO=zMatric)).and.mData>=zDe.and.mData<=zAte.and.mfnum=0.and.fnumped=0.and.val(pCfop)=0},'mFgEs="S".and.FNUMERO>0.and.mData>=zDe.and.mData<=zAte.and.mfnum=0.and.fnumped=0.and.val(pCfop)=0'),  DbGoTop(), oLst:DbEval() )

   se_movnf->( DbGoTop(), oLst:DbEval() )

   fp_ptfun->(DbCloseArea())
   se_prod->(DbCloseArea())

   oLst:SetFormatSomaCol(2, {||"** Valor das Saidas:"})
   oLst:PrtD('_LINHA_FINA_', {"style"=>"font:Courier-BoldOblique"}, '_SOMACOLS_')

   debugalert('vai run ...')
   oLst:Run()
   oLst:End()

   debugalert('5')

#FIM_TEXTO_FONTE