Fix: Amélioration nb long sur modeles pdf

This commit is contained in:
Laurent Destailleur 2007-12-31 03:36:57 +00:00
parent cf51602bb5
commit 007b8e3376
3 changed files with 34 additions and 33 deletions

View File

@ -2738,9 +2738,10 @@ class Facture extends CommonObject
$ligne->subprice=100; $ligne->subprice=100;
$ligne->price=100; $ligne->price=100;
$ligne->tva_tx=19.6; $ligne->tva_tx=19.6;
$ligne->total_ht=100; $ligne->remise_percent=10;
$ligne->total_ttc=119.6; $ligne->total_ht=90;
$ligne->total_tva=19.6; $ligne->total_ttc=107.64;
$ligne->total_tva=17.64;
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$ligne->produit_id=$prodids[$prodid]; $ligne->produit_id=$prodids[$prodid];
$this->lignes[$xnbp]=$ligne; $this->lignes[$xnbp]=$ligne;

View File

@ -73,6 +73,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->option_condreg = 1; // Affiche conditions règlement $this->option_condreg = 1; // Affiche conditions règlement
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues $this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 1; // Affiche si il y a eu escompte
$this->option_credit_note = 1; // Gère les avoirs $this->option_credit_note = 1; // Gère les avoirs
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
@ -84,11 +85,11 @@ class pdf_einstein extends ModelePDFCommandes
// Defini position des colonnes // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxtva=121; $this->posxtva=116;
$this->posxup=132; $this->posxup=126;
$this->posxqty=151; $this->posxqty=145;
$this->posxdiscount=162; $this->posxdiscount=162;
$this->postotalht=177; $this->postotalht=174;
$this->tva=array(); $this->tva=array();
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
@ -151,8 +152,6 @@ class pdf_einstein extends ModelePDFCommandes
{ {
$nblignes = sizeof($com->lignes); $nblignes = sizeof($com->lignes);
// Initialisation document vierge
// Protection et encryption du pdf // Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION) if ($conf->global->PDF_SECURITY_ENCRYPTION)
{ {
@ -274,7 +273,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
$pdf->writeHTMLCell(112, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); // Description
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut $pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
@ -282,27 +282,27 @@ class pdf_einstein extends ModelePDFCommandes
// TVA // TVA
$pdf->SetXY ($this->posxtva, $curY); $pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell(10, 4, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R'); $pdf->MultiCell($this->posxup-$this->posxtva-1, 4, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
// Prix unitaire HT avant remise // Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell(18, 4, price($com->lignes[$i]->subprice), 0, 'R', 0); $pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($com->lignes[$i]->subprice), 0, 'R', 0);
// Quantité // Quantité
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell(10, 4, $com->lignes[$i]->qty, 0, 'R'); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $com->lignes[$i]->qty, 0, 'R');
// Remise sur ligne // Remise sur ligne
$pdf->SetXY ($this->posxdiscount, $curY); $pdf->SetXY ($this->posxdiscount, $curY);
if ($com->lignes[$i]->remise_percent) if ($com->lignes[$i]->remise_percent)
{ {
$pdf->MultiCell(14, 4, dolibarr_print_reduction($com->lignes[$i]->remise_percent), 0, 'R'); $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, dolibarr_print_reduction($com->lignes[$i]->remise_percent), 0, 'R');
} }
// Total HT ligne // Total HT ligne
$pdf->SetXY ($this->postotalht, $curY); $pdf->SetXY ($this->postotalht, $curY);
$total = price($com->lignes[$i]->total_ht); $total = price($com->lignes[$i]->total_ht);
$pdf->MultiCell(23, 4, $total, 0, 'R', 0); $pdf->MultiCell(26, 4, $total, 0, 'R', 0);
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
@ -390,8 +390,8 @@ class pdf_einstein extends ModelePDFCommandes
/* /*
* \brief Affiche tableau des versement * \brief Affiche tableau des versement
* \param pdf objet PDF * \param pdf Objet PDF
* \param com objet commande * \param object Objet commande
*/ */
function _tableau_versements(&$pdf, $object, $posy, $outputlangs) function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{ {
@ -402,7 +402,7 @@ class pdf_einstein extends ModelePDFCommandes
/* /*
* \brief Affiche infos divers * \brief Affiche infos divers
* \param pdf Objet PDF * \param pdf Objet PDF
* \param com Objet commande * \param object Objet commande
* \param posy Position depart * \param posy Position depart
* \param outputlangs Objet langs * \param outputlangs Objet langs
* \return y Position pour suite * \return y Position pour suite
@ -414,9 +414,9 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
/* /*
* Affiche la mention TVA non applicable selon option * If France, show VAT mention if not applicable
*/ */
if ($this->franchise == 1) if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1)
{ {
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
@ -583,7 +583,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + 0); $pdf->SetXY ($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($object->total_ht + $object->remise)), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
// Remise globale // Remise globale
if ($object->remise > 0) if ($object->remise > 0)
@ -598,7 +598,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("WithDiscountTotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("WithDiscountTotalHT"), 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($object->total_ht)), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht), 0, 'R', 1);
$index = 2; $index = 2;
} }
@ -622,7 +622,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($tvaval)), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
} }
if (! $this->atleastoneratenotnull) if (! $this->atleastoneratenotnull)
@ -632,7 +632,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("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->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price(abs($object->total_tva)), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
} }
$useborder=0; $useborder=0;
@ -706,7 +706,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxtva-1, $tab_top+2); $pdf->SetXY ($this->posxtva-1, $tab_top+2);
$pdf->MultiCell(12,2, $outputlangs->transnoentities("VAT"),'','C'); $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->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxup-1, $tab_top+2); $pdf->SetXY ($this->posxup-1, $tab_top+2);
@ -714,13 +714,13 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY ($this->posxqty-1, $tab_top+2); $pdf->SetXY ($this->posxqty-1, $tab_top+2);
$pdf->MultiCell(11,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if ($this->atleastonediscount) if ($this->atleastonediscount)
{ {
$pdf->SetXY ($this->posxdiscount-1, $tab_top+2); $pdf->SetXY ($this->posxdiscount-1, $tab_top+2);
$pdf->MultiCell(16,2, $outputlangs->transnoentities("ReductionShort"),'','C'); $pdf->MultiCell(14,2, $outputlangs->transnoentities("ReductionShort"),'','C');
} }
if ($this->atleastonediscount) if ($this->atleastonediscount)
@ -728,7 +728,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
} }
$pdf->SetXY ($this->postotalht-1, $tab_top+2); $pdf->SetXY ($this->postotalht-1, $tab_top+2);
$pdf->MultiCell(23,2, $outputlangs->transnoentities("TotalHT"),'','C'); $pdf->MultiCell(28,2, $outputlangs->transnoentities("TotalHT"),'','C');
} }

View File

@ -440,7 +440,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Conditions de reglements * Conditions de règlements
*/ */
if ($object->cond_reglement_code || $object->cond_reglement) if ($object->cond_reglement_code || $object->cond_reglement)
{ {
@ -458,7 +458,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Check si absence mode reglement * Check si absence mode règlement
*/ */
if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER)
{ {
@ -472,7 +472,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Propose mode reglement par CHQ * Propose mode règlement par CHQ
*/ */
if (! $object->mode_reglement_code || $object->mode_reglement_code == 'CHQ') if (! $object->mode_reglement_code || $object->mode_reglement_code == 'CHQ')
{ {
@ -512,7 +512,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Propose mode reglement par RIB * Propose mode règlement par RIB
*/ */
if (! $object->mode_reglement_code || $object->mode_reglement_code == 'VIR') if (! $object->mode_reglement_code || $object->mode_reglement_code == 'VIR')
{ {