If there is a commercial contact, use its name in proposal

This commit is contained in:
Laurent Destailleur 2009-02-16 21:37:28 +00:00
parent d7291bc655
commit ba175ce7f4
5 changed files with 42 additions and 77 deletions

View File

@ -837,7 +837,7 @@ class CommonObject
function update_price()
{
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
$err=0;
// List lines to sum
@ -855,7 +855,7 @@ class CommonObject
$this->total_ht = 0;
$this->total_tva = 0;
$this->total_ttc = 0;
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
@ -878,7 +878,7 @@ class CommonObject
if ($this->element == 'facture_fourn') $fieldtva='total_tva';
$fieldttc='total_ttc';
if ($this->element == 'propal') $fieldttc='total';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
$sql .= " ".$fieldht."='".price2num($this->total_ht)."',";
$sql .= " ".$fieldtva."='".price2num($this->total_tva)."',";
@ -905,7 +905,7 @@ class CommonObject
dolibarr_syslog("CommonObject::update_price error=".$this->error,LOG_ERR);
return -1;
}
}
}
}
?>

View File

@ -71,7 +71,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Gere choix mode reglement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_codeproduitservice = 1; // Affiche code produit-service
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1;

View File

@ -501,7 +501,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$outputlangs->convToOutputCharset($account->proprio)).':',0,'L',0);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
@ -828,17 +828,24 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY($this->marge_gauche+2,$posy+3);
// Customer name
// Sender name
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',11);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
// Customer properties
// Sended properties
$carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->adresse);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->cp).' '.$outputlangs->convToOutputCharset($this->emetteur->ville);
$carac_emetteur .= "\n";
// Tel
// Add internal contact of proposal if defined
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
if (sizeof($arrayidcontact) > 0)
{
$object->fetch_user($arrayidcontact[0]);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->fullname);
}
// Tel
if ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($this->emetteur->tel);
// Fax
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($this->emetteur->fax);
@ -849,14 +856,14 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','',9);
$pdf->SetXY($this->marge_gauche+2,$posy+8);
$pdf->MultiCell(80,4, $carac_emetteur);
$pdf->MultiCell(80,3, $carac_emetteur);
// Client destinataire
$posy=42;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8);
$pdf->SetXY(102,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":");
$pdf->MultiCell(80,4, $outputlangs->transnoentities("BillTo").":");
$object->fetch_client();
// Cadre client destinataire

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -172,7 +172,7 @@ class pdf_propale_jaune extends ModelePDFPropales
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $propale, $outputlangs);
$this->_pagehead($pdf, $propale, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -246,7 +246,7 @@ class pdf_propale_jaune extends ModelePDFPropales
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $propale, $outputlangs);
$this->_pagehead($pdf, $propale, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -343,12 +343,12 @@ class pdf_propale_jaune extends ModelePDFPropales
}
function _pagehead(&$pdf, $propale, $outputlangs)
function _pagehead(&$pdf, $object, $showadress=1, $outputlangs)
{
global $conf,$langs;
//Affiche le filigrane brouillon - Print Draft Watermark
if($propale->statut==0 && defined("PROPALE_DRAFT_WATERMARK") )
if($object->statut==0 && defined("PROPALE_DRAFT_WATERMARK") )
{
$watermark_angle=deg2rad(55);
$watermark_x=5;
@ -365,13 +365,27 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->_out('Q');
}
$pdf->SetTextColor(0,0,0);
$posy=42;
// Caracteristiques emetteur
$pdf->SetXY($this->marge_gauche+2,$posy);
// Sender name
$pdf->SetTextColor(0,0,00);
$pdf->SetFont('Arial','B',11);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
// Sender properties
$carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->adresse);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->cp).' '.$outputlangs->convToOutputCharset($this->emetteur->ville);
$carac_emetteur .= "\n";
// Add internal contact of proposal if defined
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
if (sizeof($arrayidcontact) > 0)
{
$object->fetch_user($arrayidcontact[0]);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->fullname);
}
// Tel
if ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($this->emetteur->tel);
// Fax
@ -382,7 +396,7 @@ class pdf_propale_jaune extends ModelePDFPropales
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($this->emetteur->url);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(12,42);
$pdf->SetXY($this->marge_gauche+2,$posy+4);
$pdf->MultiCell(80,3, $carac_emetteur);
@ -403,14 +417,13 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->rect(110, 90, 90, 10);
$pdf->SetXY(10,90);
$pdf->MultiCell(110, 10, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($propale->ref));
$pdf->MultiCell(110, 10, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref));
$pdf->SetXY(110,90);
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("Date")." : " . dol_print_date($propale->date,'day',false,$outputlangs,true));
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,'day',false,$outputlangs,true));
$posy=39;
$object=$propale;
$object->fetch_client();

View File

@ -357,60 +357,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0,0,0);
}
/*
* Propose mode r<EFBFBD>glement par CHQ
*/
/*
if (defined("FACTURE_CHQ_NUMBER"))
{
if (FACTURE_CHQ_NUMBER > 0)
{
$account = new Account($this->db);
$account->fetch(FACTURE_CHQ_NUMBER);
$pdf->SetXY ($this->marge_gauche, 227);
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, "R<EFBFBD>glement par ch<63>que <20> l'ordre de ".$account->proprio." envoy<6F> <20>:",0,'L',0);
$pdf->SetXY ($this->marge_gauche, 231);
$pdf->SetFont('Arial','',8);
$pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0);
}
}
*/
/*
* Propose mode reglement par RIB
*/
/*
if (defined("FACTURE_RIB_NUMBER"))
{
if (FACTURE_RIB_NUMBER > 0)
{
$account = new Account($this->db);
$account->fetch(FACTURE_RIB_NUMBER);
$curx=$this->marge_gauche;
$cury=242;
pdf_bank($pdf,$outputlangs,$curx,$cury,$account);
}
}
*/
/*
* Conditions de r<EFBFBD>glements
*/
/* Pour l'instant les conditions de r<>glement ne sont pas g<>r<EFBFBD>es sur les propales */
/*
$pdf->SetFont('Arial','B',10);
$pdf->SetXY($this->marge_gauche, 217);
$titre = "Conditions de r<>glement:";
$pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('Arial','',10);
$pdf->SetXY(54, 217);
$pdf->MultiCell(80, 5, $prop->cond_reglement_facture,0,'L');
*/
/*
* Pied de page
*/