;** Or_0012a ********************************************************************
;** Imprime Digitacao do Orcamento                        ** DEP. FLORESTA ** *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido  em: 18/06/2003 por Karen Lauar Nery
;Alterado em     : 13/04/2006 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes

;*******************************************************************************
;* Rotina para Impressao do Relatorio                                          *
;*******************************************************************************
Proc IMPORC()
Moveto "OrcaC"

;************************* IMPRESSAO DO CABECALHO *****************************
Print File ARQIMP ASP1+chr(27)+chr(67)+chr(33) ;Imprime 33 Linhas por pagina
Print File ARQIMP CI_15CPP
Print File ARQIMP CI_8LPP

Print File ARQIMP ASP2+"\n"

Print File ARQIMP ASP1+CI_FEXP
Print File ARQIMP Format("W59,AL","DEPOSITO FLORESTA - (37)3222-3999")+"ORCAMENTO N§ "+Format("W06.3,AL",[Numero do Orcamento])+ASP2+"\n\n"

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

Print File ARQIMP ASP1+Spaces(10)+Format("W40,AL",[Endereco])
Print File ARQIMP Format("W18,AL",[CGC])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(10)+Format("W20,AL",[Bairro])
Print File ARQIMP Format("W20,AL",[CEP])
Print File ARQIMP Format("W25,AL",[IE])+ASP2+"\n"

Print File ARQIMP ASP1+Spaces(10)+Format("W20,AL",[Cidade])
Print File ARQIMP Format("W20,AL",[UF])
Print File ARQIMP Format("W25,AL",[Telefone])+ASP2+"\n"

Print File ARQIMP ASP1+"Operacao: "
Print File ARQIMP ""+[Codigo da Destinacao]+" "+[Descricao da Destinacao]

Print File ARQIMP Spaces(04)+"Vendedor: "+Format("W05,AL",[Codigo do Representante])
Print File ARQIMP Format("W25,AL",[Nome Fantasia Represent])+ASP2+"\n"
Print File ARQIMP ASP1+CI_15CPP

;********************* IMPRESSAO DOS ITENS ********************************
Moveto "OrcaI"
CONTADOR = 0
TOT=0
Print File ARQIMP Spaces(02)+"-------------------------------------------------------------------------------------------"+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+"Un Item                                                Quantidade  Un PrUnitario    PrTotal"+ASP2+"\n"
Print File ARQIMP ASP1+Spaces(02)+"-- --------------------------------------------------- ----------- -- ---------- ----------"+ASP2+"\n"
CONTADOR = CONTADOR + 1

Scan
   Print File ARQIMP ASP1+Spaces(02)+Format("W03,AL",[Item do Orcamento])
   Print File ARQIMP Format("W11,AL",[Codigo do Item])
   Print File ARQIMP Format("W41,AL",[Descricao do Item])
   Print File ARQIMP Format("W11.3,EIC",[Quantidade])
   Print File ARQIMP Format("W03,AR",[Unidade Fiscal])
   Print File ARQIMP Format("W11.2,EIC",[Preco Unitario])
   Print File ARQIMP Format("W11.2,EIC",[Preco Total])+ASP2+"\n"
   TOT   = TOT + [Preco Total]
   CONTADOR = CONTADOR + 1
EndScan

Print File ARQIMP ASP1+Spaces(64)+"Total Vendas......."+Format("W11.2,EIC",TOT)+ASP2+"\n"

For ITEM From CONTADOR To 15
    Print File ARQIMP ASP1+ASP2+"\n"
EndFor
Print File ARQIMP ASP1+"-------------------------------------------------------------------------------------------------------------------------"+ASP2+"\n"

;********************* IMPRESSAO DOS TOTAIS **************************
Moveto "OrcaC"
Print File ARQIMP ASP1+"Desconto"+Format("W06.2,EIC",[Taxa de Desconto]) + "%"
Print File ARQIMP Format("W7.2,EIC",[Valor Desconto])

If [Frete Incluso na Nota]="+"
   Then Print File ARQIMP Spaces(02)+"Total do Frete.."+Format("W7.2,EIC",[Valor do Frete])
   Else Print File ARQIMP Spaces(02)+"Total do Frete.."+Format("W7.2,EIC",0)
EndIf

Moveto"Orcacpg"
Print File ARQIMP "   Cond. Pagto: "+[Descricao CondPagto]
Print File ARQIMP "   NP: "+StrVal([Numero de Parcelas])
Print File ARQIMP "   CD: "+[Composicao de Dias]
Print File ARQIMP " "+"Total Liquido.."+Format("W11.2,EIC",[Valor Nota Fiscal])+ASP2+"\n"

Moveto "Orcac"

;************************* IMPRESSAO DO RODAPE ********************************
Moveto "OrcaC"
Print File ARQIMP ASP1+Spaces(02)+"Observacao......: "+Format("W110,AL",SubStr([Observacao do Orcamento],001,110))+ASP2+"\n"
If Substr([Observacao do Orcamento],111,110)<>""
   Then Print File ARQIMP ASP1+Spaces(20)+Format("W110,AL",SubStr([Observacao do Orcamento],111,110))+ASP2+"\n"
EndIf
View "Numeronf"
Moveto "Numeronf"
 Locate [OrcaC->Codigo da Empresa],"ROM"
   If Retval
      Then Moveto [Mensagem]
           MENS=[]
      Else MENS=""
   EndIf

;************************* IMPRESSAO DO RODAPE *********************************
Print File ARQIMP ASP1+"* "+Format("W58,AL",SubStr(MENS,1,58))+"   "+"   /   /     -                                   " +ASP2+"\n"
Print File ARQIMP ASP1+"* "+Format("W58,AL",SubStr(MENS,59,58))+"   "+"----------------------------------------------------------" +ASP2+"\n"
Print File ARQIMP ASP1+"* "+Format("W58,AL",SubStr(MENS,117,58))+"   "+"                          Data e Assinatura"+ASP2+"\n"
Print File ARQIMP ASP1+CI_6LPP
Print File ARQIMP CI_10CPP
Print File ARQIMP "\f"+ASP2
EndProc

;*******************************************************************************
;* Rotina Principal                                                            *
;*******************************************************************************

Seta_FilePrint("OR_0012A")
IMPORC()
Imprime_FilePrint("Imprimindo Orcamento -> "+ORCA,"1")

Release Vars VALOR,DATA
Release Procs IMPORC,
              Seta_FilePrint, Imprime_FilePrint


