Correction chargement des langs

This commit is contained in:
Rodolphe Quiedeville 2005-04-07 08:08:52 +00:00
parent 3d1ff4fd17
commit 584f8ad395

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -44,21 +44,21 @@ class pdf_bernique extends ModelePDFFactures {
function write_pdf_file($facid) function write_pdf_file($facid)
{ {
global $user,$langs,$user; global $user,$langs,$conf;
$langs->load("main");
$langs->load("bills");
$langs->load("products");
$langs->load("main");
$langs->load("bills");
$langs->load("products");
$fac = new Facture($this->db,"",$facid); $fac = new Facture($this->db,"",$facid);
$fac->fetch($facid); $fac->fetch($facid);
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","="); $forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
$facref = str_replace($forbidden_chars,"_",$fac->ref); $facref = str_replace($forbidden_chars,"_",$fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref . "/" ; $dir = $conf->facture->dir_output . "/" . $facref . "/" ;
$file = $dir . $facref . ".pdf"; $file = $dir . $facref . ".pdf";
if (! file_exists($dir)) if (! file_exists($dir))
{ {
@ -72,7 +72,7 @@ class pdf_bernique extends ModelePDFFactures {
if (file_exists($dir)) if (file_exists($dir))
{ {
// Initialisation facture vierge // Initialisation facture vierge
$pdf=new FPDF('P','mm','A4'); $pdf=new FPDF('P','mm','A4');
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
@ -228,38 +228,43 @@ class pdf_bernique extends ModelePDFFactures {
} }
function _tableau_tot(&$pdf, $fac, $top, $height) function _tableau_tot(&$pdf, $fac, $top, $height)
{ {
$tab2_top = $top + $height; global $langs;
$tab2_hl = 5; $langs->load("main");
$tab2_height = $tab2_hl * 4; $langs->loads("bills");
$pdf->SetFont('Arial','', 9);
$tvas = $fac->getSumTva(); $tab2_top = $top + $height;
$i = 0; $tab2_hl = 5;
$tab2_height = $tab2_hl * 4;
$tab4_top = $tab2_top + 2 + ($tab2_hl * 2); $pdf->SetFont('Arial','', 9);
foreach ($tvas as $key => $value) $tvas = $fac->getSumTva();
{ $i = 0;
$pdf->SetXY (10, $tab4_top + ( $i * $tab2_hl));
$pdf->MultiCell(25, $tab2_hl, "TVA à ". $key."%", 0, 'L', 0); $tab4_top = $tab2_top + 2 + ($tab2_hl * 2);
$pdf->SetXY (35, $tab4_top + ( $i * $tab2_hl));
$pdf->MultiCell(20, $tab2_hl, price($tvas[$key]), 0, 'R', 0); foreach ($tvas as $key => $value)
$i++; {
$pdf->line(10, $tab4_top + ($tab2_hl * $i), 55, $tab4_top + ($tab2_hl * $i) ); $pdf->SetXY (10, $tab4_top + ( $i * $tab2_hl));
} $pdf->MultiCell(25, $tab2_hl, "TVA à ". $key."%", 0, 'L', 0);
$pdf->line(10, $tab4_top, 55, $tab4_top ); $pdf->SetXY (35, $tab4_top + ( $i * $tab2_hl));
$pdf->line(10, $tab4_top, 10, $tab4_top + ($tab2_hl * $i)); $pdf->MultiCell(20, $tab2_hl, price($tvas[$key]), 0, 'R', 0);
$pdf->line(35, $tab4_top, 35, $tab4_top + ($tab2_hl * $i)); $i++;
$pdf->line(55, $tab4_top, 55, $tab4_top + ($tab2_hl * $i)); $pdf->line(10, $tab4_top + ($tab2_hl * $i), 55, $tab4_top + ($tab2_hl * $i) );
}
$pdf->line(10, $tab4_top, 55, $tab4_top );
$pdf->line(10, $tab4_top, 10, $tab4_top + ($tab2_hl * $i));
$pdf->line(35, $tab4_top, 35, $tab4_top + ($tab2_hl * $i));
$pdf->line(55, $tab4_top, 55, $tab4_top + ($tab2_hl * $i));
$pdf->Rect(10, $tab2_top, 190, $tab2_hl * 2); $pdf->Rect(10, $tab2_top, 190, $tab2_hl * 2);
$pdf->line(10, $tab2_top + $tab2_hl, 200, $tab2_top + $tab2_hl); $pdf->line(10, $tab2_top + $tab2_hl, 200, $tab2_top + $tab2_hl);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0);
$pdf->SetXY (11, $tab2_top + $tab2_hl); $pdf->SetXY (11, $tab2_top + $tab2_hl);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("Discount")." ". $fac->remise_percent . " %", 0, 'L', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("Discount")." ". $fac->remise_percent . " %", 0, 'L', 0);
@ -293,9 +298,9 @@ class pdf_bernique extends ModelePDFFactures {
*/ */
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);