Página 1 de 1

Alerta SefazClass - DANFE

Enviado: 20 Nov 2016 15:15
por JoséQuintas
Ainda em andamento a mudança para expandir opções de layout.

Tenho testado apenas o Danfe normal, sem coluna desconto, mas é pra estar funcionando pra qualquer dos layouts pré-existentes.

Quem puder testar pra Danfe paisagem e Danfe com coluna Desconto.
Note que a configuração pra coluna desconto mudou.

Código: Selecionar todos

https://github.com/JoseQuintas/sefazclass/commit/5f68ae298c94538e6cd8ced41fc72ca45f9f7e0e
Trata-se apenas de transformar os três fontes de três layout, em um único fonte pra qualquer layout.
Atendendo os layouts atuais, significa que atende qualquer layout.
Mas por enquanto o importante é que atenda o que já existe, o que já significa estar funcionando pra qualquer layout.
Não adianta querer layout diferente agora, porque tem partes ainda fixas.

Alerta SefazClass - DANFE

Enviado: 20 Nov 2016 19:38
por JoséQuintas
UIA
danfe.png
Tá igual antes?
Visualmente sim.

O fonte não conhece mais aonde fica cada coluna pra fazer os desenhos.

Código: Selecionar todos

   hbNFe_Box_Hpdf(      ::oPdfPage, ::aLayout[ LAYOUT_VALUNI,    LAYOUT_COLUNAPDF ] - 1, ::nLinhaPdf - 13, ::aLayout[ LAYOUT_VALUNI,    LAYOUT_LARGURAPDF ], 13, ::nLarguraBox )
   hbNFe_Box_Hpdf(      ::oPdfPage, ::aLayout[ LAYOUT_VALTOT,    LAYOUT_COLUNAPDF ] - 1, ::nLinhaPdf - 13, ::aLayout[ LAYOUT_VALTOT,    LAYOUT_LARGURAPDF ], 13, ::nLarguraBox )
   IF ::aLayout[ LAYOUT_DESCONTO, LAYOUT_IMPRIME ]
      hbNFe_Box_Hpdf(   ::oPdfPage, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_COLUNAPDF ] - 1, ::nLinhaPdf - 13, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_LARGURAPDF ], 13, ::nLarguraBox )
   ENDIF
   hbNFe_Box_Hpdf(      ::oPdfPage, ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_COLUNAPDF ] - 1, ::nLinhaPdf - 13, ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_LARGURAPDF ], 13, ::nLarguraBox )
   hbNFe_Box_Hpdf(      ::oPdfPage, ::aLayout[ LAYOUT_ICMVAL,    LAYOUT_COLUNAPDF ] - 1, ::nLinhaPdf - 13, ::aLayout[ LAYOUT_ICMVAL,    LAYOUT_LARGURAPDF ], 13, ::nLarguraBox )
   IF ::aLayout[ LAYOUT_SUBBAS, LAYOUT_IMPRIME ]
      hbNFe_Box_Hpdf(   ::oPdfPage, ::aLayout[ LAYOUT_SUBBAS,    LAYOUT_COLUNAPDF ] - 1, ::nLinhaPdf - 13, ::aLayout[ LAYOUT_SUBBAS,    LAYOUT_LARGURAPDF ], 13, ::nLarguraBox )
   ENDIF
O fonte não conhece mais aonde fica cada coluna pra fazer os títulos

