Code: Select all
for nPos := 1 to Form_Novo_Orcamento.Grid_1.ItemCount && pega o total de item na grid
aLinha := GetProperty ( 'Form_Novo_Orcamento' , 'Grid_1' , 'ITEM' , nPos )
cDescricao := Alltrim(aLinha [2]) + " " + Alltrim(aLinha [3]) + " " + Alltrim(aLinha [11]) + " " + Alltrim(aLinha [8]) + " Marca " + Alltrim(aLinha [7])
nCharacters := LEN(Alltrim(cDescricao)) // altrim retirar espaçoas em branco da variavel
nLinhas := nCharacters / 60
nResto := (nCharacters % 60) // resto da divisão por 60
if nLinhas < 1
nDesc_size := 5
elseif nResto != 0 .and. nLinhas > 1
nDesc_size := (1 + int(nLinhas)) * 5
elseif nResto == 0 .and. nLinhas > 1
nDesc_size := nLinhas * 5
endif
msgdebug(LEN(Alltrim(cDescricao)),"-",Alltrim(cDescricao) )
msgdebug(nCharacters)
msgdebug(nLinhas)
msgdebug(nResto)
msgdebug(nDesc_size)
@ F, 13 HPDFPRINT Alltrim(STR(npos)) FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA ITEM
@ F, 25 HPDFPRINT Alltrim(aLinha [4]) FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA ITEM
@ F, 35 HPDFPRINT cDescricao to F+nDesc_size, 150 FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
IF Form_Novo_Orcamento.Check_4.Value == .F.
@ F, 155 HPDFPRINT MoedaMysql(VAL(Alltrim(aLinha [5]))) FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
@ F, 180 HPDFPRINT MoedaMysql(VAL(Alltrim(aLinha [6]))) FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
nTotal_material := nTotal_material + val(aLinha [6])
else
@ F, 155 HPDFPRINT Alltrim("0,00") FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
@ F, 180 HPDFPRINT Alltrim("0,00") FONT cFonte1 size nFonte_size1 COLOR { 0, 0, 0 } // COLUNA DESCRIÇÃO
nTotal_material := 0
ENDIF
F:= IIF(nDesc_size > 5 , F + nDesc_size, F+5)
next