Task #8618: Improve module canelle (not finished). Add array line in class facture fournisseur for lib pdf compatibility.
This commit is contained in:
parent
232bdd2ae3
commit
9383b1a560
@ -75,6 +75,7 @@ class FactureFournisseur extends Facture
|
||||
var $propalid;
|
||||
|
||||
var $lignes;
|
||||
var $lines; //For write pdf compatibility.
|
||||
var $fournisseur;
|
||||
|
||||
/**
|
||||
@ -102,6 +103,7 @@ class FactureFournisseur extends Facture
|
||||
|
||||
$this->products = array();
|
||||
$this->lignes = array();
|
||||
$this->lines = array(); //For write pdf compatibility
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,6 +354,7 @@ class FactureFournisseur extends Facture
|
||||
$this->lignes[$i]->total_ttc = $obj->total_ttc;
|
||||
$this->lignes[$i]->fk_product = $obj->fk_product;
|
||||
$this->lignes[$i]->product_type = $obj->product_type;
|
||||
$this->lines[$i] = $this->lignes[$i]; //For write pdf compatibility.
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -138,7 +139,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$nblignes = sizeof($object->lines);
|
||||
$nblignes = sizeof($object->lignes);
|
||||
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
@ -175,15 +176,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
@ -244,33 +236,33 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
// TVA
|
||||
$pdf->SetXY ($this->posxtva, $curY);
|
||||
$pdf->MultiCell(10, 3, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R');
|
||||
$pdf->MultiCell(10, 3, ($object->lignes[$i]->tva_tx < 0 ? '*':'').abs($object->lignes[$i]->tva_tx), 0, 'R');
|
||||
|
||||
// Unit price before discount
|
||||
$pdf->SetXY ($this->posxup, $curY);
|
||||
$pdf->MultiCell(18, 3, price($object->lines[$i]->subprice), 0, 'R', 0);
|
||||
$pdf->MultiCell(18, 3, price($object->lignes[$i]->pu_ht), 0, 'R', 0);
|
||||
|
||||
// Quantity
|
||||
$pdf->SetXY ($this->posxqty, $curY);
|
||||
$pdf->MultiCell(10, 3, $object->lines[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell(10, 3, $object->lignes[$i]->qty, 0, 'R');
|
||||
|
||||
// Discount on line
|
||||
$pdf->SetXY ($this->posxdiscount, $curY);
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
if ($object->lignes[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell(14, 3, $object->lines[$i]->remise_percent."%", 0, 'R');
|
||||
$pdf->MultiCell(14, 3, $object->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
$pdf->SetXY ($this->postotalht, $curY);
|
||||
$total = price($object->lines[$i]->total_ht);
|
||||
$total = price($object->lignes[$i]->total_ht);
|
||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);
|
||||
|
||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||
$tvaligne=$object->lines[$i]->total_tva;
|
||||
$tvaligne=$object->lignes[$i]->total_tva;
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
$vatrate=(string) $object->lignes[$i]->tva_tx;
|
||||
if (($object->lignes[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
|
||||
Loading…
Reference in New Issue
Block a user