From c940a0bb01d04f98dbae9db875eb1e5891cbe655 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Jan 2010 20:42:40 +0000 Subject: [PATCH] New: Can use payment conditions on several lines --- .../modules/commande/pdf_edison.modules.php | 5 +- .../modules/commande/pdf_einstein.modules.php | 7 +- .../modules/facture/pdf_crabe.modules.php | 5 +- .../modules/facture/pdf_oursin.modules.php | 5 +- .../propale/pdf_propale_azur.modules.php | 5 +- .../propale/pdf_propale_jaune.modules.php | 154 +++++++++++++++++- 6 files changed, 166 insertions(+), 15 deletions(-) diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php index d9442129307..20238085dc2 100644 --- a/htdocs/includes/modules/commande/pdf_edison.modules.php +++ b/htdocs/includes/modules/commande/pdf_edison.modules.php @@ -349,12 +349,13 @@ class pdf_edison extends ModelePDFCommandes $pdf->SetFont('Arial','B',8); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('Arial','',8); $pdf->SetXY(50, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); + $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 173f8a39e36..9996673c091 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -425,12 +425,13 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('Arial','B',8); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('Arial','',8); $pdf->SetXY(50, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); + $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } @@ -689,7 +690,7 @@ class pdf_einstein extends ModelePDFCommandes } - /* + /** * \brief Affiche en-tete commande * \param pdf Objet PDF * \param com Objet commande diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index d96629b42b0..433e863d16e 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -567,12 +567,13 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('Arial','B',8); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('Arial','',8); $pdf->SetXY(50, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); + $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index 1a3a6abe663..54e4667662b 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -477,12 +477,13 @@ class pdf_oursin extends ModelePDFFactures $pdf->SetFont('Arial','B',8); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('Arial','',8); $pdf->SetXY(50, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); + $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index cd7c3be0891..f23b1fd32fc 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -446,12 +446,13 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetFont('Arial','B',8); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('Arial','',8); $pdf->SetXY(50, $posy); $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); + $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); $posy=$pdf->GetY()+3; } diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php index e0f60291d87..f2e2af0f6b6 100644 --- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -22,7 +22,7 @@ /** * \file htdocs/includes/modules/propale/pdf_propale_jaune.modules.php * \ingroup propale - * \brief Fichier de la classe permettant de g�n�rer les propales au mod�le Jaune + * \brief Fichier de la classe permettant de generer les propales au modele Jaune * \version $Id$ */ @@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); /** * \class pdf_propale_jaune - * \brief Classe permettant de g�n�rer les propales au mod�le Jaune + * \brief Classe permettant de generer les propales au modele Jaune */ class pdf_propale_jaune extends ModelePDFPropales { @@ -74,8 +74,8 @@ class pdf_propale_jaune extends ModelePDFPropales } - /** \brief Renvoi derni�re erreur - \return string Derni�re erreur + /** \brief Renvoi derniere erreur + * \return string Derniere erreur */ function pdferror() { @@ -257,6 +257,10 @@ class pdf_propale_jaune extends ModelePDFPropales $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); + $bottomlasttab=$tab_top + $tab_height + 1; + + // Affiche zone infos + $this->_tableau_info($pdf, $propale, $bottomlasttab, $outputlangs); $tab2_top = 254; $tab2_lh = 7; @@ -305,6 +309,148 @@ class pdf_propale_jaune extends ModelePDFPropales } } + /** + * \brief Affiche infos divers + * \param pdf Objet PDF + * \param object Objet commande + * \param posy Position depart + * \param outputlangs Objet langs + * \return y Position pour suite + */ + function _tableau_info(&$pdf, $object, $posy, $outputlangs) + { + global $conf; + + $pdf->SetFont('Arial','', 9); + + // If France, show VAT mention if not applicable + if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + + $posy=$pdf->GetY()+4; + } + + // Show payments conditions + if ($object->cond_reglement_code || $object->cond_reglement) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->transnoentities("PaymentConditions").':'; + $pdf->MultiCell(80, 4, $titre, 0, 'L'); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY(50, $posy); + $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); + $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); + $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); + + $posy=$pdf->GetY()+3; + } + + // Check a payment mode is defined + /* Not used with orders + if (empty($object->mode_reglement_code) + && ! $conf->global->FACTURE_CHQ_NUMBER + && ! $conf->global->FACTURE_RIB_NUMBER) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0); + $pdf->SetTextColor(0,0,0); + + $posy=$pdf->GetY()+1; + }*/ + + // Show payment mode + if ($object->mode_reglement_code + && $object->mode_reglement_code != 'CHQ' + && $object->mode_reglement_code != 'VIR') + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->transnoentities("PaymentMode").':'; + $pdf->MultiCell(80, 5, $titre, 0, 'L'); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY(50, $posy); + //print "xxx".$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code);exit; + $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); + $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); + + $posy=$pdf->GetY()+2; + } + + // Show payment mode CHQ + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') + { + // Si mode reglement non force ou si force a CHQ + if ($conf->global->FACTURE_CHQ_NUMBER) + { + if ($conf->global->FACTURE_CHQ_NUMBER > 0) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_CHQ_NUMBER); + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } + if ($conf->global->FACTURE_CHQ_NUMBER == -1) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->nom).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->adresse_full), 0, 'L', 0); + $posy=$pdf->GetY()+2; + } + } + } + + // If payment mode not forced or forced to VIR, show payment with BAN + /* Not enough space + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') + { + if (! empty($conf->global->FACTURE_RIB_NUMBER)) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_RIB_NUMBER); + + $curx=$this->marge_gauche; + $cury=$posy; + + $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account); + + $posy+=2; + } + } + */ + + return $posy; + } + + /** + * Enter description here... + * + * @param unknown_type $pdf + * @param unknown_type $tab_top + * @param unknown_type $tab_height + * @param unknown_type $nexY + * @param unknown_type $outputlangs + */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { global $langs,$conf;