;** Or_0130 ********************************************************************
;** Imprime a Digitacao do Orcamento                        ** GW ENTRETELAS **       *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 02/07/98 por Anivel Augusto Rodrigues
;Alterado em     : 09/05/06 por Beatriz K. Felicio
;Motivo Alteracao: Nome cliente
;Alterado em     : 29/06/2006 por Antonio Marcelo Alves
;Motivo Alteracao: Inclusao ImpriArq()
;Ultima Alteracao: 14/08/2007 por Antonio Marcelo Alves
;Motivo Alteracao: Ajustes Deleta_Arquivo

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPORC()

Moveto "Orcac"
;************************* IMPRESSAO DO CABECALHO *****************************
If Not IsAssigned(NOMEMPRESA)
   Then NOMEMPRESA=""
EndIf

Print File ARQIMP ASP1+CI_10CPP+"-------------------------------------------------------------------------------"+ASP2+"\n\n"
Print File ARQIMP ASP1+CI_IEXP
Print File ARQIMP Spaces(10)+ "GW ENTRETELAS LTDA"+ASP2+"\n"
Print File ARQIMP ASP1+CI_FEXP
Print File ARQIMP CI_15CPP
Print File ARQIMP Spaces(27)+ "  Al.Rio Paranaiba, 440 - Tiete -  Divinopolis - Telefax: (037) 3221-7066"+ASP2+"\n\n"
Print File ARQIMP ASP1+CI_10CPP
Print File ARQIMP CI_IEXP
Print File ARQIMP  "      ORCAMENTO"+Spaces(07)
Print File ARQIMP "N§: " + Format("W06.3,AL",[Numero do Orcamento]) +ASP2+"\n\n"
Print File ARQIMP ASP1+CI_10CPP

Print File ARQIMP "  Emissao: "+Format("D13",[Data de Emissao])+Spaces(01)
Print File ARQIMP "Vendedor: "+Format("W21,AL",[Nome Fantasia Represent])
Print File ARQIMP "Validade: "+Format("D13",[Data de Validade])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(02)+"Cliente: "
Print File ARQIMP Format("W05,AL",[Codigo])
Print File ARQIMP Format("W35,AL",[Razao Social])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(11)+Format("W40,AL",[Endereco])
Print File ARQIMP Format("W20,AL",[Bairro])+Spaces(2)+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(11)+Format("W20,AL",[Cidade])+Spaces(2)
Print File ARQIMP Format("W10,AL",[CEP])+Spaces(2)
Print File ARQIMP Format("W2,AL",[UF])+Spaces(2)
Print File ARQIMP Format("W15,AL",[Telefone])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(11)+Format("W20,AL",[CGC])+Spaces(2)
Print File ARQIMP Format("W15,AL",[IE])+ASP2+"\n"

;********************* IMPRESSAO DOS ITENS ********************************
Moveto "OrcaI"
Print File ARQIMP ASP1+"--------------------------------------------------------------------------------"+ASP2+"\n"
Print File ARQIMP ASP1+" Qtdade Un Codigo     Descricao                              Unitario      Total"+ASP2+"\n"
Print File ARQIMP ASP1+"------- -- ---------- ------------------------------------ ---------- ----------"+ASP2+"\n"
N_ITEM=0
Scan
   Print File ARQIMP ASP1+Format("W07,EIC",[Quantidade])+Spaces(01)
   Print File ARQIMP Format("W03,AL",[Unidade Fiscal])
   Print File ARQIMP Format("W11,AL",[Codigo do Item])
   Print File ARQIMP Format("W36,AL",[Descricao do Item])
   Print File ARQIMP Format("W11.2,EIC",[Preco Unitario])
   Print File ARQIMP Format("W11.2,EIC",[Preco Total])+ASP2+"\n"
   N_ITEM=N_ITEM+1
EndScan
While N_ITEM<6
  Print File ARQIMP ASP1+ASP2+"\n"
  N_ITEM=N_ITEM+1
EndWhile

Print File ARQIMP ASP1+Spaces(62)+"Total.."+Format("W11.2,EIC",[OrcaC->Valor Nota Fiscal])+ASP2+"\n"
Print File ARQIMP ASP1+ "-------------------------------------------------------------------------------"+ASP2+"\n"

Moveto"OrcaCPG"
Print File ARQIMP ASP1+CI_IEXP
Print File ARQIMP "       CONDICOES  DE  PAGAMENTOS  "+ASP2+"\n"
Print File ARQIMP ASP1+CI_FEXP
Print File ARQIMP CI_10CPP
Scan
  Print File ARQIMP Spaces(20)+Format("W20,AL",[Descricao CondPagto])
  Print File ARQIMP " Vr Total: "+Format("W11.2,EIC",[Orcac->Valor Nota Fiscal]+(([Orcac->Valor Nota Fiscal]*[Taxa Financeira])/100))+ASP2+"\n"
EndScan

Moveto "Orcac"
Print File ARQIMP ASP1+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+"Obs: "
Print File ARQIMP Format("W75,AL",SubStr([Observacao do Orcamento],001,75))
Print File ARQIMP Format("W75,AL",SubStr([Observacao do Orcamento],076,75))+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(02)+"                     -   /   /   "+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+"---------------------------------"+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+"   Assinatura/Data do Cliente"+ASP2+"\n"

Print File ARQIMP ASP1+ASP2+"\n"
Print File ARQIMP ASP1+CI_10CPP
Print File ARQIMP CI_6LPP+ASP2

EndProc

;*******************************************************************************
;* Rotina Principal                                                            *
;*****************+*************************************************************
ArqImp=PrivDir()+"Or_0130.Txt"
ASP1=""
ASP2=""
Switch
  Case OK="A":
       ARQIMP = DIREPORT+ARQUIVO+".TXT"
  Case OK="V": ASP1="\""
               ASP2="\""
EndSwitch
If IsFile(ArqImp)
   Then Deleta_Arquivo(ARQIMP)
EndIf
IMPORC()
If OK="V"
  Then Tabela=Cria_Temp("\\Sistemas\\Compras\\")
       {Tools} {Copy} {Table} {\\Base\\Sistemas\\Compras\\Rm_tx250} TypeIn Tabela Enter
       {Tools} {ExportImport} {Import} {ASCII} {AppendDelimited} TypeIn ARQIMP Enter
       TypeIn Tabela Enter ClearImage
       IMPRIREL(Tabela,"R")
       Deleta_Arquivo(ARQIMP)
       Delete Tabela
       View "P_Orca"
       View "OrcaI"
       CoEdit "OrcaC"
   Else If OK="I" then
           AGUARDE("Imprimindo Orcamento-> "+ORCA)
;---- Imprime Arquivo Impressao ------------------------------------------------
ImpriArq(ARQIMP)

           Mensagem ("Impress„o Concluida!")
       Else Mensagem ("Arquivos gerados!")
     EndIf
EndIf
Release Vars VALOR,DATA,CLIENTE
Release Procs IMPORC