Código: Selecionar todos

   hbNFe_Texto_hpdf(    ::oPdfPage, ::aLayout[ LAYOUT_VALUNI,    LAYOUT_COLUNAPDF ], ::nLinhaPdf - 6, ::aLayout[ LAYOUT_VALUNI,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_VALUNI,    LAYOUT_LARGURAPDF ] - 2, NIL, "UNITÁRIO", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
   hbNFe_Texto_hpdf(    ::oPdfPage, ::aLayout[ LAYOUT_VALTOT,    LAYOUT_COLUNAPDF ], ::nLinhaPdf - 1, ::aLayout[ LAYOUT_VALTOT,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_VALTOT,    LAYOUT_LARGURAPDF ] - 2, NIL, "VALOR TOTAL", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
   IF ::aLayout[ LAYOUT_DESCONTO, LAYOUT_IMPRIME ]
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_COLUNAPDF ], ::nLinhaPdf - 1, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_LARGURAPDF ] - 2, NIL, "VALOR", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_COLUNAPDF ], ::nLinhaPdf - 6, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_LARGURAPDF ] - 2, NIL, "DESCTO.", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
   ENDIF
   hbNFe_Texto_hpdf(    ::oPdfPage, ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_COLUNAPDF ], ::nLinhaPdf - 1, ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_LARGURAPDF ] - 2, NIL, "B. CÁLC.", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
   hbNFe_Texto_hpdf(    ::oPdfPage, ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_COLUNAPDF ], ::nLinhaPdf - 6, ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_ICMBAS,    LAYOUT_LARGURAPDF ] - 2, NIL, "DO ICMS", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
   hbNFe_Texto_hpdf(    ::oPdfPage, ::aLayout[ LAYOUT_ICMVAL,    LAYOUT_COLUNAPDF ], ::nLinhaPdf - 1, ::aLayout[ LAYOUT_ICMVAL,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_ICMVAL,    LAYOUT_LARGURAPDF ] - 2, NIL, "VALOR", HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
O fonte não conhece mais coluna nem tamanho dos campos, e nem mesmo quantas decimais vai ter

Código: Selecionar todos

      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_CFOP,        LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_CFOP,      LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_CFOP,      LAYOUT_LARGURAPDF ] - 2, NIL, ::aItem[ "CFOP" ], HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_UNIDADE,     LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_UNIDADE,   LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_UNIDADE,   LAYOUT_LARGURAPDF ] - 2, NIL, ::aItem[ "uCom" ], HPDF_TALIGN_CENTER, ::oPdfFontCabecalho, 6 )
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_QTD,         LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_QTD,       LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_QTD,       LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val(::aItem[ "qCom" ] ), 15, ::aLayout[ LAYOUT_QTD, LAYOUT_DECIMAIS ] ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 5 )
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_VALUNI,      LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_VALUNI,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_VALUNI,    LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val(::aItem[ "vUnCom" ] ), 15, ::aLayout[ LAYOUT_VALUNI, LAYOUT_DECIMAIS ] ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 6 )
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_VALTOT,      LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_VALTOT,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_VALTOT,    LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val(::aItem[ "vProd" ] ), 15, 2 ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 6 )
      IF ::aLayout[ LAYOUT_DESCONTO, LAYOUT_IMPRIME ]
         hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_DESCONTO, LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_DESCONTO,  LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val( ::aItem[ "vDesc" ] ), 15, 2 ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 6 )
      ENDIF
Também não sabe se vai ter coluna de IPI

Código: Selecionar todos

      IF ::aLayout[ LAYOUT_IPIVAL, LAYOUT_IMPRIME ]
         hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_IPIVAL,      LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_IPIVAL,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_IPIVAL,    LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val( iif( ::aItemIPI[ "vIPI" ] <> NIL,::aItemIPI[ "vIPI" ], "0" ) ), 15, 2 ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 6 )
      ENDIF
      hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_ICMALI,      LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_ICMALI,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_ICMALI,    LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val( iif( ::aItemICMS[ "pICMS" ] <> NIL,::aItemICMS[ "pICMS" ], "0" ) ), 15, 2 ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 6 )
      IF ::aLayout[ LAYOUT_IPIALI, LAYOUT_IMPRIME ]
         hbNFe_Texto_hpdf( ::oPdfPage, ::aLayout[ LAYOUT_IPIALI,      LAYOUT_COLUNAPDF ], ::nLinhaPdf, ::aLayout[ LAYOUT_IPIALI,    LAYOUT_COLUNAPDF ] + ::aLayout[ LAYOUT_IPIALI,    LAYOUT_LARGURAPDF ] - 2, NIL, AllTrim( FormatNumber( Val( iif( ::aItemIPI[ "pIPI" ] <> NIL,::aItemIPI[ "pIPI" ], "0" ) ), 15, 2 ) ), HPDF_TALIGN_RIGHT, ::oPdfFontCabecalho, 6 )
      ENDIF
