2
0
forked from Wavyzz/dolibarr

Load dict lang file for currency translation

This commit is contained in:
Laurent Destailleur
2009-02-13 23:59:43 +00:00
parent 31f4821f76
commit 8898721a76
8 changed files with 147 additions and 77 deletions

View File

@@ -108,6 +108,7 @@ class pdf_edison extends ModelePDFCommandes
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");

View File

@@ -83,8 +83,12 @@ class html_cerfafr extends ModeleDon
if (! is_object($outputlangs)) $outputlangs=$langs;
$langs->load("main");
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
if ($conf->don->dir_output)
{
// Definition de l'objet $don (pour compatibilite ascendante)

View File

@@ -86,10 +86,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("products");
$outputlangs->load("propal");
$outputlangs->load("sendings");
$outputlangs->setPhpLang();

View File

@@ -132,10 +132,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("products");
$outputlangs->load("propal");
$outputlangs->setPhpLang();

View File

@@ -20,11 +20,11 @@
*/
/**
\file htdocs/includes/modules/facture/pdf_crabe.modules.php
\ingroup facture
\brief File of class to generate invoices from crab model
\author Laurent Destailleur
\version $Id$
* \file htdocs/includes/modules/facture/pdf_crabe.modules.php
* \ingroup facture
* \brief File of class to generate invoices from crab model
* \author Laurent Destailleur
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@@ -84,7 +84,7 @@ class pdf_crabe extends ModelePDFFactures
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1;
@@ -254,8 +254,11 @@ class pdf_crabe extends ModelePDFFactures
$nexY = $pdf->GetY();
// TVA
$pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, vatrate($fac->lignes[$i]->tva_tx,1,$fac->lignes[$i]->info_bits), 0, 'R');
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, vatrate($fac->lignes[$i]->tva_tx,1,$fac->lignes[$i]->info_bits), 0, 'R');
}
// Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY);
@@ -677,6 +680,8 @@ class pdf_crabe extends ModelePDFFactures
*/
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf;
$tab2_top = $posy;
$tab2_hl = 5;
$tab2_height = $tab2_hl * 4;
@@ -685,6 +690,7 @@ class pdf_crabe extends ModelePDFFactures
// Tableau total
$lltot = 200; $col1x = 120; $col2x = 170; $largcol2 = $lltot - $col2x;
$useborder=0;
$index = 0;
// Total HT
@@ -694,51 +700,57 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
// Affichage des totaux de TVA par taux (conformement a la reglementation)
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
foreach( $this->tva as $tvakey => $tvaval )
$this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
if ($tvakey) // On affiche pas taux 0
foreach( $this->tva as $tvakey => $tvaval )
{
if ($tvakey) // On affiche pas taux 0
{
$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (eregi('\*',$tvakey))
{
$tvakey=eregi_replace('\*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If no vat at all
{
$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (eregi('\*',$tvakey))
{
$tvakey=eregi_replace('\*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If not vat at all
// Total TTC
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224);
$text=$outputlangs->transnoentities("TotalTTC");
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
}
$useborder=0;
// Total TTC
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224);
$text=$outputlangs->transnoentities("TotalTTC");
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->SetTextColor(0,0,0);
$creditnoteamount=$object->getSommeCreditNote();
@@ -824,10 +836,13 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($this->posxdesc-1, $tab_top+2);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxtva-1, $tab_top+2);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxtva-1, $tab_top+2);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
}
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxup-1, $tab_top+2);
$pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C');

View File

@@ -114,6 +114,7 @@ class pdf_oursin extends ModelePDFFactures
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
@@ -221,11 +222,15 @@ class pdf_oursin extends ModelePDFFactures
$nexY = $pdf->GetY();
// TVA
if ($this->franchise!=1)
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->SetXY ($this->marges['g']+119, $curY);
$pdf->MultiCell(10, 3, $fac->lignes[$i]->tva_tx, 0, 'R');
if ($this->franchise!=1)
{
$pdf->SetXY ($this->marges['g']+119, $curY);
$pdf->MultiCell(10, 3, $fac->lignes[$i]->tva_tx, 0, 'R');
}
}
// Prix unitaire HT avant remise
$pdf->SetXY ($this->marges['g']+132, $curY);
$pdf->MultiCell(16, 3, price($fac->lignes[$i]->subprice), 0, 'R', 0);
@@ -584,7 +589,8 @@ class pdf_oursin extends ModelePDFFactures
*/
function _tableau_tot(&$pdf, $fac, $deja_regle, $posy, $outputlangs)
{
global $langs;
global $conf,$langs;
$langs->load("main");
$langs->load("bills");
@@ -593,6 +599,10 @@ class pdf_oursin extends ModelePDFFactures
$tab2_height = $tab2_hl * 4;
$pdf->SetFont('Arial','', 9);
// Tableau total
$col1x=$this->marges['g']+110; $col2x=$this->marges['g']+164;
$lltot = 200; $largcol2 = $lltot - $col2x;
$pdf->SetXY ($this->marges['g'], $tab2_top + 0);
/*
@@ -603,32 +613,66 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(100, $tab2_hl, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
}
$useborder=0;
$index = 0;
// Total TTC
$col1x=$this->marges['g']+110; $col2x=$this->marges['g']+164;
// Total HT
$pdf->SetXY ($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
// Total VAT
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
$this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
foreach( $this->tva as $tvakey => $tvaval )
{
if ($tvakey) // On affiche pas taux 0
{
$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (eregi('\*',$tvakey))
{
$tvakey=eregi_replace('\*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If no vat at all
{
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
}
}
// Total TTC
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(22,137,210);
$pdf->SetFont('Arial','B', 11);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 0);
$pdf->SetTextColor(0,0,0);
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(22,137,210);
$pdf->SetFont('Arial','B', 11);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($fac->total_ttc), 0, 'R', 0);
$pdf->SetTextColor(0,0,0);
}
$creditnoteamount=$fac->getSommeCreditNote();
$resteapayer = $fac->total_ttc - $deja_regle - $creditnoteamount;
if ($object->paye) $resteapayer=0;
@@ -642,7 +686,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPayed"), 0, 'L', 0);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0);
// Credit note
if ($creditnoteamount)
@@ -664,7 +708,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), 0, 'L', 0);
$pdf->SetFillColor(224,224,224);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 0);
$pdf->SetTextColor(0,0,0);
}
@@ -678,7 +722,7 @@ class pdf_oursin extends ModelePDFFactures
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $fac, $outputlangs)
{
global $langs;
global $conf,$langs;
$langs->load("main");
$langs->load("bills");
@@ -688,7 +732,10 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','B',10);
$pdf->Text($this->marges['g']+1,$tab_top + 5, $outputlangs->transnoentities("Designation"));
if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $outputlangs->transnoentities("VAT"));
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $outputlangs->transnoentities("VAT"));
}
$pdf->Text($this->marges['g']+135, $tab_top + 5,$outputlangs->transnoentities("PriceUHT"));
$pdf->Text($this->marges['g']+153, $tab_top + 5, $outputlangs->transnoentities("Qty"));
@@ -896,7 +943,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','B',13);
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(0,0,0);
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("Bill").' '.$outputlangs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y",false,$outputlangs,true), '' , 'L');
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("Bill").' '.$outputlangs->transnoentities("Of").' '.dol_print_date($fac->date,"%d %B %Y",false,$outputlangs,true), '' , 'L');
$pdf->SetFont('Arial','B',11);
$pdf->SetXY($this->marges['g'],$posy+6);
$pdf->SetTextColor(22,137,210);

View File

@@ -98,6 +98,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("deliveries");
@@ -225,9 +226,9 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line
{
//on r<>cup<75>re la description du produit suivant
//on r<>cup<75>re la description du produit suivant
$follow_descproduitservice = $delivery->lignes[$i+1]->desc;
//on compte le nombre de ligne afin de v<>rifier la place disponible (largeur de ligne 52 caracteres)
//on compte le nombre de ligne afin de v<>rifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52)*4);
}
else // If it's last line

View File

@@ -116,11 +116,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("orders");
$outputlangs->load("dict");
$outputlangs->setPhpLang();