;** Rm_0022  *******************************************************************
;* Relacao de Of nÆo faturadas para o reprocessamento                          *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 27/03/2013 por Kamila Gomes
;Ultima Alteracao:   /  /     por               
;Motivo Alteracao: 
          

;*******************************************************************************
;* Rotina p/ Selecionar e Ordernar Registros                                   *
;*******************************************************************************
Proc Seleciona()
ClearAll

{Ask} TypeIn "\\Sistemas\\Vendas\\FaturaC" Enter Check
Moveto [Codigo da Empresa      ] TypeIn "~VSDGEMPRESA.."
Moveto [Data de Emissao        ] TypeIn "<=~VSDGDTFIM"
Moveto [Numero Nota Gerada     ] TypeIn "Blank"

Do_It!
ClearAll

EndProc   ; (Seleciona)

;*******************************************************************************
;* Rotina Ajusta Dados                                                         *
;*******************************************************************************
Proc Ajusta_Dados()
ClearAll


NDOCTO="****"
CoEdit "Answer"
Scan
 If [Numero da OF]<>NDOCTO 
    Then NDOCTO=[Numero da OF       ]
    Else [Valor Nota Fiscal]=BlankNum()
 EndIf
EndScan
Do_It!
ClearAll

EndProc


;*******************************************************************************
;* ROTINA PRINCIPAL                                                            *
;*******************************************************************************
AutoLib="\\Sistemas\\Cadastro\\Bib_Show,\\Sistemas\\Cadastro\\Bibliot,\\Sistemas\\Cadastro\\Bib_Proc"
LimpAguarde()


  AGUARDE("Aguarde, gerando o relat¢rio")
  
  Seleciona()
  If IsEmpty("Answer") 
   Then ClearImage
        Mensagem("N„o Existem Registros a Processar")
        Return 
  EndIf 
  Ajusta_Dados()

  DISPOSITIVO()
  If OK=""
     Then IMPRELOF=False
          Return 
  EndIf
  
  AGUARDE("Aguarde, Gerando o Relat¢rio")
  Tabela=Cria_Temp(PrivDir()) 
  
  If IsTable(Tabela)
     Then Add "Answer" Tabela
     Else Rename "Answer" Tabela
  EndIf

 CopyReport "\\Base\\Sistemas\\Vendas\\Rm_2002" "1" Tabela "R"


  IMPRIREL(Tabela,"R")