Baseado no conteúdo do XML, decide decimais e IPI

Código: Selecionar todos

   ::aLayout[ LAYOUT_QTD, LAYOUT_DECIMAIS ]     := 0
   ::aLayout[ LAYOUT_VALUNI, LAYOUT_DECIMAIS ]  := 2
   nItem      := 1
   DO WHILE .T.
      IF ! ::ProcessaItens( ::cXml, nItem )
         EXIT
      ENDIF
      nItem += 1
      ::aLayout[ LAYOUT_QTD,    LAYOUT_DECIMAIS ] := ::DefineDecimais( ::aItem[ "qCom" ],   ::aLayout[ LAYOUT_QTD,    LAYOUT_DECIMAIS ] )
      ::aLayout[ LAYOUT_VALUNI, LAYOUT_DECIMAIS ] := ::DefineDecimais( ::aItem[ "vUnCom" ], ::aLayout[ LAYOUT_VALUNI, LAYOUT_DECIMAIS ] )
      IF Val( ::aItemIPI[ "pIPI" ]  ) > 0 .OR. Val( ::aItemIPI[ "vIPI" ] ) > 0
         ::aLayout[ LAYOUT_IPIVAL, LAYOUT_IMPRIME ] := .T.
         ::aLayout[ LAYOUT_IPIALI, LAYOUT_IMPRIME ] := .T.
      ENDIF
   ENDDO
E o mesmo XML, já omitindo as colunas de IPI por não existir IPI no Xml.
danfe2.png
Nota: no meio de 242 itens, tem um único ítem que usa 3 decimais, também me pareceu que estava errado... rs

Alerta SefazClass - DANFE

Enviado: 21 Nov 2016 10:48
por JoséQuintas
Faltava o toque final: enxugar código....
Agora sim.

Todos os desenhos do quadro de produtos em duas linhas (talvez dê pra reduzir pra uma):

Código: Selecionar todos

   Eval( ::aLayout, { | o | ::DrawBoxProduto( o[ 1 ], ::nLinhaPdf - 13, 13 ) } )
   Eval( ::aLayout, { | o | ::DrawBoxProduto( o[ 1 ], nLinhaFinalProd, nAlturaQuadroProdutos ) } )

Alerta SefazClass - DANFE

Enviado: 21 Nov 2016 11:25
por Itamar M. Lins Jr.
Ola!
Já viu NFE impressa em 60 colunas ? Imprime em paisagem depois corta e grampeia!!!

Saudações,
Itamar M. Lins Jr.

Alerta SefazClass - DANFE

Enviado: 21 Nov 2016 14:13
por JoséQuintas
Não, muito menos no manual da NFE dizer que isso é válido.

Alerta SefazClass - DANFE

Enviado: 21 Nov 2016 14:16
por JoséQuintas
danfe.png

Alerta SefazClass - DANFE

Enviado: 21 Nov 2016 14:21
por JoséQuintas
Tem esta exceção, com uso de formulário de ate 5.5 cm de largura.
danfe2.png

Alerta SefazClass - DANFE

Enviado: 21 Nov 2016 23:56
por JoséQuintas
Uia, agora cabem minhas observações.
Cheguei a fazer um teste com 3 páginas de informações adicionais, só pra confirmar a contagem de páginas.
obsgrande.png

Alerta SefazClass - DANFE

Enviado: 07 Set 2017 13:59
por Itamar M. Lins Jr.
Ola!
Atualizando, NFe em 60col ou 55mm.
nfe_ImpressoraEmissao.jpg
Saudações,
Itamar M. Lins Jr.