;** Or_0037b *******************************************************************
;** Grava a Digitacao do Orcamento                        ** UNITEC **         *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 02/07/1998 por Anivel Augusto Rodrigues
;Alterado em     : 11/07/2003 por Karen Lauar Nery
;Motivo Alteracao: Mudanca Arqimp
;Ultima Alteracao: 14/08/2007 por Antonio Marcelo Alves
;Motivo Alteracao: Ajustes Deleta_Arquivo

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

ARQIMP="\\Sistemas\\Reports\\FAX.TXT"
If IsFile(ARQIMP)
   Then Deleta_Arquivo(ARQIMP)
EndIf

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

Print File ARQIMP "\n"
Print File ARQIMP "================================================================================"+"\n\n"
Print File ARQIMP  "                        UNITEC TELECOMUNICACOES LTDA"+"\n\n"
Print File ARQIMP  "  Av. Getulio Vargas, 151 - Centro -  Divinopolis - Telefax: (037) 222-6755"+"\n"
Print File ARQIMP  "  CGC 21.531.876/0001-34     IE 223.491710-0012"+"\n\n"
Print File ARQIMP  "                                   ORCAMENTO"+"\n\n"

Print File ARQIMP "N§: "
Print File ARQIMP Format("W06.3,AL",[Numero do Orcamento]) + Spaces(2)
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])+"\n\n"

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

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

Print File ARQIMP 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])+"\n"

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

;********************* IMPRESSAO DOS ITENS ********************************
Moveto "OrcaI"
Print File ARQIMP "================================================================================"+"\n"
Print File ARQIMP " Qtdade Un Codigo     Descricao                              Unitario      Total"+"\n"
Print File ARQIMP "------- -- ---------- ------------------------------------ ---------- ----------"+"\n"
Scan
   Print File ARQIMP 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])+"\n"
EndScan

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

Moveto"OrcaCPG"
Print File ARQIMP "                           CONDICOES  DE  PAGAMENTOS  "+"\n\n"
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))+"\n"
EndScan

Moveto "Orcac"
Print File ARQIMP "\n"
Print File ARQIMP 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))
Print File ARQIMP Format("W75,AL",SubStr([Observacao do Orcamento],151,75))+"\n\n"

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

;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************
AGUARDE("Gravando FAX Orcamento -> "+ORCA)
IMPORC()
Release Vars VALOR,DATA
Release Procs IMPORC
LIMPAGUARDE()

