Utilisation de transnoentities au lieu de trans

This commit is contained in:
Rodolphe Quiedeville 2006-12-17 13:50:20 +00:00
parent c4fd3fba34
commit e899bfb636

View File

@ -47,7 +47,7 @@ class pdf_paiement
$langs->load("bills");
$this->db = $db;
$this->description = $langs->trans("ListOfCustomerPayments");
$this->description = $langs->transnoentities("ListOfCustomerPayments");
$this->tab_top = 30;
@ -71,10 +71,10 @@ class pdf_paiement
$pdf->Text(76, 10, $title);
$pdf->SetFont('Arial','B',12);
$pdf->Text(11, 16, $langs->trans("Date")." : ".dolibarr_print_date(time(),"%d %b %Y"));
$pdf->Text(11, 16, $langs->transnoentities("Date")." : ".dolibarr_print_date(time(),"%d %b %Y"));
$pdf->SetFont('Arial','',12);
$pdf->Text(11, 22, $langs->trans("Page")." : ".$page);
$pdf->Text(11, 22, $langs->transnoentities("Page")." : ".$page);
// $pdf->Text(11, 22, "Page " . $page . " sur " . $pages);
$pdf->SetFont('Arial','',12);
@ -82,88 +82,88 @@ class pdf_paiement
$pdf->Text(11,$this->tab_top + 6,'Date');
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
$pdf->Text(42, $this->tab_top + 6, $langs->trans("PaymentMode"));
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
$pdf->Text(82, $this->tab_top + 6, $langs->trans("Invoice"));
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
$pdf->Text(122, $this->tab_top + 6, $langs->trans("AmountInvoice"));
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY (160, $this->tab_top);
$pdf->MultiCell(40, 10, $langs->trans("AmountPayment"), 0, 'R');
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
$pdf->Text(42, $this->tab_top + 6, $langs->transnoentities("PaymentMode"));
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
$pdf->Text(82, $this->tab_top + 6, $langs->transnoentities("Invoice"));
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
$pdf->Text(122, $this->tab_top + 6, $langs->transnoentities("AmountInvoice"));
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY (160, $this->tab_top);
$pdf->MultiCell(40, 10, $langs->transnoentities("AmountPayment"), 0, 'R');
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
}
function Body(&$pdf, $page, $lines)
{
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
}
function Body(&$pdf, $page, $lines)
{
$pdf->SetFont('Arial','', 9);
$oldprowid = 0;
$pdf->SetFillColor(220,220,220);
$yp = 0;
for ($j = 0 ; $j < sizeof($lines) ; $j++)
{
$i = $j;
if ($oldprowid <> $lines[$j][7])
{
if ($yp > 200)
{
$page++;
$pdf->AddPage();
$this->Header($pdf, $page, $pages);
$pdf->SetFont('Arial','', 9);
$oldprowid = 0;
$pdf->SetFillColor(220,220,220);
$yp = 0;
for ($j = 0 ; $j < sizeof($lines) ; $j++)
{
$i = $j;
if ($oldprowid <> $lines[$j][7])
{
if ($yp > 200)
{
$page++;
$pdf->AddPage();
$this->Header($pdf, $page, $pages);
$pdf->SetFont('Arial','', 9);
$yp = 0;
}
}
$pdf->SetXY (10, $this->tab_top + 10 + $yp);
$pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'J', 1);
$pdf->SetXY (40, $this->tab_top + 10 + $yp);
$pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'J', 1);
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1);
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1);
$yp = $yp + 5;
}
$pdf->SetXY (80, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0);
$pdf->SetXY (10, $this->tab_top + 10 + $yp);
$pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'J', 1);
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0);
$pdf->SetXY (40, $this->tab_top + 10 + $yp);
$pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'J', 1);
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0);
$yp = $yp + 5;
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1);
if ($oldprowid <> $lines[$j][7])
{
$oldprowid = $lines[$j][7];
}
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1);
$yp = $yp + 5;
}
// if ($i < $this->line_per_page - 1)
// {
// $pdf->line(10, $this->tab_top + 10 + (($i+1) * $this->line_height), 200, $this->tab_top + 10 + (($i+1) * $this->line_height));
// }
$pdf->SetXY (80, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0);
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0);
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0);
$yp = $yp + 5;
if ($oldprowid <> $lines[$j][7])
{
$oldprowid = $lines[$j][7];
}
// if ($i < $this->line_per_page - 1)
// {
// $pdf->line(10, $this->tab_top + 10 + (($i+1) * $this->line_height), 200, $this->tab_top + 10 + (($i+1) * $this->line_height));
// }
}
}
/**
\brief Fonction générant le rapport sur le disque
\param _dir repertoire
\param month mois du rapport
\param year annee du rapport
*/
}
}
/**
\brief Fonction générant le rapport sur le disque
\param _dir repertoire
\param month mois du rapport
\param year annee du rapport
*/
function write_pdf_file($_dir, $month, $year)
{
global $langs;
@ -172,95 +172,92 @@ class pdf_paiement
$this->year=$year;
$dir=$_dir.'/'.$year;
if (! is_dir($dir))
{
$result=create_exdir($dir);
if ($result < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return -1;
}
}
if (! is_dir($dir))
{
$result=create_exdir($dir);
if ($result < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return -1;
}
}
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
$_file = $dir . "/payments-".$month."-".$year.".pdf";
$pdf = new FPDF('P','mm','A4');
$pdf->Open();
$sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql .= ", c.code as paiement_code, p.num_paiement";
$sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
$sql .= ", pf.amount as pf_amount ";
$sql .= ", p.rowid as prowid";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f, ";
$sql .= MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
$sql .= " AND p.fk_paiement = c.id ";
$sql .= " AND date_format(p.datep, '%Y%m') = " . sprintf("%04d%02d",$year,$month);
$sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
$result = $this->db->query($sql);
// print $sql ;
if ($result)
{
$lignes = $this->db->num_rows($result);
$i = 0;
$var=True;
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
$_file = $dir . "/payments-".$month."-".$year.".pdf";
$pdf = new FPDF('P','mm','A4');
$pdf->Open();
$sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql .= ", c.code as paiement_code, p.num_paiement";
$sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
$sql .= ", pf.amount as pf_amount ";
$sql .= ", p.rowid as prowid";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f, ";
$sql .= MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
$sql .= " AND p.fk_paiement = c.id ";
$sql .= " AND date_format(p.datep, '%Y%m') = " . sprintf("%04d%02d",$year,$month);
$sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
$result = $this->db->query($sql);
// print $sql ;
if ($result)
{
$lignes = $this->db->num_rows($result);
$i = 0;
$var=True;
while ($i < $lignes)
{
$objp = $this->db->fetch_object($result);
$var=!$var;
$lines[$i][0] = $objp->facnumber;
$lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y");
//$lines[$i][2] = $objp->paiement_type ;
$lines[$i][2] = $langs->trans("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;
$lines[$i][4] = price($objp->paiement_amount);
$lines[$i][5] = price($objp->facture_amount);
$lines[$i][6] = price($objp->pf_amount);
$lines[$i][7] = price($objp->prowid);
$i++;
}
}
$pages = intval($lignes / $this->line_per_page);
if (($lignes % $this->line_per_page)>0)
{
$pages++;
}
if ($pages == 0)
{
// force à générer au moins une page si le rapport ne contient aucune ligne
$pages = 1;
}
/*
for ($i = 0 ; $i < $pages ; $i++)
{
$pdf->AddPage();
$this->Header($pdf, $i+1, $pages);
$this->Body($pdf, $i+1, $lines);
}
*/
$pdf->AddPage();
$this->Header($pdf, 1, $pages);
$this->Body($pdf, 1, $lines);
$pdf->Output($_file);
}
while ($i < $lignes)
{
$objp = $this->db->fetch_object($result);
$var=!$var;
$lines[$i][0] = $objp->facnumber;
$lines[$i][1] = dolibarr_print_date($objp->dp,"%d %B %Y");
//$lines[$i][2] = $objp->paiement_type ;
$lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;
$lines[$i][4] = price($objp->paiement_amount);
$lines[$i][5] = price($objp->facture_amount);
$lines[$i][6] = price($objp->pf_amount);
$lines[$i][7] = price($objp->prowid);
$i++;
}
}
$pages = intval($lignes / $this->line_per_page);
if (($lignes % $this->line_per_page)>0)
{
$pages++;
}
if ($pages == 0)
{
// force à générer au moins une page si le rapport ne contient aucune ligne
$pages = 1;
}
/*
for ($i = 0 ; $i < $pages ; $i++)
{
$pdf->AddPage();
$this->Header($pdf, $i+1, $pages);
$this->Body($pdf, $i+1, $lines);
}
*/
$pdf->AddPage();
$this->Header($pdf, 1, $pages);
$this->Body($pdf, 1, $lines);
$pdf->Output($_file);
}
}
?>