Support TVA Non Perçu Récupérable on crabe, azur and einstein modeles

This commit is contained in:
Laurent Destailleur 2008-04-02 23:54:18 +00:00
parent dba04fa114
commit 496c7f0fd7
7 changed files with 157 additions and 115 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -16,8 +16,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*
* $Id$
*/ */
/** /**
@ -25,7 +23,7 @@
\ingroup commande \ingroup commande
\brief Fichier de la classe permettant de générer les commandes au modèle Einstein \brief Fichier de la classe permettant de générer les commandes au modèle Einstein
\author Laurent Destailleur \author Laurent Destailleur
\version $Revision$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
@ -86,7 +84,7 @@ 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=116; $this->posxtva=113;
$this->posxup=126; $this->posxup=126;
$this->posxqty=145; $this->posxqty=145;
$this->posxdiscount=162; $this->posxdiscount=162;
@ -98,9 +96,10 @@ class pdf_einstein extends ModelePDFCommandes
} }
/** /**
\brief Fonction générant la commande sur le disque * \brief Fonction générant la commande sur le disque
\param com Objet commande à générer * \param com Objet commande à générer
\return int 1=ok, 0=ko * \param outputlangs Lang object for output language
* \return int 1=ok, 0=ko
*/ */
function write_file($com,$outputlangs='') function write_file($com,$outputlangs='')
{ {
@ -144,7 +143,7 @@ class pdf_einstein extends ModelePDFCommandes
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
{ {
$this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); $this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0; return 0;
} }
} }
@ -268,14 +267,14 @@ class pdf_einstein extends ModelePDFCommandes
if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end) if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
{ {
// Affichage durée si il y en a une // Affichage duree si il y en a une
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")",1); $libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")",1);
} }
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
// Description // Description
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $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
@ -283,21 +282,21 @@ class pdf_einstein extends ModelePDFCommandes
// TVA // TVA
$pdf->SetXY ($this->posxtva, $curY); $pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R'); $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, vatrate($com->lignes[$i]->tva_tx,1,$com->lignes[$i]->info_bits), 0, 'R');
// Prix unitaire HT avant remise // Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($com->lignes[$i]->subprice), 0, 'R', 0); $pdf->MultiCell($this->posxqty-$this->posxup-1, 3, price($com->lignes[$i]->subprice), 0, 'R', 0);
// Quantité // Quantity
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $com->lignes[$i]->qty, 0, 'R'); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $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($this->postotalht-$this->posxdiscount-1, 4, dolibarr_print_reduction($com->lignes[$i]->remise_percent), 0, 'R'); $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, dolibarr_print_reduction($com->lignes[$i]->remise_percent), 0, 'R');
} }
// Total HT ligne // Total HT ligne
@ -306,10 +305,11 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell(26, 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
$tvaligne=$com->lignes[$i]->total_tva; $tvaligne=$com->lignes[$i]->total_tva;
if ($com->remise_percent) $tvaligne-=($tvaligne*$com->remise_percent)/100; if ($com->remise_percent) $tvaligne-=($tvaligne*$com->remise_percent)/100;
$this->tva[(string) $com->lignes[$i]->tva_tx] += $tvaligne; $vatrate=(string) $com->lignes[$i]->tva_tx;
if ($com->lignes[$i]->info_bits & 0x01 == 0x01) $vatrate.='*';
$this->tva[$vatrate] += $tvaligne;
$nexY+=2; // Passe espace entre les lignes $nexY+=2; // Passe espace entre les lignes
@ -356,7 +356,8 @@ class pdf_einstein extends ModelePDFCommandes
$posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs);
// Affiche zone versements // Affiche zone versements
if ($deja_regle) { if ($deja_regle)
{
$posy=$this->_tableau_versements($pdf, $com, $posy, $outputlangs); $posy=$this->_tableau_versements($pdf, $com, $posy, $outputlangs);
} }
@ -373,18 +374,18 @@ class pdf_einstein extends ModelePDFCommandes
} }
else else
{ {
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir); $this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; return 0;
} }
} }
else else
{ {
$this->error=$outputlangs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; return 0;
} }
$this->error=$outputlangs->transnoentities("ErrorUnknown"); $this->error=$langs->trans("ErrorUnknown");
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; // Erreur par defaut return 0; // Erreur par defaut
} }
@ -393,6 +394,9 @@ class pdf_einstein extends ModelePDFCommandes
* \brief Affiche tableau des versement * \brief Affiche tableau des versement
* \param pdf Objet PDF * \param pdf Objet PDF
* \param object Objet commande * \param object Objet commande
* \param posy Position y in PDF
* \param outputlangs Object langs for output
* \return int <0 if KO, >0 if OK
*/ */
function _tableau_versements(&$pdf, $object, $posy, $outputlangs) function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{ {
@ -427,7 +431,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
/* /*
* Conditions de règlements * Conditions de reglements
*/ */
if ($object->cond_reglement_code || $object->cond_reglement) if ($object->cond_reglement_code || $object->cond_reglement)
{ {
@ -445,7 +449,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
/* /*
* Check si absence mode règlement * Check si absence mode reglement
*/ */
if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER)
{ {
@ -459,7 +463,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
/* /*
* Propose mode règlement par CHQ * Propose mode reglement par CHQ
*/ */
if (! $object->mode_reglement_code || $object->mode_reglement_code == 'CHQ') if (! $object->mode_reglement_code || $object->mode_reglement_code == 'CHQ')
{ {
@ -499,7 +503,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
/* /*
* Propose mode règlement par RIB * Propose mode reglement par RIB
*/ */
if (! $object->mode_reglement_code || $object->mode_reglement_code == 'VIR') if (! $object->mode_reglement_code || $object->mode_reglement_code == 'VIR')
{ {
@ -560,7 +564,7 @@ class pdf_einstein extends ModelePDFCommandes
/* /*
* \brief Affiche le total à payer * \brief Affiche le total a payer
* \param pdf Objet PDF * \param pdf Objet PDF
* \param object Objet commande * \param object Objet commande
* \param deja_regle Montant deja regle * \param deja_regle Montant deja regle
@ -619,14 +623,22 @@ class pdf_einstein extends ModelePDFCommandes
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = ( (float)$tvakey < 0 ) ? " (".$outputlangs->transnoentities("NonPercuRecuperable").")" : '' ;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); $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->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
} }
if (! $this->atleastoneratenotnull) if (! $this->atleastoneratenotnull) // If not vat at all
{ {
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
@ -645,7 +657,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, '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_ttc)), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
if ($deja_regle > 0) if ($deja_regle > 0)
@ -668,7 +680,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, '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($resteapayer)), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
// Fin // Fin
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
@ -679,7 +691,7 @@ class pdf_einstein extends ModelePDFCommandes
return ($tab2_top + ($tab2_hl * $index)); return ($tab2_top + ($tab2_hl * $index));
} }
/* /**
* \brief Affiche la grille des lignes de commandes * \brief Affiche la grille des lignes de commandes
* \param pdf objet PDF * \param pdf objet PDF
*/ */
@ -769,7 +781,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
} }
else if (defined("FAC_PDF_INTITULE")) else if (defined("FAC_PDF_INTITULE"))
@ -917,7 +929,12 @@ class pdf_einstein extends ModelePDFCommandes
// Caractéristiques client // Caractéristiques client
$carac_client.="\n".$object->client->adresse; $carac_client.="\n".$object->client->adresse;
$carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n";
if ($this->emetteur->pays_code != $object->client->pays_code) $carac_client.=$object->client->pays."\n";
//Pays si différent de l'émetteur
if ($this->emetteur->pays_code != $object->client->pays_code)
{
$carac_client.=$object->client->pays."\n";
}
} }
// Numéro TVA intracom // Numéro TVA intracom
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra;

View File

@ -43,7 +43,7 @@ class pdf_crabe extends ModelePDFFactures
/** /**
\brief Constructeur \brief Constructeur
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e \param db Handler accès base de donn�e
*/ */
function pdf_crabe($db) function pdf_crabe($db)
{ {
@ -68,23 +68,23 @@ class pdf_crabe extends ModelePDFFactures
$this->option_logo = 1; // Affiche logo $this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Affiche mode règlement $this->option_modereg = 1; // Affiche mode règlement
$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_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')
$this->franchise=1; $this->franchise=1;
// Recupere emmetteur // Recupere emmetteur
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
// Defini position des colonnes // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxtva=116; $this->posxtva=113;
$this->posxup=126; $this->posxup=126;
$this->posxqty=145; $this->posxqty=145;
$this->posxdiscount=162; $this->posxdiscount=162;
@ -97,8 +97,8 @@ class pdf_crabe extends ModelePDFFactures
/** /**
* \brief Fonction générant la facture sur le disque * \brief Fonction générant la facture sur le disque
* \param fac Objet facture à générer (ou id si ancienne methode) * \param fac Objet facture à générer (ou id si ancienne methode)
* \param outputlangs Lang object for output language * \param outputlangs Lang object for output language
* \return int 1=ok, 0=ko * \return int 1=ok, 0=ko
*/ */
@ -117,7 +117,7 @@ class pdf_crabe extends ModelePDFFactures
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
// D<EFBFBD>finition de l'objet $fac (pour compatibilite ascendante) // Définition de l'objet $fac (pour compatibilite ascendante)
if (! is_object($fac)) if (! is_object($fac))
{ {
$id = $fac; $id = $fac;
@ -128,7 +128,7 @@ class pdf_crabe extends ModelePDFFactures
$deja_regle = $fac->getSommePaiement(); $deja_regle = $fac->getSommePaiement();
$amount_credit_not_included = $fac->getSommeCreditNote(); $amount_credit_not_included = $fac->getSommeCreditNote();
// D<EFBFBD>finition de $dir et $file // Définition de $dir et $file
if ($fac->specimen) if ($fac->specimen)
{ {
$dir = $conf->facture->dir_output; $dir = $conf->facture->dir_output;
@ -160,7 +160,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf=new FPDI_Protection('P','mm',$this->format); $pdf=new FPDI_Protection('P','mm',$this->format);
$pdfrights = array('print'); // Ne permet que l'impression du document $pdfrights = array('print'); // Ne permet que l'impression du document
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final $pdfuserpass = ''; // Mot de passe pour l'utilisateur final
$pdfownerpass = NULL; // Mot de passe du propri<EFBFBD>taire, cr<63><72> al<61>atoirement si pas d<>fini $pdfownerpass = NULL; // Mot de passe du propriétire, crée aléatoirement si pas défini
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass); $pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
} }
else else
@ -289,23 +289,23 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
// Desc // Description
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut $pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA
$pdf->SetXY ($this->posxtva, $curY); $pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, ($fac->lignes[$i]->tva_tx < 0 ? '*':'').abs($fac->lignes[$i]->tva_tx), 0, 'R'); $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 // Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($fac->lignes[$i]->subprice), 0, 'R', 0); $pdf->MultiCell($this->posxqty-$this->posxup-1, 3, price($fac->lignes[$i]->subprice), 0, 'R', 0);
// Quantite // Quantity
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $fac->lignes[$i]->qty, 0, 'R'); // Enough for 6 chars $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $fac->lignes[$i]->qty, 0, 'R'); // Enough for 6 chars
// Remise sur ligne // Remise sur ligne
$pdf->SetXY ($this->posxdiscount, $curY); $pdf->SetXY ($this->posxdiscount, $curY);
@ -322,7 +322,9 @@ class pdf_crabe extends ModelePDFFactures
// 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
$tvaligne=$fac->lignes[$i]->total_tva; $tvaligne=$fac->lignes[$i]->total_tva;
if ($fac->remise_percent) $tvaligne-=($tvaligne*$fac->remise_percent)/100; if ($fac->remise_percent) $tvaligne-=($tvaligne*$fac->remise_percent)/100;
$this->tva[(string) $fac->lignes[$i]->tva_tx] += $tvaligne; $vatrate=(string) $fac->lignes[$i]->tva_tx;
if ($fac->lignes[$i]->info_bits & 0x01 == 0x01) $vatrate.='*';
$this->tva[$vatrate] += $tvaligne;
$nexY+=2; // Passe espace entre les lignes $nexY+=2; // Passe espace entre les lignes
@ -388,7 +390,7 @@ class pdf_crabe extends ModelePDFFactures
} }
else else
{ {
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); $this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; return 0;
} }
@ -747,7 +749,7 @@ class pdf_crabe extends ModelePDFFactures
$index = 0; $index = 0;
} }
// Affichage des totaux de TVA par taux (conformément à réglementation) // Affichage des totaux de TVA par taux (conformément a la réglementation)
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
foreach( $this->tva as $tvakey => $tvaval ) foreach( $this->tva as $tvakey => $tvaval )
@ -758,14 +760,22 @@ class pdf_crabe extends ModelePDFFactures
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = ( (float)$tvakey < 0 ) ? " (".$outputlangs->transnoentities("NonPercuRecuperable").")" : '' ;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); $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->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
} }
if (! $this->atleastoneratenotnull) if (! $this->atleastoneratenotnull) // If not vat at all
{ {
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
@ -786,7 +796,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, '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_ttc)), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
if ($deja_regle > 0) if ($deja_regle > 0)
@ -823,7 +833,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, '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($resteapayer)), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
// Fin // Fin
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
@ -834,7 +844,7 @@ class pdf_crabe extends ModelePDFFactures
return ($tab2_top + ($tab2_hl * $index)); return ($tab2_top + ($tab2_hl * $index));
} }
/* /**
* \brief Affiche la grille des lignes de factures * \brief Affiche la grille des lignes de factures
* \param pdf objet PDF * \param pdf objet PDF
*/ */
@ -842,7 +852,7 @@ class pdf_crabe extends ModelePDFFactures
{ {
global $conf; global $conf;
// Montants exprimés en (en tab_top - 1) // Montants exprimés en (en tab_top - 1)
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentities("Currency".$conf->monnaie)); $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentities("Currency".$conf->monnaie));
@ -1109,11 +1119,14 @@ class pdf_crabe extends ModelePDFFactures
// Caractéristiques client // Caractéristiques client
$carac_client.="\n".$object->client->adresse; $carac_client.="\n".$object->client->adresse;
$carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n";
//Pays si différent de l'émetteur
if ($this->emetteur->pays_code != $object->client->pays_code) if ($this->emetteur->pays_code != $object->client->pays_code)
{ {
$carac_client.=$object->client->pays."\n"; $carac_client.=$object->client->pays."\n";
} }
} }
// Numéro TVA intracom
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra;
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY(102,$posy+6); $pdf->SetXY(102,$posy+6);

