Codice PHP:
Function Corpo()
'INIZIO LOOP RIGHE FATTURA
Do While Not RSriga.EOF
' ### SEGNO #######
If RSriga("fttr_segno") = 0 Then
Segno = ""
pdf.SetTextColor 0,0,0
Else
Segno = "- "
pdf.SetTextColor 255,0,0
End If
'codice
If RSriga("fttr_id_prodotto") > 0 Then
If Len(RSriga("fttr_id_prodotto")) < 5 Then
pdf.Cell 10,6,String(5 - Len(RSriga("fttr_id_prodotto")), chr(160)) & RSriga("fttr_id_prodotto"),"L",0
Else
pdf.Cell 10,6,RSriga("fttr_id_prodotto"),"L",0
End If
Else
pdf.Cell 10,6,"","L",0
End If
'quantità
If RSriga("fttr_qtt") > 0 AND VediTesto(RSriga("fttr_dsc")) <> "SCONTO" AND VediTesto(RSriga("fttr_dsc")) <> "SPESE SPEDIZIONE" Then
pdf.Cell 10,6,String(5 - Len(FormatNumber(RSriga("fttr_qtt"), 0)), chr(160)) & FormatNumber(RSriga("fttr_qtt"), 0),"L",0
Else
pdf.Cell 10,6,"","L",0
End If
'x e y recupero la posizione iniziale della multicella
x=pdf.GetX()
y=pdf.GetY()
w = 127
'descrizione
If Len(VediTestoPDF(RSriga("fttr_dsc"))) > 73 Then
pdf.MultiCell w,6,Mid(VediTestoPDF(RSriga("fttr_dsc")), 1, 70) & "...","LR","J"
Else
pdf.MultiCell w,6,VediTestoPDF(RSriga("fttr_dsc")),"LR","J"
End If
'y2 recupero la posizione finale della multicella
y2=pdf.GetY()
'stampo una serie di righe vuote solo con il bordo sinistro sotto a n° SOLO SE USATA MULTICELLA
If y+6 < y2 Then
For ix = y To y2-6 Step 6
pdf.SetXY x-15,ix
pdf.Cell 15,6,"","L",0
Next
End If
'stampo una serie di righe vuote solo con i bordi fino alla fine della scritta nella multicella
'(y2-6 [-6 perchè è l'altezza della linea])
If y+6 < y2 Then
For ix = y To y2-6 Step 6
pdf.SetXY x+w,ix
pdf.Cell 17,6,"","R",0
pdf.Cell 8,6,"","R",0
pdf.Cell 18,6,"","R",1
Next
End If
'imposto la posizione finale della multicella (-6 per tornare allineato all'ultima riga della multicella
pdf.SetXY x+w,y2-6
'Importo
If RSriga("fttr_imp") <> 0 Then
pdf.Cell 17,6,String(9 - Len(FormatNumber(VisualizzaPrezzo(RSriga("fttr_imp")), 2,,,-1) & Segno), chr(160)) & Segno & FormatNumber(VisualizzaPrezzo(RSriga("fttr_imp")), 2,,,-1),"R",0
Else
pdf.Cell 1,6,"(","L",0
pdf.SetTextColor 255,0,0
pdf.Cell 1,6,"*","",0
pdf.SetTextColor 0,0,0
pdf.Cell 1,6,")","",0
pdf.Cell 14,6,"0","R",0,"R"
Asterisco = "S"
End If
'% IVA
If RSriga("fttr_imp") <> 0 Then
pdf.Cell 8,6," " & PercIvaVendita,"R",0
Else
pdf.Cell 8,6," 0","R",0
End If
'imponibile
If RSriga("fttr_imp_tt") <> 0 Then
pdf.Cell 18,6,String(9 - Len(FormatNumber(VisualizzaPrezzo(RSriga("fttr_imp_tt")), 2,,,-1) & Segno), chr(160)) & Segno & FormatNumber(VisualizzaPrezzo(RSriga("fttr_imp_tt")), 2,,,-1),"R",1
Else
pdf.Cell 18,6,String(8, chr(160)) & "0","R",1
End If
'dimonuisco di 1 il numero delle righe
NumeroRigheFattura = NumeroRigheFattura - 1
'verifico se fare il saltopagina
y=pdf.GetY()
If (y > 230 AND NumeroRigheFattura > 0 AND Asterisco = "") OR _
(y > 224 AND NumeroRigheFattura > 0 AND Asterisco = "S") Then
NumeroPagina = NumeroPagina + 1
SaltoPagina()
Testa()
End If
RSriga.MoveNext
Loop
Totali Asterisco
End Function