} 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));
     $pdf->Cell($tab[5], 4, $str_prog, 0, 0, $align[5], $fill);
 }
 if ($row['letter'] != -1) {
     $pdf->Cell($tab[6], 4, strtoupper(base_convert($row['letter'], 10, 36)), 0, 0, $align[6], $fill);
     // get sum for this lettering
     $pdf->Cell($tab[7], 4, sprintf('%s', nbm($row['letter_diff'])), '0', '0', $align[7], $fill);
 } else {
     $pdf->Cell($tab[6], 4, "", 0, 0, 'R', $fill);
 }
Example #2
0
     echo td($row['j_date_fmt']);
     echo td(h($row['jr_pj_number']));
     echo td(HtmlInput::detail_op($row['jr_id'], $row['jr_internal']));
     echo td(h($row['jr_comment']));
     if ($row['j_debit'] == 't') {
         echo td(nbm($row['j_montant']), ' style="text-align:right"');
         $amount_deb = bcadd($amount_deb, $row['j_montant']);
         $prog = bcadd($prog, $row['j_montant']);
         echo td("");
     } else {
         echo td("");
         echo td(nbm($row['j_montant']), ' style="text-align:right"');
         $amount_cred = bcadd($amount_cred, $row['j_montant']);
         $prog = bcsub($prog, $row['j_montant']);
     }
     $side = " " . $fiche->get_amount_side($prog);
     echo td(nbm($prog) . $side, 'style="text-align:right"');
     $html_let = "";
     if ($row['letter'] != -1) {
         $span_error = "";
         if ($row['letter_diff'] != 0) {
             $span_error = $g_failed;
         }
         echo '<td>' . HtmlInput::show_reconcile("", $html_letter, $span_error) . '</td>';
     } else {
         echo td('');
     }
     echo '</tr>';
 }
 echo '</table>';
 echo '<table>';
     printf('"%s";', $row['j_date_fmt']);
     printf('"%s";', $row['jr_pj_number']);
     printf('"%s";', $row['jr_internal']);
     printf('"%s";', $row['jr_comment']);
     if ($row['j_debit'] == 't') {
         printf("%s;", nb($row['j_montant']));
         $amount_deb = bcadd($amount_deb, $row['j_montant']);
         $prog = bcadd($prog, $row['j_montant']);
         printf(";");
     } else {
         printf(";");
         printf("%s;", nb($row['j_montant']));
         $amount_cred = bcadd($amount_cred, $row['j_montant']);
         $prog = bcsub($prog, $row['j_montant']);
     }
     printf("%s;\"%s\";", abs(nb($prog)), $fic->get_amount_side($prog));
     if ($row['letter'] != -1) {
         printf('"%s";', strtoupper(base_convert($row['letter'], 10, 36)));
         printf("%s", nb($row['letter_diff']));
     } else {
         printf(";");
     }
     printf("\n");
 }
 if ($prog < 0) {
     $msg = "Solde Debit";
 } elseif ($prog > 0) {
     $msg = "Solde Credit";
 } else {
     $msg = "soldé";
 }