View File

@ -86,7 +86,7 @@ class pdf_propale_azur extends ModelePDFPropales
// Defini position des colonnes // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxtva=116; $this->posxtva=113;
$this->posxup=126; $this->posxup=126;
$this->posxqty=145; $this->posxqty=145;
$this->posxdiscount=162; $this->posxdiscount=162;
@ -145,7 +145,7 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
{ {
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir); $this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0; return 0;
} }
} }
@ -277,20 +277,20 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
// Description // Description
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1); $pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $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
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA
$pdf->SetXY ($this->posxtva, $curY); $pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, ($propale->lignes[$i]->tva_tx < 0 ? '*':'').abs($propale->lignes[$i]->tva_tx), 0, 'R'); $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, vatrate($propale->lignes[$i]->tva_tx,1,$propale->lignes[$i]->info_bits), 0, 'R');
// Prix unitaire HT avant remise // Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0); $pdf->MultiCell($this->posxqty-$this->posxup-1, 3, price($propale->lignes[$i]->subprice), 0, 'R', 0);
// Quantité // Quantity
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
if ($propale->lignes[$i]->special_code != 3) $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $propale->lignes[$i]->qty, 0, 'R'); if ($propale->lignes[$i]->special_code != 3) $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $propale->lignes[$i]->qty, 0, 'R');
@ -317,7 +317,9 @@ class pdf_propale_azur extends ModelePDFPropales
// 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
$tvaligne=$propale->lignes[$i]->total_tva; $tvaligne=$propale->lignes[$i]->total_tva;
if ($propale->remise_percent) $tvaligne-=($tvaligne*$propale->remise_percent)/100; if ($propale->remise_percent) $tvaligne-=($tvaligne*$propale->remise_percent)/100;
$this->tva[(string) $propale->lignes[$i]->tva_tx] += $tvaligne; $vatrate=(string) $propale->lignes[$i]->tva_tx;
if ($propale->lignes[$i]->info_bits & 0x01 == 0x01) $vatrate.='*';
$this->tva[$vatrate] += $tvaligne;
$nexY+=2; // Passe espace entre les lignes $nexY+=2; // Passe espace entre les lignes
@ -370,7 +372,8 @@ class pdf_propale_azur extends ModelePDFPropales
$posy=$this->_tableau_tot($pdf, $propale, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $propale, $deja_regle, $bottomlasttab, $outputlangs);
// Affiche zone versements // Affiche zone versements
if ($deja_regle) { if ($deja_regle)
{
$posy=$this->_tableau_versements($pdf, $propale, $posy, $outputlangs); $posy=$this->_tableau_versements($pdf, $propale, $posy, $outputlangs);
} }
@ -387,19 +390,19 @@ class pdf_propale_azur extends ModelePDFPropales
} }
else else
{ {
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir); $this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; return 0;
} }
} }
else else
{ {
$this->error=$outputlangs->transnoentities("ErrorConstantNotDefined","PROP_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; return 0;
} }
$this->error=$outputlangs->transnoentities("ErrorUnknown"); $this->error=$langs->trans("ErrorUnknown");
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 0; // Erreur par defaut return 0; // Erreur par defaut
} }
@ -442,7 +445,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Conditions de règlements * Conditions de reglements
*/ */
if ($object->cond_reglement_code || $object->cond_reglement) if ($object->cond_reglement_code || $object->cond_reglement)
{ {
@ -460,7 +463,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Check si absence mode règlement * Check si absence mode reglement
*/ */
if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER)
{ {
@ -474,7 +477,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Propose mode règlement par CHQ * Propose mode reglement par CHQ
*/ */
if (! $object->mode_reglement_code || $object->mode_reglement_code == 'CHQ') if (! $object->mode_reglement_code || $object->mode_reglement_code == 'CHQ')
{ {
@ -514,7 +517,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/* /*
* Propose mode règlement par RIB * Propose mode reglement par RIB
*/ */
if (! $object->mode_reglement_code || $object->mode_reglement_code == 'VIR') if (! $object->mode_reglement_code || $object->mode_reglement_code == 'VIR')
{ {
@ -633,14 +636,22 @@ class pdf_propale_azur extends ModelePDFPropales
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = ( (float)$tvakey < 0 ) ? " (".$outputlangs->transnoentities("NonPercuRecuperable").")" : '' ;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); $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->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
} }
} }
if (! $this->atleastoneratenotnull) if (! $this->atleastoneratenotnull) // If not vat at all
{ {
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
@ -659,7 +670,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, '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_ttc)), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
if ($deja_regle > 0) if ($deja_regle > 0)
@ -696,7 +707,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, '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($resteapayer)), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
// Fin // Fin
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
@ -707,7 +718,7 @@ class pdf_propale_azur extends ModelePDFPropales
return ($tab2_top + ($tab2_hl * $index)); return ($tab2_top + ($tab2_hl * $index));
} }
/* /**
* \brief Affiche la grille des lignes de propales * \brief Affiche la grille des lignes de propales
* \param pdf objet PDF * \param pdf objet PDF
*/ */
@ -953,6 +964,7 @@ class pdf_propale_azur extends ModelePDFPropales
$carac_client.=$object->client->pays."\n"; $carac_client.=$object->client->pays."\n";
} }
} }
// Numéro TVA intracom
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra;
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY(102,$posy+6); $pdf->SetXY(102,$posy+6);

