UIA
Tá igual antes?
Visualmente sim.
O fonte não conhece mais aonde fica cada coluna pra fazer os desenhos.
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
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
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
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
::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.
Nota: no meio de 242 itens, tem um único ítem que usa 3 decimais, também me pareceu que estava errado... rs