$pdf->Cell($tab[7], 7, 'Diff. Let.', 0, 0, 'R'); $pdf->ln(); $amount_deb = 0; $amount_cred = 0; $prog = 0; for ($i = 0; $i < count($letter->content); $i++) { if ($i % 2 == 0) { $pdf->SetFillColor(220, 221, 255); $fill = 1; } else { $pdf->SetFillColor(0, 0, 0); $fill = 0; } $pdf->SetFont('DejaVuCond', '', 7); $row = $letter->content[$i]; $str_date = shrink_date($row['j_date_fmt']); $pdf->LongLine($tab[0], 4, $str_date, 0, $align[0], $fill); $pdf->Cell($tab[1], 4, $row['jr_pj_number'], 0, 0, $align[1], $fill); $pdf->LongLine($tab[2], 4, $row['jr_internal'], 0, $align[1], $fill); $pdf->LongLine($tab[3], 4, $row['jr_comment'], 0, $align[2], $fill); if ($row['j_debit'] == 't') { $prog = bcadd($prog, $row['j_montant']); $pdf->Cell($tab[4], 4, sprintf('%s D', nbm($row['j_montant'])), 0, 0, $align[4], $fill); $amount_deb += $row['j_montant']; $str_prog = sprintf("%s %s", nbm(abs($prog)), $fic->get_amount_side($prog)); $pdf->Cell($tab[5], 4, $str_prog, 0, 0, $align[5], $fill); } else { $prog = bcsub($prog, $row['j_montant']); $pdf->Cell($tab[4], 4, sprintf('%s C', nbm($row['j_montant'])), 0, 0, $align[4], $fill); $amount_cred += $row['j_montant']; $str_prog = sprintf("%s %s", nbm(abs($prog)), $fic->get_amount_side($prog));
$solde_d = 0.0; $solde_c = 0.0; $pdf->Ln(); $pdf->SetFont('DejaVuCond', '', 7); } if ($detail['cred_montant'] > 0) { $solde = bcsub($solde, $detail['cred_montant']); $solde_c = bcadd($solde_c, $detail['cred_montant']); } if ($detail['deb_montant'] > 0) { $solde = bcadd($solde, $detail['deb_montant']); $solde_d = bcadd($solde_d, $detail['deb_montant']); } $i = 0; $side = " " . $Poste->get_amount_side($solde); $pdf->LongLine($width[$i], 6, shrink_date($detail['j_date_fmt']), 0, $lor[$i]); $i++; $pdf->LongLine($width[$i], 6, $detail['jr_internal'], 0, $lor[$i]); $i++; /* limit set to 40 for the substring */ $triple_point = mb_strlen($detail['description']) > 40 ? '...' : ''; $pdf->LongLine($width[$i], 6, mb_substr($detail['description'], 0, 40) . $triple_point, 0, $lor[$i]); $i++; $pdf->Cell($width[$i], 6, $detail['jr_pj_number'], 0, 0, $lor[$i]); $i++; $pdf->Cell($width[$i], 6, $detail['letter'] != -1 ? $detail['letter'] : '', 0, 0, $lor[$i]); $i++; $pdf->Cell($width[$i], 6, $detail['deb_montant'] > 0 ? nbm($detail['deb_montant']) : '', 0, 0, $lor[$i]); $i++; $pdf->Cell($width[$i], 6, $detail['cred_montant'] > 0 ? nbm($detail['cred_montant']) : '', 0, 0, $lor[$i]); $i++;