View File

@ -155,7 +155,7 @@ NoSupplierBillsUnpayed=Aucune facture fournisseur impay
SupplierBillsToPay=Factures fournisseurs à payer SupplierBillsToPay=Factures fournisseurs à payer
CustomerBillsUnpayed=Factures clients impayées CustomerBillsUnpayed=Factures clients impayées
DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres
NonPercuRecuperable=Non perçu récupérable NonPercuRecuperable=Non perçue récupérable
SetConditions=Définir conditions de règlement SetConditions=Définir conditions de règlement
SetMode=Définir mode de règlement SetMode=Définir mode de règlement
Billed=Facturé Billed=Facturé

View File

@ -188,7 +188,7 @@ NoSupplierBillsUnpayed=Aucune facture fournisseur impay
SupplierBillsToPay=Factures fournisseurs à payer SupplierBillsToPay=Factures fournisseurs à payer
CustomerBillsUnpayed=Factures clients impayées CustomerBillsUnpayed=Factures clients impayées
DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres
NonPercuRecuperable=Non perçu récupérable NonPercuRecuperable=Non perçue récupérable
SetConditions=Définir conditions de règlement SetConditions=Définir conditions de règlement
SetMode=Définir mode de règlement SetMode=Définir mode de règlement
Billed=Facturé Billed=Facturé

View File

@ -159,7 +159,7 @@ NoSupplierBillsUnpayed=Geen onbetaalde leveranciers facturen
SupplierBillsToPay=Te betalen leveranciers facturen SupplierBillsToPay=Te betalen leveranciers facturen
CustomerBillsUnpayed=Obetaalde klanten facturen CustomerBillsUnpayed=Obetaalde klanten facturen
DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres
NonPercuRecuperable=Non perçu récupérable NonPercuRecuperable=Non perçue récupérable
SetConditions=Stel betalingsvoorwaarden in SetConditions=Stel betalingsvoorwaarden in
SetMode=Stel betalingswijze in SetMode=Stel betalingswijze in
Billed=Gefactureerd Billed=Gefactureerd

View File

@ -293,6 +293,6 @@ $yesno[1]="yes";
$bc[0]="class=\"impair\""; $bc[0]="class=\"impair\"";
$bc[1]="class=\"pair\""; $bc[1]="class=\"pair\"";
if ( ! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','npr'); if ( ! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
?> ?>