From 5ae45de711b973f7c0489cd78a0fa839c4184723 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Feb 2009 13:07:29 +0000 Subject: [PATCH] Add customer code in proposals --- .../modules/facture/pdf_crabe.modules.php | 12 +++++- .../modules/facture/pdf_oursin.modules.php | 37 ++++++++++++------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index ab843fbd01b..9b61c058ce3 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -131,7 +131,8 @@ class pdf_crabe extends ModelePDFFactures $fac = new Facture($this->db,"",$id); $ret=$fac->fetch($id); } - + $fac->fetch_client(); + $deja_regle = $fac->getSommePaiement(); $amount_credit_not_included = $fac->getSommeCreditNote(); @@ -994,6 +995,14 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R'); } + if ($object->client->code_client) + { + $posy+=5; + $pdf->SetXY(100,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $object->client->code_client, '', 'R'); + } + if ($showadress) { // Emetteur @@ -1041,7 +1050,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('Arial','',8); $pdf->SetXY(102,$posy-5); $pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":"); - $object->fetch_client(); // Cadre client destinataire $pdf->rect(100, $posy, 100, $hautcadre); diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index 273d263978d..bc5512374fd 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -130,7 +130,8 @@ class pdf_oursin extends ModelePDFFactures $fac = new Facture($this->db,"",$id); $ret=$fac->fetch($id); } - + $fac->fetch_client(); + $deja_regle = $fac->getSommePaiement(); $amount_credit_not_included = $fac->getSommeCreditNote(); @@ -865,7 +866,6 @@ class pdf_oursin extends ModelePDFFactures $pdf->SetFont('Arial','',8); $pdf->SetXY($this->marges['g']+100,$posy-5); $pdf->SetFont('Arial','B',11); - $fac->fetch_client(); $object=$fac; @@ -937,22 +937,28 @@ class pdf_oursin extends ModelePDFFactures $pdf->SetTextColor(0,0,0); $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->SetXY($this->marges['g'],$posy+5); $pdf->SetTextColor(22,137,210); $pdf->MultiCell(100, 10, $outputlangs->transnoentities("RefBill")." : " . $outputlangs->transnoentities($fac->ref), '', 'L'); $pdf->SetTextColor(0,0,0); - - /* - * ref projet - */ - if ($fac->projetid > 0) + + if ($object->type != 2) { - $projet = New Project($fac->db); - $projet->fetch($fac->projetid); + $posy+=8; + $pdf->SetXY($this->marges['g'],$posy+5); $pdf->SetFont('Arial','',9); - $pdf->MultiCell(60, 4, $outputlangs->transnoentities("Project")." : ".$projet->title); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'L'); } + if ($object->client->code_client) + { + $posy+=4; + $pdf->SetXY($this->marges['g'],$posy+5); + $pdf->SetFont('Arial','',9); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $object->client->code_client, '', 'L'); + } + + /* * ref propal */ @@ -966,8 +972,13 @@ class pdf_oursin extends ModelePDFFactures if ($result) { $objp = $fac->db->fetch_object(); - $pdf->SetFont('Arial','',9); - $pdf->MultiCell(60, 4, $outputlangs->transnoentities("RefProposal")." : ".$objp->ref); + if ($objp->ref) + { + $posy+=4; + $pdf->SetXY($this->marges['g'],$posy+5); + $pdf->SetFont('Arial','',9); + $pdf->MultiCell(60, 3, $outputlangs->transnoentities("RefProposal")." : ".$objp->ref); + } } }