Qual: Removed duplicate code
This commit is contained in:
parent
a37896ae65
commit
897152a924
File diff suppressed because it is too large
Load Diff
@ -19,83 +19,94 @@
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/commande/pdf_edison.modules.php
|
||||
\ingroup commande
|
||||
\brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les commandes au mod<EFBFBD>le Edison
|
||||
\version $Id$
|
||||
*/
|
||||
/**
|
||||
\file htdocs/includes/modules/commande/pdf_edison.modules.php
|
||||
\ingroup commande
|
||||
\brief Fichier de la classe permettant de generer les commandes au modele Edison
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
/**
|
||||
\class pdf_edison
|
||||
\brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les commandes au mod<EFBFBD>le Edison
|
||||
*/
|
||||
\class pdf_edison
|
||||
\brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les commandes au mod<EFBFBD>le Edison
|
||||
*/
|
||||
|
||||
class pdf_edison extends ModelePDFCommandes
|
||||
{
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param db handler acc<EFBFBD>s base de donn<EFBFBD>e
|
||||
*/
|
||||
function pdf_edison($db=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
/** \brief Constructeur
|
||||
\param db handler acc<EFBFBD>s base de donn<EFBFBD>e
|
||||
*/
|
||||
function pdf_edison($db=0)
|
||||
{
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "edison";
|
||||
$this->description = "Modele de commande simple";
|
||||
$this->name = "edison";
|
||||
$this->description = "Modele de commande simple";
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
|
||||
$this->option_multilang = 0; // Dispo en plusieurs langues
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=10;
|
||||
$this->marge_droite=10;
|
||||
$this->marge_haute=10;
|
||||
$this->marge_basse=10;
|
||||
|
||||
$this->option_multilang = 0; // Dispo en plusieurs langues
|
||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
||||
|
||||
$this->error = "";
|
||||
}
|
||||
|
||||
$this->error = "";
|
||||
}
|
||||
|
||||
|
||||
/** \brief Renvoi derni<EFBFBD>re erreur
|
||||
\return string Derni<EFBFBD>re erreur
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
|
||||
/** \brief Renvoi derni<EFBFBD>re erreur
|
||||
\return string Derni<EFBFBD>re erreur
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction g<EFBFBD>n<EFBFBD>rant la commande sur le disque
|
||||
\param id id de la propale <EFBFBD> g<EFBFBD>n<EFBFBD>rer
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
\brief Fonction generant la commande sur le disque
|
||||
\param com id de la propale a generer
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($com,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs,$mysco;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
// D<EFBFBD>finition de l'objet $com (pour compatibilite ascendante)
|
||||
if (! is_object($com))
|
||||
{
|
||||
$id = $com;
|
||||
$com = new Commande($this->db,"",$id);
|
||||
$ret=$com->fetch($id);
|
||||
|
||||
// Definition de l'objet $com (pour compatibilite ascendante)
|
||||
if (! is_object($com))
|
||||
{
|
||||
$id = $com;
|
||||
$com = new Commande($this->db,"",$id);
|
||||
$ret=$com->fetch($id);
|
||||
}
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
// D<EFBFBD>finition de $dir et $file
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
// Definition of $dir and $file
|
||||
if ($com->specimen)
|
||||
{
|
||||
$dir = $conf->commande->dir_output;
|
||||
@ -107,7 +118,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$dir = $conf->commande->dir_output . "/" . $comref;
|
||||
$file = $dir . "/" . $comref . ".pdf";
|
||||
}
|
||||
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (create_exdir($dir) < 0)
|
||||
@ -117,85 +128,85 @@ class pdf_edison extends ModelePDFCommandes
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||
$pdfownerpass = NULL; // Mot de passe du propri<72>taire, cr<63><72> al<61>atoirement si pas d<>fini
|
||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf=new FPDI('P','mm',$this->format);
|
||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||
$pdfownerpass = NULL; // Mot de passe du propri<72>taire, cr<63><72> al<61>atoirement si pas d<>fini
|
||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf=new FPDI('P','mm',$this->format);
|
||||
}
|
||||
|
||||
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetTitle($com->ref);
|
||||
$pdf->SetSubject($langs->transnoentities("Order"));
|
||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($user->fullname);
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
$pdf->SetTitle($com->ref);
|
||||
$pdf->SetSubject($langs->transnoentities("Order"));
|
||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($user->fullname);
|
||||
|
||||
$this->_pagehead($pdf, $com, 1, $outputlangs);
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
$this->_pagehead($pdf, $com, 1, $outputlangs);
|
||||
|
||||
|
||||
$tab_top = 100;
|
||||
$tab_height = 140;
|
||||
|
||||
|
||||
$pdf->SetFillColor(220,220,220);
|
||||
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','', 10);
|
||||
|
||||
|
||||
$pdf->SetXY (10, $tab_top + 10 );
|
||||
|
||||
|
||||
$iniY = $pdf->GetY();
|
||||
$curY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY();
|
||||
$nblignes = sizeof($com->lignes);
|
||||
|
||||
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
|
||||
|
||||
$curY = $nexY;
|
||||
|
||||
|
||||
$pdf->SetXY (30, $curY );
|
||||
|
||||
|
||||
$pdf->MultiCell(100, 5, $com->lignes[$i]->desc, 0, 'J', 0);
|
||||
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
|
||||
$pdf->SetXY (10, $curY );
|
||||
|
||||
|
||||
$pdf->MultiCell(20, 5, $com->lignes[$i]->ref, 0, 'C');
|
||||
|
||||
|
||||
$pdf->SetXY (133, $curY );
|
||||
$pdf->MultiCell(10, 5, $com->lignes[$i]->tva_tx, 0, 'C');
|
||||
|
||||
|
||||
$pdf->SetXY (145, $curY );
|
||||
$pdf->MultiCell(10, 5, $com->lignes[$i]->qty, 0, 'C');
|
||||
|
||||
|
||||
$pdf->SetXY (156, $curY );
|
||||
$pdf->MultiCell(18, 5, price($com->lignes[$i]->price), 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->SetXY (174, $curY );
|
||||
$total = price($com->lignes[$i]->total_ht);
|
||||
$pdf->MultiCell(26, 5, $total, 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->line(10, $curY, 200, $curY );
|
||||
|
||||
|
||||
if ($nexY > 240 && $i < $nblignes - 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
|
||||
@ -206,130 +217,129 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->SetFont('Arial','', 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
$tab2_top = 241;
|
||||
$tab2_lh = 7;
|
||||
$tab2_height = $tab2_lh * 4;
|
||||
|
||||
|
||||
$pdf->SetFont('Arial','', 11);
|
||||
|
||||
|
||||
$pdf->Rect(132, $tab2_top, 68, $tab2_height);
|
||||
|
||||
|
||||
$pdf->line(132, $tab2_top + $tab2_height - ($tab2_lh*3), 200, $tab2_top + $tab2_height - ($tab2_lh*3) );
|
||||
$pdf->line(132, $tab2_top + $tab2_height - ($tab2_lh*2), 200, $tab2_top + $tab2_height - ($tab2_lh*2) );
|
||||
$pdf->line(132, $tab2_top + $tab2_height - $tab2_lh, 200, $tab2_top + $tab2_height - $tab2_lh );
|
||||
|
||||
|
||||
$pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
|
||||
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + 0);
|
||||
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalHT"), 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_lh);
|
||||
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("Reduction"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_lh*2);
|
||||
$pdf->MultiCell(42, $tab2_lh, "Total HT apr<70>s remise", 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_lh*3);
|
||||
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalVAT"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + ($tab2_lh*4));
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + ($tab2_lh*2));
|
||||
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalTTC"), 1, 'R', 1);
|
||||
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + 0);
|
||||
$pdf->MultiCell(26, $tab2_lh, price($com->total_ht + $com->remise), 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_lh);
|
||||
$pdf->MultiCell(26, $tab2_lh, price($com->remise), 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_lh*2);
|
||||
$pdf->MultiCell(26, $tab2_lh, price($com->total_ht), 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_lh*3);
|
||||
$pdf->MultiCell(26, $tab2_lh, price($com->total_tva), 0, 'R', 0);
|
||||
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + ($tab2_lh*4));
|
||||
$pdf->MultiCell(26, $tab2_lh, price($com->total_ttc), 1, 'R', 1);
|
||||
|
||||
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$com,$outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file);
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$outputlangs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||
else
|
||||
{
|
||||
$this->error=$outputlangs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->error=$outputlangs->transnoentities("ErrorUnknown");
|
||||
$this->error=$outputlangs->transnoentities("ErrorUnknown");
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 0; // Erreur par defaut
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$pdf->SetFont('Arial','',11);
|
||||
|
||||
$pdf->Text(30,$tab_top + 5,$langs->transnoentities("Designation"));
|
||||
|
||||
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
$pdf->Text(134,$tab_top + 5,$langs->transnoentities("VAT"));
|
||||
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->Text(147,$tab_top + 5,$langs->transnoentities("Qty"));
|
||||
|
||||
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
|
||||
$pdf->Text(160,$tab_top + 5,$langs->transnoentities("PriceU"));
|
||||
|
||||
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
|
||||
$pdf->Text(187,$tab_top + 5,$langs->transnoentities("Total"));
|
||||
|
||||
// $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top);
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
$pdf->SetFont('Arial','',11);
|
||||
|
||||
$pdf->Text(30,$tab_top + 5,$langs->transnoentities("Designation"));
|
||||
|
||||
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
$pdf->Text(134,$tab_top + 5,$langs->transnoentities("VAT"));
|
||||
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->Text(147,$tab_top + 5,$langs->transnoentities("Qty"));
|
||||
|
||||
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
|
||||
$pdf->Text(160,$tab_top + 5,$langs->transnoentities("PriceU"));
|
||||
|
||||
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
|
||||
$pdf->Text(187,$tab_top + 5,$langs->transnoentities("Total"));
|
||||
|
||||
// $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top);
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
|
||||
$pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
|
||||
$pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function _pagehead(&$pdf, $com)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
$langs->load("orders");
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($com->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
|
||||
$watermark_x=5;
|
||||
$watermark_y=$this->page_hauteur-25; //Set to $this->page_hauteur-50 or less if problems
|
||||
$watermark_width=$this->page_hauteur;
|
||||
$pdf->SetFont('Arial','B',50);
|
||||
$pdf->SetTextColor(255,192,203);
|
||||
//rotate
|
||||
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$pdf->k,($pdf->h-$watermark_y)*$pdf->k,-$watermark_x*$pdf->k,-($pdf->h-$watermark_y)*$pdf->k));
|
||||
//print watermark
|
||||
$pdf->SetXY($watermark_x,$watermark_y);
|
||||
$pdf->Cell($watermark_width,25,clean_html($conf->global->COMMANDE_DRAFT_WATERMARK),0,2,"C",0);
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
}
|
||||
//Print content
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($com->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
|
||||
$watermark_x=5;
|
||||
$watermark_y=$this->page_hauteur-25; //Set to $this->page_hauteur-50 or less if problems
|
||||
$watermark_width=$this->page_hauteur;
|
||||
$pdf->SetFont('Arial','B',50);
|
||||
$pdf->SetTextColor(255,192,203);
|
||||
//rotate
|
||||
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$pdf->k,($pdf->h-$watermark_y)*$pdf->k,-$watermark_x*$pdf->k,-($pdf->h-$watermark_y)*$pdf->k));
|
||||
//print watermark
|
||||
$pdf->SetXY($watermark_x,$watermark_y);
|
||||
$pdf->Cell($watermark_width,25,clean_html($conf->global->COMMANDE_DRAFT_WATERMARK),0,2,"C",0);
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
}
|
||||
//Print content
|
||||
|
||||
$pdf->SetXY(10,8);
|
||||
if (defined("MAIN_INFO_SOCIETE_NOM"))
|
||||
{
|
||||
@ -337,8 +347,8 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->SetFont('Arial','B',14);
|
||||
$pdf->MultiCell(76, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetX(10);
|
||||
|
||||
$pdf->SetX(10);
|
||||
$pdf->SetTextColor(70,70,170);
|
||||
if (defined("FAC_PDF_ADRESSE"))
|
||||
{
|
||||
@ -355,7 +365,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
|
||||
}
|
||||
|
||||
|
||||
if (defined("FAC_PDF_INTITULE2"))
|
||||
{
|
||||
$pdf->SetXY(100,5);
|
||||
@ -364,8 +374,8 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->MultiCell(100, 10, FAC_PDF_INTITULE2, '' , 'R');
|
||||
}
|
||||
/*
|
||||
* Adresse Client
|
||||
*/
|
||||
* Adresse Client
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$client = new Societe($this->db);
|
||||
@ -377,16 +387,22 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->SetXY(102,$pdf->GetY());
|
||||
$pdf->MultiCell(96,5, $com->client->adresse . "\n" . $com->client->cp . " " . $com->client->ville);
|
||||
$pdf->rect(100, 40, 100, 40);
|
||||
|
||||
|
||||
|
||||
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->Text(11, 88, "Date : " . dolibarr_print_date($com->date,'day'));
|
||||
$pdf->Text(11, 94, $langs->transnoentities("Order")." ".$com->ref);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Affiche le pied de page
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _pagefoot(&$pdf,$object,$outputlangs)
|
||||
{
|
||||
return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
||||
/**
|
||||
\file htdocs/includes/modules/facture/pdf_crabe.modules.php
|
||||
\ingroup facture
|
||||
\brief Fichier de la classe permettant de g�n�rer les factures au mod�le Crabe
|
||||
\brief File of class to generate invoices from crab model
|
||||
\author Laurent Destailleur
|
||||
\version $Id$
|
||||
*/
|
||||
@ -43,9 +43,9 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler accès base de donn�e
|
||||
*/
|
||||
* \brief Constructor
|
||||
* \param db Database handler
|
||||
*/
|
||||
function pdf_crabe($db)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
@ -384,7 +384,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
}
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$outputlangs);
|
||||
$this->_pagefoot($pdf,$fac,$outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
@ -1174,82 +1174,13 @@ class pdf_crabe extends ModelePDFFactures
|
||||
/**
|
||||
* \brief Show footer of page
|
||||
* \param pdf Object PDF
|
||||
* \param object Object invoice
|
||||
* \param outputlang Object lang for output
|
||||
* \remarks Need this->emetteur object
|
||||
*/
|
||||
function _pagefoot(&$pdf,$outputlangs)
|
||||
function _pagefoot(&$pdf,$object,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Line of free text
|
||||
$ligne=(! empty($conf->global->FACTURE_FREE_TEXT))?$conf->global->FACTURE_FREE_TEXT:"";
|
||||
|
||||
// Premiere ligne d'info réglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
// Prof Id
|
||||
if ($this->emetteur->profid2)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
|
||||
}
|
||||
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
|
||||
}
|
||||
|
||||
// Deuxieme ligne d'info réglementaires
|
||||
$ligne2="";
|
||||
if ($this->emetteur->profid3)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
|
||||
}
|
||||
if ($this->emetteur->profid4)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
|
||||
}
|
||||
if ($this->emetteur->tva_intra != '')
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','',7);
|
||||
$pdf->SetDrawColor(224,224,224);
|
||||
|
||||
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
|
||||
$posy=$this->marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
|
||||
if ($ligne)
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
|
||||
$posy-=9; // 6 of ligne + 3 of MultiCell
|
||||
}
|
||||
|
||||
$pdf->SetY(-$posy);
|
||||
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
|
||||
$posy--;
|
||||
|
||||
if ($ligne1)
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
|
||||
}
|
||||
|
||||
if ($ligne2)
|
||||
{
|
||||
$posy-=3;
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
|
||||
}
|
||||
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -18,90 +18,93 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/facture/pdf_oursin.modules.php
|
||||
\ingroup facture
|
||||
\brief Fichier de la classe permettant de générer les factures au modèle oursin
|
||||
\author Sylvain SCATTOLINI basé sur un modèle de Laurent Destailleur
|
||||
\version $Revision$
|
||||
*/
|
||||
\file htdocs/includes/modules/facture/pdf_oursin.modules.php
|
||||
\ingroup facture
|
||||
\brief Fichier de la classe permettant de générer les factures au modèle oursin
|
||||
\author Sylvain SCATTOLINI basé sur un modèle de Laurent Destailleur
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
/**
|
||||
\class pdf_oursin
|
||||
\brief Classe permettant de générer les factures au modèle oursin
|
||||
*/
|
||||
\class pdf_oursin
|
||||
\brief Classe permettant de générer les factures au modèle oursin
|
||||
*/
|
||||
|
||||
class pdf_oursin extends ModelePDFFactures
|
||||
{
|
||||
var $emetteur; // Objet societe qui emet
|
||||
var $marges=array("g"=>10,"h"=>5,"d"=>10,"b"=>15);
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db handler accès base de donnée
|
||||
*/
|
||||
function pdf_oursin($db)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "oursin";
|
||||
$this->description = $langs->transnoentities('PDFOursinDescription');
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
|
||||
$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 règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
|
||||
$this->option_condreg = 1; // Affiche conditions règlement
|
||||
$this->option_codeproduitservice = 1; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 1; // Gère les avoirs
|
||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
||||
var $emetteur; // Objet societe qui emet
|
||||
var $marges=array("g"=>10,"h"=>5,"d"=>10,"b"=>15);
|
||||
|
||||
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
|
||||
$this->franchise=1;
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction générant la facture sur le disque
|
||||
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||
* \param outputlangs Lang object for output language
|
||||
* \return int 1=ok, 0=ko
|
||||
*/
|
||||
\brief Constructeur
|
||||
\param db handler accès base de donnée
|
||||
*/
|
||||
function pdf_oursin($db)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "oursin";
|
||||
$this->description = $langs->transnoentities('PDFOursinDescription');
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=10;
|
||||
$this->marge_droite=10;
|
||||
$this->marge_haute=10;
|
||||
$this->marge_basse=10;
|
||||
|
||||
$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 règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
|
||||
$this->option_condreg = 1; // Affiche conditions règlement
|
||||
$this->option_codeproduitservice = 1; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 1; // Gère les avoirs
|
||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
||||
|
||||
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
|
||||
$this->franchise=1;
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction générant la facture sur le disque
|
||||
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||
* \param outputlangs Lang object for output language
|
||||
* \return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($fac,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
// Définition de l'objet $fac (pour compatibilite ascendante)
|
||||
@ -115,7 +118,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$deja_regle = $fac->getSommePaiement();
|
||||
$amount_credit_not_included = $fac->getSommeCreditNote();
|
||||
|
||||
|
||||
|
||||
// Définition de $dir et $file
|
||||
if ($fac->specimen)
|
||||
{
|
||||
@ -141,7 +144,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
|
||||
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
@ -342,7 +345,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
}
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf, $fac);
|
||||
$this->_pagefoot($pdf, $fac, $outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
@ -372,9 +375,9 @@ class pdf_oursin extends ModelePDFFactures
|
||||
|
||||
|
||||
/**
|
||||
* \brief Affiche tableau des versement
|
||||
* \param pdf Objet PDF
|
||||
* \param fac Objet facture
|
||||
* \brief Affiche tableau des versement
|
||||
* \param pdf Objet PDF
|
||||
* \param fac Objet facture
|
||||
* \param posy Position y in PDF
|
||||
* \param outputlangs Object langs for output
|
||||
* \return int <0 if KO, >0 if OK
|
||||
@ -402,7 +405,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0);
|
||||
|
||||
$y=0;
|
||||
|
||||
|
||||
// Loop on each credit note included
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql.= " re.description, re.fk_facture_source, re.fk_facture_source";
|
||||
@ -412,7 +415,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
$i=0;
|
||||
$invoice=new Facture($this->db);
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -421,25 +424,25 @@ class pdf_oursin extends ModelePDFFactures
|
||||
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
|
||||
$pdf->SetXY ($tab3_posx, $tab3_top+$y );
|
||||
$pdf->MultiCell(20, 4,'', 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 4, price($obj->amount_ttc), 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 4, $outputlangs->trans("CreditNote"), 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 4, $invoice->ref, 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx, $tab3_top+$y );
|
||||
$pdf->MultiCell(20, 4,'', 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 4, price($obj->amount_ttc), 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 4, $outputlangs->trans("CreditNote"), 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
|
||||
$pdf->MultiCell(20, 4, $invoice->ref, 0, 'L', 0);
|
||||
|
||||
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 );
|
||||
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 );
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$outputlangs->trans("ErrorSQL")." sql=".$sql;
|
||||
$this->error=$outputlangs->trans("ErrorSQL")." sql=".$sql;
|
||||
dolibarr_syslog($this->db,$this->error);
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Loop on each payment
|
||||
@ -465,27 +468,27 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
|
||||
switch ($row[2])
|
||||
{
|
||||
case 1:
|
||||
$oper = 'TIP';
|
||||
break;
|
||||
case 2:
|
||||
$oper = 'VIR';
|
||||
break;
|
||||
case 3:
|
||||
$oper = 'PRE';
|
||||
break;
|
||||
case 4:
|
||||
$oper = 'LIQ';
|
||||
break;
|
||||
case 5:
|
||||
$oper = 'VAD';
|
||||
break;
|
||||
case 6:
|
||||
$oper = 'CB';
|
||||
break;
|
||||
case 7:
|
||||
$oper = 'CHQ';
|
||||
break;
|
||||
case 1:
|
||||
$oper = 'TIP';
|
||||
break;
|
||||
case 2:
|
||||
$oper = 'VIR';
|
||||
break;
|
||||
case 3:
|
||||
$oper = 'PRE';
|
||||
break;
|
||||
case 4:
|
||||
$oper = 'LIQ';
|
||||
break;
|
||||
case 5:
|
||||
$oper = 'VAD';
|
||||
break;
|
||||
case 6:
|
||||
$oper = 'CB';
|
||||
break;
|
||||
case 7:
|
||||
$oper = 'CHQ';
|
||||
break;
|
||||
}
|
||||
$pdf->MultiCell(20, 4, $oper, 0, 'L', 0);
|
||||
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
|
||||
@ -506,11 +509,11 @@ class pdf_oursin extends ModelePDFFactures
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche le total à payer
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
* \param deja_regle montant deja regle
|
||||
*/
|
||||
* \brief Affiche le total à payer
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
* \param deja_regle montant deja regle
|
||||
*/
|
||||
function _tableau_tot(&$pdf, $fac, $deja_regle)
|
||||
{
|
||||
global $langs;
|
||||
@ -525,8 +528,8 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$pdf->SetXY ($this->marges['g'], $tab2_top + 0);
|
||||
|
||||
/*
|
||||
* If France, show VAT mention if not applicable
|
||||
*/
|
||||
* If France, show VAT mention if not applicable
|
||||
*/
|
||||
if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1)
|
||||
{
|
||||
$pdf->MultiCell(100, $tab2_hl, $langs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
@ -576,275 +579,233 @@ class pdf_oursin extends ModelePDFFactures
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche la grille des lignes de factures
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $fac)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$pdf->line( $this->marges['g'], $tab_top+8, 210-$this->marges['d'], $tab_top+8 );
|
||||
$pdf->line( $this->marges['g'], $tab_top + $tab_height, 210-$this->marges['d'], $tab_top + $tab_height );
|
||||
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
|
||||
$pdf->Text($this->marges['g']+2,$tab_top + 5, $langs->transnoentities("Designation"));
|
||||
if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $langs->transnoentities("VAT"));
|
||||
$pdf->Text($this->marges['g']+135, $tab_top + 5,$langs->transnoentities("PriceUHT"));
|
||||
$pdf->Text($this->marges['g']+153, $tab_top + 5, $langs->transnoentities("Qty"));
|
||||
|
||||
$nblignes = sizeof($fac->lignes);
|
||||
$rem=0;
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
if ($fac->lignes[$i]->remise_percent)
|
||||
/*
|
||||
* \brief Affiche la grille des lignes de factures
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $fac)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$pdf->line( $this->marges['g'], $tab_top+8, 210-$this->marges['d'], $tab_top+8 );
|
||||
$pdf->line( $this->marges['g'], $tab_top + $tab_height, 210-$this->marges['d'], $tab_top + $tab_height );
|
||||
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
|
||||
$pdf->Text($this->marges['g']+2,$tab_top + 5, $langs->transnoentities("Designation"));
|
||||
if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $langs->transnoentities("VAT"));
|
||||
$pdf->Text($this->marges['g']+135, $tab_top + 5,$langs->transnoentities("PriceUHT"));
|
||||
$pdf->Text($this->marges['g']+153, $tab_top + 5, $langs->transnoentities("Qty"));
|
||||
|
||||
$nblignes = sizeof($fac->lignes);
|
||||
$rem=0;
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
if ($fac->lignes[$i]->remise_percent)
|
||||
{
|
||||
$rem=1;
|
||||
}
|
||||
if ($rem==1)
|
||||
{
|
||||
$pdf->Text($this->marges['g']+163, $tab_top + 5,'Rem.');
|
||||
}
|
||||
$pdf->Text($this->marges['g']+175, $tab_top + 5, $langs->transnoentities("TotalHT"));
|
||||
}
|
||||
if ($rem==1)
|
||||
{
|
||||
$pdf->Text($this->marges['g']+163, $tab_top + 5,'Rem.');
|
||||
}
|
||||
$pdf->Text($this->marges['g']+175, $tab_top + 5, $langs->transnoentities("TotalHT"));
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche en-tête facture
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
*/
|
||||
function _pagehead(&$pdf, $fac)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("propal");
|
||||
$langs->load("companies");
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($fac->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
|
||||
/*
|
||||
* \brief Affiche en-tête facture
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
*/
|
||||
function _pagehead(&$pdf, $fac)
|
||||
{
|
||||
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
|
||||
$watermark_x=5;
|
||||
$watermark_y=$this->page_hauteur-50;
|
||||
$watermark_width=$this->page_hauteur;
|
||||
$pdf->SetFont('Arial','B',50);
|
||||
$pdf->SetTextColor(255,192,203);
|
||||
//rotate
|
||||
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$pdf->k,($pdf->h-$watermark_y)*$pdf->k,-$watermark_x*$pdf->k,-($pdf->h-$watermark_y)*$pdf->k));
|
||||
//print watermark
|
||||
$pdf->SetXY($watermark_x,$watermark_y);
|
||||
$pdf->Cell($watermark_width,25,clean_html($conf->global->FACTURE_DRAFT_WATERMARK),0,2,"C",0);
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("propal");
|
||||
$langs->load("companies");
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($fac->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
|
||||
$watermark_x=5;
|
||||
$watermark_y=$this->page_hauteur-50;
|
||||
$watermark_width=$this->page_hauteur;
|
||||
$pdf->SetFont('Arial','B',50);
|
||||
$pdf->SetTextColor(255,192,203);
|
||||
//rotate
|
||||
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$pdf->k,($pdf->h-$watermark_y)*$pdf->k,-$watermark_x*$pdf->k,-($pdf->h-$watermark_y)*$pdf->k));
|
||||
//print watermark
|
||||
$pdf->SetXY($watermark_x,$watermark_y);
|
||||
$pdf->Cell($watermark_width,25,clean_html($conf->global->FACTURE_DRAFT_WATERMARK),0,2,"C",0);
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
}
|
||||
//Print content
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',13);
|
||||
|
||||
$pdf->SetXY($this->marges['g'],6);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$taille=getimagesize($logo);
|
||||
$longueur=$taille[0]/2.835;
|
||||
$pdf->Image($logo, $this->marges['g'], $this->marges['h'], 0, 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',8);
|
||||
$pdf->MultiCell(80, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(80, 3, $langs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else if (defined("FAC_PDF_INTITULE"))
|
||||
{
|
||||
$pdf->MultiCell(80, 6, FAC_PDF_INTITULE, 0, 'L');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Emetteur
|
||||
*/
|
||||
$posy=$this->marges['h']+24;
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY($this->marges['g'],$posy-5);
|
||||
|
||||
|
||||
$pdf->SetXY($this->marges['g'],$posy);
|
||||
$pdf->SetFillColor(255,255,255);
|
||||
$pdf->MultiCell(82, 34, "", 0, 'R', 1);
|
||||
|
||||
|
||||
$pdf->SetXY($this->marges['g'],$posy+4);
|
||||
|
||||
// Nom emetteur
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) // Prioritaire sur MAIN_INFO_SOCIETE_NOM
|
||||
{
|
||||
$pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
|
||||
}
|
||||
else // Par defaut
|
||||
{
|
||||
$pdf->MultiCell(80, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L');
|
||||
}
|
||||
|
||||
// Caractéristiques emetteur
|
||||
$pdf->SetFont('Arial','',9);
|
||||
if (defined("FAC_PDF_ADRESSE"))
|
||||
{
|
||||
$pdf->MultiCell(80, 4, FAC_PDF_ADRESSE);
|
||||
}
|
||||
if (defined("FAC_PDF_TEL") && FAC_PDF_TEL)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transnoentities("Phone").": ".FAC_PDF_TEL);
|
||||
}
|
||||
if (defined("FAC_PDF_MEL") && FAC_PDF_MEL)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transnoentities("Email").": ".FAC_PDF_MEL);
|
||||
}
|
||||
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transnoentities("Web").": ".FAC_PDF_WWW);
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','',7);
|
||||
if (defined("MAIN_INFO_SIREN") && MAIN_INFO_SIREN)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".MAIN_INFO_SIREN);
|
||||
}
|
||||
elseif (defined("MAIN_INFO_SIRET") && MAIN_INFO_SIRET)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".MAIN_INFO_SIRET);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Client
|
||||
*/
|
||||
$posy=45;
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY($this->marges['g']+100,$posy-5);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$fac->fetch_client();
|
||||
$pdf->SetXY($this->marges['g']+100,$posy+4);
|
||||
$pdf->MultiCell(86,4, $fac->client->nom, 0, 'L');
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->SetXY($this->marges['g']+100,$posy+12);
|
||||
$pdf->MultiCell(86,4, $fac->client->adresse . "\n\n" . $fac->client->cp . " " . $fac->client->ville);
|
||||
|
||||
/*
|
||||
* ref facture
|
||||
*/
|
||||
$posy=65;
|
||||
$pdf->SetFont('Arial','B',13);
|
||||
$pdf->SetXY($this->marges['g'],$posy);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->MultiCell(100, 10, $langs->transnoentities("Bill").' '.$langs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y"), '' , 'L');
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetXY($this->marges['g'],$posy+6);
|
||||
$pdf->SetTextColor(22,137,210);
|
||||
$pdf->MultiCell(100, 10, $langs->transnoentities("RefBill")." : " . $fac->ref, '', 'L');
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
/*
|
||||
* ref projet
|
||||
*/
|
||||
if ($fac->projetid > 0)
|
||||
{
|
||||
$projet = New Project($fac->db);
|
||||
$projet->fetch($fac->projetid);
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->MultiCell(60, 4, $langs->transnoentities("Project")." : ".$projet->title);
|
||||
}
|
||||
|
||||
/*
|
||||
* ref propal
|
||||
*/
|
||||
$sql = "SELECT ".$fac->db->pdate("p.datep")." as dp, p.ref, p.rowid as propalid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $fac->id";
|
||||
$result = $fac->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objp = $fac->db->fetch_object();
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->MultiCell(60, 4, $langs->transnoentities("RefProposal")." : ".$objp->ref);
|
||||
}
|
||||
|
||||
/*
|
||||
* monnaie
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
|
||||
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
|
||||
/*
|
||||
*/
|
||||
|
||||
}
|
||||
//Print content
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',13);
|
||||
|
||||
$pdf->SetXY($this->marges['g'],6);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$taille=getimagesize($logo);
|
||||
$longueur=$taille[0]/2.835;
|
||||
$pdf->Image($logo, $this->marges['g'], $this->marges['h'], 0, 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',8);
|
||||
$pdf->MultiCell(80, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(80, 3, $langs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else if (defined("FAC_PDF_INTITULE"))
|
||||
{
|
||||
$pdf->MultiCell(80, 6, FAC_PDF_INTITULE, 0, 'L');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Emetteur
|
||||
*/
|
||||
$posy=$this->marges['h']+24;
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY($this->marges['g'],$posy-5);
|
||||
|
||||
|
||||
$pdf->SetXY($this->marges['g'],$posy);
|
||||
$pdf->SetFillColor(255,255,255);
|
||||
$pdf->MultiCell(82, 34, "", 0, 'R', 1);
|
||||
|
||||
|
||||
$pdf->SetXY($this->marges['g'],$posy+4);
|
||||
|
||||
// Nom emetteur
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) // Prioritaire sur MAIN_INFO_SOCIETE_NOM
|
||||
{
|
||||
$pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
|
||||
}
|
||||
else // Par defaut
|
||||
{
|
||||
$pdf->MultiCell(80, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L');
|
||||
}
|
||||
|
||||
// Caractéristiques emetteur
|
||||
$pdf->SetFont('Arial','',9);
|
||||
if (defined("FAC_PDF_ADRESSE"))
|
||||
{
|
||||
$pdf->MultiCell(80, 4, FAC_PDF_ADRESSE);
|
||||
}
|
||||
if (defined("FAC_PDF_TEL") && FAC_PDF_TEL)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transnoentities("Phone").": ".FAC_PDF_TEL);
|
||||
}
|
||||
if (defined("FAC_PDF_MEL") && FAC_PDF_MEL)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transnoentities("Email").": ".FAC_PDF_MEL);
|
||||
}
|
||||
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transnoentities("Web").": ".FAC_PDF_WWW);
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','',7);
|
||||
if (defined("MAIN_INFO_SIREN") && MAIN_INFO_SIREN)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".MAIN_INFO_SIREN);
|
||||
}
|
||||
elseif (defined("MAIN_INFO_SIRET") && MAIN_INFO_SIRET)
|
||||
{
|
||||
$pdf->MultiCell(80, 4, $langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".MAIN_INFO_SIRET);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Client
|
||||
*/
|
||||
$posy=45;
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY($this->marges['g']+100,$posy-5);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$fac->fetch_client();
|
||||
$pdf->SetXY($this->marges['g']+100,$posy+4);
|
||||
$pdf->MultiCell(86,4, $fac->client->nom, 0, 'L');
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->SetXY($this->marges['g']+100,$posy+12);
|
||||
$pdf->MultiCell(86,4, $fac->client->adresse . "\n\n" . $fac->client->cp . " " . $fac->client->ville);
|
||||
|
||||
/*
|
||||
* ref facture
|
||||
*/
|
||||
$posy=65;
|
||||
$pdf->SetFont('Arial','B',13);
|
||||
$pdf->SetXY($this->marges['g'],$posy);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->MultiCell(100, 10, $langs->transnoentities("Bill").' '.$langs->transnoentities("Of").' '.dolibarr_print_date($fac->date,"%d %B %Y"), '' , 'L');
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetXY($this->marges['g'],$posy+6);
|
||||
$pdf->SetTextColor(22,137,210);
|
||||
$pdf->MultiCell(100, 10, $langs->transnoentities("RefBill")." : " . $fac->ref, '', 'L');
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
/*
|
||||
* ref projet
|
||||
*/
|
||||
if ($fac->projetid > 0)
|
||||
{
|
||||
$projet = New Project($fac->db);
|
||||
$projet->fetch($fac->projetid);
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->MultiCell(60, 4, $langs->transnoentities("Project")." : ".$projet->title);
|
||||
}
|
||||
|
||||
/*
|
||||
* ref propal
|
||||
*/
|
||||
$sql = "SELECT ".$fac->db->pdate("p.datep")." as dp, p.ref, p.rowid as propalid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $fac->id";
|
||||
$result = $fac->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objp = $fac->db->fetch_object();
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->MultiCell(60, 4, $langs->transnoentities("RefProposal")." : ".$objp->ref);
|
||||
}
|
||||
|
||||
/*
|
||||
* monnaie
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
|
||||
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
|
||||
/*
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche le pied de page de la facture
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
*/
|
||||
function _pagefoot(&$pdf, $fac)
|
||||
{
|
||||
global $langs, $conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("companies");
|
||||
|
||||
$footy=13;
|
||||
$pdf->SetFont('Arial','',8);
|
||||
|
||||
$ligne="";
|
||||
if (defined('MAIN_INFO_CAPITAL') && MAIN_INFO_CAPITAL) {
|
||||
$ligne=$langs->transnoentities('LimitedLiabilityCompanyCapital').' '. MAIN_INFO_CAPITAL." ".$langs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
if (defined('MAIN_INFO_SIREN') && MAIN_INFO_SIREN) {
|
||||
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".MAIN_INFO_SIREN;
|
||||
}
|
||||
if (defined('MAIN_INFO_SIRET') && MAIN_INFO_SIRET) {
|
||||
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".MAIN_INFO_SIRET;
|
||||
}
|
||||
if (defined('MAIN_INFO_RCS') && MAIN_INFO_RCS) {
|
||||
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".MAIN_INFO_RCS;
|
||||
}
|
||||
if ($ligne) {
|
||||
$pdf->SetY(-$footy);
|
||||
$pdf->MultiCell(190, 3, $ligne, 0, 'C');
|
||||
$footy-=3;
|
||||
}
|
||||
|
||||
// Affiche le numéro de TVA intracommunautaire
|
||||
if (MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') {
|
||||
$pdf->SetY(-$footy);
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',8);
|
||||
$pdf->MultiCell(190, 3, $langs->transnoentities("ErrorVATIntraNotConfigured"),0,'L',0);
|
||||
$pdf->MultiCell(190, 3, $langs->transnoentities("ErrorGoToGlobalSetup"),0,'L',0);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
}
|
||||
elseif (MAIN_INFO_TVAINTRA != '') {
|
||||
$pdf->SetY(-$footy);
|
||||
$pdf->MultiCell(190, 3, $langs->transnoentities("IntracommunityVATNumber")." : ".MAIN_INFO_TVAINTRA, 0, 'C');
|
||||
}
|
||||
|
||||
$pdf->SetXY(-15,-15);
|
||||
$pdf->MultiCell(11, 3, $pdf->PageNo().'/{nb}', 0, 'R');
|
||||
}
|
||||
/*
|
||||
* \brief Affiche le pied de page de la facture
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
*/
|
||||
function _pagefoot(&$pdf, $fac, $outputlangs)
|
||||
{
|
||||
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -20,68 +20,68 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/fichinter/pdf_soleil.modules.php
|
||||
\ingroup ficheinter
|
||||
\brief Fichier de la classe permettant de générer les fiches d'intervention au modèle Soleil
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/includes/modules/fichinter/pdf_soleil.modules.php
|
||||
\ingroup ficheinter
|
||||
\brief Fichier de la classe permettant de générer les fiches d'intervention au modèle Soleil
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/fichinter/modules_fichinter.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
\class pdf_soleil
|
||||
\brief Classe permettant de générer les fiches d'intervention au modèle Soleil
|
||||
*/
|
||||
\class pdf_soleil
|
||||
\brief Classe permettant de générer les fiches d'intervention au modèle Soleil
|
||||
*/
|
||||
|
||||
class pdf_soleil extends ModelePDFFicheinter
|
||||
{
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler accès base de donnée
|
||||
*/
|
||||
function pdf_soleil($db=0)
|
||||
{
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler accès base de donnée
|
||||
*/
|
||||
function pdf_soleil($db=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = 'soleil';
|
||||
$this->description = "Modèle de fiche d'intervention standard";
|
||||
$this->db = $db;
|
||||
$this->name = 'soleil';
|
||||
$this->description = "Modèle de fiche d'intervention standard";
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=10;
|
||||
$this->marge_droite=10;
|
||||
$this->marge_haute=10;
|
||||
$this->marge_basse=10;
|
||||
|
||||
$this->option_logo = 1; // Affiche logo
|
||||
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_modereg = 0; // Affiche mode règlement
|
||||
$this->option_condreg = 0; // Affiche conditions règlement
|
||||
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||
$this->option_multilang = 0; // Dispo en plusieurs langues
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=10;
|
||||
$this->marge_droite=10;
|
||||
$this->marge_haute=10;
|
||||
$this->marge_basse=10;
|
||||
|
||||
$this->option_logo = 1; // Affiche logo
|
||||
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_modereg = 0; // Affiche mode règlement
|
||||
$this->option_condreg = 0; // Affiche conditions règlement
|
||||
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||
$this->option_multilang = 0; // Dispo en plusieurs langues
|
||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
||||
|
||||
// Recupere code pays de l'emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->code_pays) $this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction générant la fiche d'intervention sur le disque
|
||||
\param fichinter Object fichinter
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($fichinter,$outputlangs='')
|
||||
// Recupere code pays de l'emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->code_pays) $this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction générant la fiche d'intervention sur le disque
|
||||
\param fichinter Object fichinter
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($fichinter,$outputlangs='')
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc;
|
||||
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
@ -103,7 +103,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
dolibarr_print_error($db,$fichinter->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$fichref = sanitize_string($fichinter->ref);
|
||||
$dir = $conf->fichinter->dir_output;
|
||||
if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref;
|
||||
@ -117,7 +117,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
@ -137,12 +137,15 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($fichinter->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) )
|
||||
if($fichinter->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) )
|
||||
{
|
||||
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
|
||||
$watermark_x=5;
|
||||
$watermark_y=$this->page_hauteur-50;
|
||||
$watermark_y=$this->page_hauteur-50;
|
||||
$watermark_width=$this->page_hauteur;
|
||||
$pdf->SetFont('Arial','B',50);
|
||||
$pdf->SetTextColor(255,192,203);
|
||||
@ -154,10 +157,10 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
}
|
||||
//Print content
|
||||
|
||||
//Print content
|
||||
|
||||
$posy=$this->marge_haute;
|
||||
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
@ -222,8 +225,8 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
|
||||
|
||||
/*
|
||||
* Adresse Client
|
||||
*/
|
||||
* Adresse Client
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$fichinter->fetch_client();
|
||||
@ -257,26 +260,26 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
|
||||
$pdf->SetXY (10, $tab_top + 8 );
|
||||
$pdf->writeHTMLCell(190, 5, 10, $tab_top + 8, dol_htmlentitiesbr($fichinter->description), 0, 'J', 0);
|
||||
|
||||
|
||||
//dolibarr_syslog("desc=".dol_htmlentitiesbr($fichinter->description));
|
||||
$num = sizeof($fichinter->lignes);
|
||||
$i=0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
{
|
||||
$fichinterligne = $fichinter->lignes[$i];
|
||||
|
||||
$valide = $fichinterligne->id ? $fichinterligne->fetch($fichinterligne->id) : 0;
|
||||
if ($valide>0)
|
||||
{
|
||||
$pdf->SetXY (20, $tab_top + 16 + $i * 20);
|
||||
$pdf->writeHTMLCell(190, 8, 20, $tab_top + 16 + $i * 20,
|
||||
dol_htmlentitiesbr($langs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei)." - ".$langs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0);
|
||||
|
||||
$pdf->SetXY (20, $tab_top + 22 + $i * 20);
|
||||
$pdf->writeHTMLCell(170, 8, 20, $tab_top + 22 + $i * 20,
|
||||
dol_htmlentitiesbr($fichinterligne->desc,1), 0, 'L', 0);
|
||||
$pdf->SetXY (20, $tab_top + 16 + $i * 20);
|
||||
$pdf->writeHTMLCell(190, 8, 20, $tab_top + 16 + $i * 20,
|
||||
dol_htmlentitiesbr($langs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei)." - ".$langs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0);
|
||||
|
||||
$pdf->SetXY (20, $tab_top + 22 + $i * 20);
|
||||
$pdf->writeHTMLCell(170, 8, 20, $tab_top + 22 + $i * 20,
|
||||
dol_htmlentitiesbr($fichinterligne->desc,1), 0, 'L', 0);
|
||||
$tab_height+=20;
|
||||
}
|
||||
$i++;
|
||||
@ -284,26 +287,30 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
}
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
$pdf->SetXY (10, $pdf->GetY() + 20 );
|
||||
$pdf->MultiCell(60, 5, '', 0, 'J', 0);
|
||||
$pdf->MultiCell(60, 5, '', 0, 'J', 0);
|
||||
|
||||
$pdf->SetXY(20,220);
|
||||
$pdf->MultiCell(66,5, $langs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
|
||||
$pdf->SetXY(20,220);
|
||||
$pdf->MultiCell(66,5, $langs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
|
||||
|
||||
$pdf->SetXY(20,225);
|
||||
$pdf->MultiCell(80,30, '', 1);
|
||||
$pdf->SetXY(20,225);
|
||||
$pdf->MultiCell(80,30, '', 1);
|
||||
|
||||
$pdf->SetXY(110,220);
|
||||
$pdf->MultiCell(80,5, $langs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
|
||||
$pdf->SetXY(110,220);
|
||||
$pdf->MultiCell(80,5, $langs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
|
||||
|
||||
$pdf->SetXY(110,225);
|
||||
$pdf->MultiCell(80,30, '', 1);
|
||||
$pdf->SetXY(110,225);
|
||||
$pdf->MultiCell(80,30, '', 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
|
||||
|
||||
$this->_pagefoot($pdf,$outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file);
|
||||
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -321,76 +328,14 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche le pied de page
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _pagefoot(&$pdf,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Premiere ligne d'info reglementaires
|
||||
$ligne1="";
|
||||
if ($this->emetteur->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
|
||||
}
|
||||
if ($this->emetteur->capital)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
if ($this->emetteur->profid2)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
|
||||
}
|
||||
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
|
||||
}
|
||||
|
||||
// Deuxieme ligne d'info reglementaires
|
||||
$ligne2="";
|
||||
if ($this->emetteur->profid3)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
|
||||
}
|
||||
if ($this->emetteur->profid4)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
|
||||
}
|
||||
if ($this->emetteur->tva_intra != '')
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetDrawColor(224,224,224);
|
||||
|
||||
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
|
||||
//Todo: correction provisoire afin de régler le problème du bas de page
|
||||
//$posy=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
$posy=$this->marge_basse + 11 + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
|
||||
$pdf->SetY(-$posy);
|
||||
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
|
||||
$posy--;
|
||||
|
||||
if ($ligne1)
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
|
||||
}
|
||||
|
||||
if ($ligne2)
|
||||
{
|
||||
$posy-=3;
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
|
||||
}
|
||||
|
||||
//$pdf->SetXY(-20,-$posy);
|
||||
//$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
}
|
||||
/*
|
||||
* \brief Affiche le pied de page
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _pagefoot(&$pdf,$outputlangs)
|
||||
{
|
||||
return pdf_pagefoot($pdf,$outputlangs,'FICHEINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -20,68 +20,88 @@
|
||||
*/
|
||||
|
||||
/** \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
|
||||
\version $Id$
|
||||
*/
|
||||
\ingroup propale
|
||||
\brief Fichier de la classe permettant de générer les propales au modèle Jaune
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php");
|
||||
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
|
||||
*/
|
||||
/**
|
||||
* \class pdf_propale_jaune
|
||||
* \brief Classe permettant de générer les propales au modèle Jaune
|
||||
*/
|
||||
|
||||
class pdf_propale_jaune extends ModelePDFPropales
|
||||
{
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
|
||||
/** \brief Constructeur
|
||||
\param db handler accès base de donnée
|
||||
*/
|
||||
function pdf_propale_jaune($db=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param db handler accès base de donnée
|
||||
*/
|
||||
function pdf_propale_jaune($db=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "jaune";
|
||||
$this->description = "Modèle de proposition Jaune";
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "jaune";
|
||||
$this->description = "Modèle de proposition Jaune";
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=10;
|
||||
$this->marge_droite=10;
|
||||
$this->marge_haute=10;
|
||||
$this->marge_basse=10;
|
||||
|
||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
||||
|
||||
$this->error = "";
|
||||
$this->error = "";
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas
|
||||
}
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas
|
||||
}
|
||||
|
||||
|
||||
/** \brief Renvoi dernière erreur
|
||||
\return string Dernière erreur
|
||||
*/
|
||||
\return string Dernière erreur
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Fonction générant la propale sur le disque
|
||||
\param propale Objet propal
|
||||
\brief Fonction générant la propale sur le disque
|
||||
\param propale Objet propal
|
||||
\param outputlangs Lang object for output language
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
*/
|
||||
function write_file($propale,$outputlangs='')
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
global $user,$langs,$conf;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("propal");
|
||||
$outputlangs->load("products");
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
if ($conf->propal->dir_output)
|
||||
{
|
||||
@ -117,38 +137,41 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||
$pdfownerpass = NULL; // Mot de passe du propriétaire, créé aléatoirement si pas défini
|
||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf=new FPDI('P','mm',$this->format);
|
||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||
$pdfownerpass = NULL; // Mot de passe du propriétaire, créé aléatoirement si pas défini
|
||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf=new FPDI('P','mm',$this->format);
|
||||
}
|
||||
|
||||
$pdf->Open();
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetTitle($propale->ref);
|
||||
$pdf->SetSubject("Proposition commerciale");
|
||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($user->fullname);
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$this->_pagehead($pdf, $propale);
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
// Tete de page
|
||||
$this->_pagehead($pdf, $propale, $outputlangs);
|
||||
|
||||
/*
|
||||
*/
|
||||
*/
|
||||
$tab_top = 100;
|
||||
$tab_height = 150;
|
||||
/*
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
|
||||
$pdf->SetFillColor(242,239,119);
|
||||
|
||||
@ -190,10 +213,12 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
|
||||
if ($nexY > 240 && $i < $nblignes - 1)
|
||||
{
|
||||
$this->_pagefoot($pdf,$propale,$outputlangs);
|
||||
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
|
||||
$pdf->AddPage();
|
||||
$nexY = $iniY;
|
||||
$this->_pagehead($pdf, $propale);
|
||||
$this->_pagehead($pdf, $propale, $outputlangs);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','', 10);
|
||||
}
|
||||
@ -201,8 +226,8 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
$tab2_top = 254;
|
||||
$tab2_lh = 7;
|
||||
$tab2_height = $tab2_lh * 3;
|
||||
@ -218,13 +243,13 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + 0);
|
||||
$pdf->MultiCell(42, $tab2_lh, "Total HT", 0, 'R', 0);
|
||||
$pdf->MultiCell(42, $tab2_lh, $outputlangs->trans("TotalHT"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_lh);
|
||||
$pdf->MultiCell(42, $tab2_lh, "Total TVA", 0, 'R', 0);
|
||||
$pdf->MultiCell(42, $tab2_lh, $outputlangs->trans("TotalTVA"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + ($tab2_lh*2));
|
||||
$pdf->MultiCell(42, $tab2_lh, "Total TTC", 1, 'R', 1);
|
||||
$pdf->MultiCell(42, $tab2_lh, $outputlangs->trans("TotalTTC"), 1, 'R', 1);
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + 0);
|
||||
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0);
|
||||
@ -235,58 +260,60 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->SetXY (174, $tab2_top + ($tab2_lh*2));
|
||||
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$propale,$outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file);
|
||||
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$pdf->SetFont('Arial','',11);
|
||||
$pdf->SetFont('Arial','',11);
|
||||
|
||||
$pdf->SetXY(10,$tab_top);
|
||||
$pdf->MultiCell(20,10,$langs->transnoentities("Ref"),0,'C',1);
|
||||
$pdf->SetXY(10,$tab_top);
|
||||
$pdf->MultiCell(20,10,$langs->transnoentities("Ref"),0,'C',1);
|
||||
|
||||
$pdf->SetXY(30,$tab_top);
|
||||
$pdf->MultiCell(102,10,$langs->transnoentities("Designation"),0,'L',1);
|
||||
$pdf->SetXY(30,$tab_top);
|
||||
$pdf->MultiCell(102,10,$langs->transnoentities("Designation"),0,'L',1);
|
||||
|
||||
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
$pdf->SetXY(132,$tab_top);
|
||||
$pdf->MultiCell(12, 10,$langs->transnoentities("VAT"),0,'C',1);
|
||||
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
$pdf->SetXY(132,$tab_top);
|
||||
$pdf->MultiCell(12, 10,$langs->transnoentities("VAT"),0,'C',1);
|
||||
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->SetXY(144,$tab_top);
|
||||
$pdf->MultiCell(10,10,$langs->transnoentities("Qty"),0,'C',1);
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->SetXY(144,$tab_top);
|
||||
$pdf->MultiCell(10,10,$langs->transnoentities("Qty"),0,'C',1);
|
||||
|
||||
$pdf->line(154, $tab_top, 154, $tab_top + $tab_height);
|
||||
$pdf->SetXY(154,$tab_top);
|
||||
$pdf->MultiCell(22,10,$langs->transnoentities("PriceU"),0,'R',1);
|
||||
$pdf->line(154, $tab_top, 154, $tab_top + $tab_height);
|
||||
$pdf->SetXY(154,$tab_top);
|
||||
$pdf->MultiCell(22,10,$langs->transnoentities("PriceU"),0,'R',1);
|
||||
|
||||
$pdf->line(176, $tab_top, 176, $tab_top + $tab_height);
|
||||
$pdf->SetXY(176,$tab_top);
|
||||
$pdf->MultiCell(24,10,$langs->transnoentities("Total"),0,'R',1);
|
||||
$pdf->line(176, $tab_top, 176, $tab_top + $tab_height);
|
||||
$pdf->SetXY(176,$tab_top);
|
||||
$pdf->MultiCell(24,10,$langs->transnoentities("Total"),0,'R',1);
|
||||
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
|
||||
$pdf->Text(10,280, $titre);
|
||||
}
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
}
|
||||
|
||||
function _pagehead(&$pdf, $propale)
|
||||
{
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($propale->statut==0 && defined("PROPALE_DRAFT_WATERMARK") )
|
||||
function _pagehead(&$pdf, $propale, $outputlangs)
|
||||
{
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($propale->statut==0 && defined("PROPALE_DRAFT_WATERMARK") )
|
||||
{
|
||||
$watermark_angle=deg2rad(55);
|
||||
$watermark_x=5;
|
||||
@ -302,66 +329,77 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
}
|
||||
|
||||
//print Content
|
||||
|
||||
$pdf->SetXY(12,42);
|
||||
if (defined("FAC_PDF_INTITULE"))
|
||||
{
|
||||
|
||||
//print Content
|
||||
|
||||
$pdf->SetXY(12,42);
|
||||
if (defined("FAC_PDF_INTITULE"))
|
||||
{
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
$pdf->SetFont('Arial','B',14);
|
||||
$pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L');
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(70,70,170);
|
||||
if (defined("FAC_PDF_ADRESSE"))
|
||||
{
|
||||
$pdf->SetTextColor(70,70,170);
|
||||
if (defined("FAC_PDF_ADRESSE"))
|
||||
{
|
||||
$pdf->SetX(12);
|
||||
$pdf->SetFont('Arial','',12);
|
||||
$pdf->MultiCell(76, 5, FAC_PDF_ADRESSE);
|
||||
}
|
||||
if (defined("FAC_PDF_TEL"))
|
||||
{
|
||||
}
|
||||
if (defined("FAC_PDF_TEL"))
|
||||
{
|
||||
$pdf->SetX(12);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL);
|
||||
}
|
||||
if (defined("MAIN_INFO_SIREN"))
|
||||
{
|
||||
}
|
||||
if (defined("MAIN_INFO_SIREN"))
|
||||
{
|
||||
$pdf->SetX(12);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
|
||||
}
|
||||
$pdf->rect(10, 40, 80, 40);
|
||||
|
||||
$pdf->SetXY(10,5);
|
||||
$pdf->SetFont('Arial','B',16);
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
$pdf->MultiCell(200, 20, "PROPOSITION COMMERCIALE", '' , 'C');
|
||||
|
||||
/*
|
||||
* Adresse Client
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$propale->fetch_client();
|
||||
$pdf->SetXY(102,42);
|
||||
$pdf->MultiCell(96,5, $propale->client->nom);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetXY(102,$pdf->GetY());
|
||||
$pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville);
|
||||
$pdf->rect(100, 40, 100, 40);
|
||||
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
|
||||
$pdf->rect(10, 90, 100, 10);
|
||||
$pdf->rect(110, 90, 90, 10);
|
||||
|
||||
$pdf->SetXY(10,90);
|
||||
$pdf->MultiCell(110, 10, $outputlangs->trans("Ref")." : ".$propale->ref);
|
||||
$pdf->SetXY(110,90);
|
||||
$pdf->MultiCell(100, 10, $outputlangs->trans("Date")." : " . dolibarr_print_date($propale->date,'day'));
|
||||
}
|
||||
$pdf->rect(10, 40, 80, 40);
|
||||
|
||||
$pdf->SetXY(10,5);
|
||||
$pdf->SetFont('Arial','B',16);
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
$pdf->MultiCell(200, 20, "PROPOSITION COMMERCIALE", '' , 'C');
|
||||
/*
|
||||
* \brief Affiche le pied de page
|
||||
* \param pdf Object PDF
|
||||
* \param object Object proposal
|
||||
*/
|
||||
function _pagefoot(&$pdf,$object,$outputlangs)
|
||||
{
|
||||
return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adresse Client
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$propale->fetch_client();
|
||||
$pdf->SetXY(102,42);
|
||||
$pdf->MultiCell(96,5, $propale->client->nom);
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetXY(102,$pdf->GetY());
|
||||
$pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville);
|
||||
$pdf->rect(100, 40, 100, 40);
|
||||
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
|
||||
$pdf->rect(10, 90, 100, 10);
|
||||
$pdf->rect(110, 90, 90, 10);
|
||||
|
||||
$pdf->SetXY(10,90);
|
||||
$pdf->MultiCell(110, 10, "Numéro : ".$propale->ref);
|
||||
$pdf->SetXY(110,90);
|
||||
$pdf->MultiCell(100, 10, "Date : " . dolibarr_print_date($propale->date,'day'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/company.lib.php
|
||||
\brief Ensemble de fonctions de base pour le module societe
|
||||
\ingroup societe
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/lib/company.lib.php
|
||||
\brief Ensemble de fonctions de base pour le module societe
|
||||
\ingroup societe
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
function societe_prepare_head($objsoc)
|
||||
{
|
||||
@ -57,7 +57,7 @@ function societe_prepare_head($objsoc)
|
||||
$head[$h][1] = $langs->trans("Supplier");
|
||||
$head[$h][2] = 'supplier';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
if ($conf->facture->enabled || $conf->compta->enabled || $conf->comptaexpert->enabled)
|
||||
{
|
||||
$langs->load("compta");
|
||||
@ -73,7 +73,7 @@ function societe_prepare_head($objsoc)
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans('Categories');
|
||||
$head[$h][2] = 'category';
|
||||
$h++;
|
||||
$h++;
|
||||
}
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
@ -107,7 +107,7 @@ function societe_prepare_head($objsoc)
|
||||
}
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
@ -133,36 +133,36 @@ function societe_prepare_head2($objsoc)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'company';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("BankAccount")." $account->number";
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("BankAccount")." $account->number";
|
||||
$head[$h][2] = 'rib';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = 'lien.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Links");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = 'lien.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Links");
|
||||
$head[$h][2] = 'links';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = 'commerciaux.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("SalesRepresentative");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = 'commerciaux.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("SalesRepresentative");
|
||||
$head[$h][2] = 'salesrepresentative';
|
||||
$h++;
|
||||
|
||||
$h++;
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le nom traduit ou code+nom d'un pays
|
||||
* \param id id du pays
|
||||
* \param withcode 1=affiche code + nom
|
||||
* \return string Nom traduit du pays
|
||||
*/
|
||||
* \brief Retourne le nom traduit ou code+nom d'un pays
|
||||
* \param id id du pays
|
||||
* \param withcode 1=affiche code + nom
|
||||
* \return string Nom traduit du pays
|
||||
*/
|
||||
function getCountryLabel($id,$withcode=0)
|
||||
{
|
||||
global $db,$langs;
|
||||
@ -200,7 +200,7 @@ function getFormeJuridiqueLabel($code)
|
||||
global $db,$langs;
|
||||
|
||||
if (! $code) return '';
|
||||
|
||||
|
||||
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_forme_juridique";
|
||||
$sql.= " WHERE code='$code'";
|
||||
|
||||
@ -232,316 +232,316 @@ function show_contacts($conf,$langs,$db,$objsoc)
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
|
||||
if ($conf->clicktodial->enabled)
|
||||
{
|
||||
$user->fetch_clicktodial(); // lecture des infos de clicktodial
|
||||
}
|
||||
{
|
||||
$user->fetch_clicktodial(); // lecture des infos de clicktodial
|
||||
}
|
||||
|
||||
print_titre($langs->trans("ContactsForCompany"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>';
|
||||
print "<td> </td>";
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print "</tr>";
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>';
|
||||
print "<td> </td>";
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
$sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " WHERE p.fk_soc = ".$objsoc->id;
|
||||
$sql .= " ORDER by p.datec";
|
||||
$sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " WHERE p.fk_soc = ".$objsoc->id;
|
||||
$sql .= " ORDER by p.datec";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
$result = $db->query($sql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>';
|
||||
$contactstatic->id = $obj->rowid;
|
||||
$contactstatic->name = $obj->name;
|
||||
$contactstatic->firstname = $obj->firstname;
|
||||
print $contactstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$obj->poste.'</td>';
|
||||
|
||||
// Lien click to dial
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_TEL&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print dolibarr_print_phone($obj->phone);
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>';
|
||||
$contactstatic->id = $obj->rowid;
|
||||
$contactstatic->name = $obj->name;
|
||||
$contactstatic->firstname = $obj->firstname;
|
||||
print $contactstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$obj->poste.'</td>';
|
||||
|
||||
// Lien click to dial
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_TEL&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print dolibarr_print_phone($obj->phone);
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
if ($obj->phone) print dol_phone_link($obj->phone);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_FAX&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print dolibarr_print_phone($obj->fax);
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
print ' </td>';
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_EMAIL&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print $obj->email;
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_FAX&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print dolibarr_print_phone($obj->fax);
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
print ' </td>';
|
||||
print '<td>';
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '<a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_EMAIL&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print $obj->email;
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
print '</a>';
|
||||
// \TODO
|
||||
//if ($obj->email) print dol_email_link($obj->email);
|
||||
print ' </td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print "<a href=\"../contact/fiche.php?action=edit&id=".$obj->rowid."\">";
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<td align="center"><a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print img_object($langs->trans("Rendez-Vous"),"action");
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print "<tr ".$bc[$var].">";
|
||||
//print '<td>'.$langs->trans("NoContactsYetDefined").'</td>';
|
||||
//print "</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
print ' </td>';
|
||||
|
||||
print "<br>\n";
|
||||
print '<td align="center">';
|
||||
print "<a href=\"../contact/fiche.php?action=edit&id=".$obj->rowid."\">";
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<td align="center"><a href="action/fiche.php?action=create&backtopage=1&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$objsoc->id.'">';
|
||||
print img_object($langs->trans("Rendez-Vous"),"action");
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print "<tr ".$bc[$var].">";
|
||||
//print '<td>'.$langs->trans("NoContactsYetDefined").'</td>';
|
||||
//print "</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show html area with actions to do
|
||||
*/
|
||||
* \brief Show html area with actions to do
|
||||
*/
|
||||
function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
{
|
||||
global $bc;
|
||||
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
$actionstatic=new ActionComm($db);
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
|
||||
print_titre($langs->trans("ActionsOnCompany"));
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="11"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=todo">'.$langs->trans("ActionsToDoShort").'</a></td><td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " ".$db->pdate("a.datep")." as dp,";
|
||||
$sql.= " ".$db->pdate("a.datea")." as da,";
|
||||
$sql.= " a.percent,";
|
||||
$sql.= " c.code as acode, c.libelle, a.propalrowid, a.fk_user_author, a.fk_contact,";
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="11"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=todo">'.$langs->trans("ActionsToDoShort").'</a></td><td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " ".$db->pdate("a.datep")." as dp,";
|
||||
$sql.= " ".$db->pdate("a.datea")." as da,";
|
||||
$sql.= " a.percent,";
|
||||
$sql.= " c.code as acode, c.libelle, a.propalrowid, a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " u.login, u.rowid,";
|
||||
$sql.= " sp.name, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " WHERE a.fk_soc = ".$objsoc->id;
|
||||
$sql.= " AND u.rowid = a.fk_user_author";
|
||||
$sql.= " AND c.id=a.fk_action AND a.percent < 100";
|
||||
$sql.= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
$sql.= " WHERE a.fk_soc = ".$objsoc->id;
|
||||
$sql.= " AND u.rowid = a.fk_user_author";
|
||||
$sql.= " AND c.id=a.fk_action AND a.percent < 100";
|
||||
$sql.= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
dolibarr_syslog("company.lib::show_actions_todo sql=".$sql);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->dp)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->dp);
|
||||
|
||||
print '<td width="30" align="center">' .strftime("%b",$obj->dp)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->dp);
|
||||
|
||||
print '<td width="20">'.strftime("%d",$obj->dp)."</td>\n";
|
||||
print '<td width="30" nowrap="nowrap">'.strftime("%H:%M",$obj->dp).'</td>';
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->dp)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->dp);
|
||||
|
||||
print '<td width="30" align="center">' .strftime("%b",$obj->dp)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->dp);
|
||||
|
||||
print '<td width="20">'.strftime("%d",$obj->dp)."</td>\n";
|
||||
print '<td width="30" nowrap="nowrap">'.strftime("%H:%M",$obj->dp).'</td>';
|
||||
|
||||
// Picto warning
|
||||
print '<td width="16">';
|
||||
if (date("U",$obj->dp) < time()) print ' '.img_warning("Late");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<td><a href="propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowAction"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->acode);
|
||||
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
$actionstatic->id=$obj->id;
|
||||
print '<td>'.$actionstatic->getNomUrl(1,16).'</td>';
|
||||
}
|
||||
print '<td colspan="2">'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print '<td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
|
||||
// Status/Percent
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<td><a href="propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowAction"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->acode);
|
||||
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
$actionstatic->id=$obj->id;
|
||||
print '<td>'.$actionstatic->getNomUrl(1,16).'</td>';
|
||||
}
|
||||
print '<td colspan="2">'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print '<td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Statut
|
||||
print '<td nowrap="nowrap" width="20">'.$actionstatic->LibStatut($obj->percent,3).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '<td nowrap="nowrap" width="20">'.$actionstatic->LibStatut($obj->percent,3).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Aucun action a faire
|
||||
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Show html area with actions done
|
||||
*/
|
||||
* \brief Show html area with actions done
|
||||
*/
|
||||
function show_actions_done($conf,$langs,$db,$objsoc)
|
||||
{
|
||||
global $bc;
|
||||
|
||||
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
$actionstatic=new ActionComm($db);
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="12"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=done">'.$langs->trans("ActionsDoneShort").'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " ".$db->pdate("a.datep")." as dp,";
|
||||
$sql.= " ".$db->pdate("a.datep2")." as dp2,";
|
||||
$sql.= " a.percent,";
|
||||
$sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.login, u.rowid,";
|
||||
$sql.= " sp.name, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " WHERE a.fk_soc = ".$objsoc->id;
|
||||
$sql.= " AND u.rowid = a.fk_user_author";
|
||||
$sql.= " AND c.id=a.fk_action AND a.percent = 100";
|
||||
$sql.= " ORDER BY a.datep2 DESC, a.id DESC";
|
||||
|
||||
$actionstatic=new ActionComm($db);
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="12"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=done">'.$langs->trans("ActionsDoneShort").'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " ".$db->pdate("a.datep")." as dp,";
|
||||
$sql.= " ".$db->pdate("a.datep2")." as dp2,";
|
||||
$sql.= " a.percent,";
|
||||
$sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.login, u.rowid,";
|
||||
$sql.= " sp.name, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " WHERE a.fk_soc = ".$objsoc->id;
|
||||
$sql.= " AND u.rowid = a.fk_user_author";
|
||||
$sql.= " AND c.id=a.fk_action AND a.percent = 100";
|
||||
$sql.= " ORDER BY a.datep2 DESC, a.id DESC";
|
||||
|
||||
dolibarr_syslog("comm/fiche.php sql=".$sql);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$oldyear='';
|
||||
$oldmonth='';
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Champ date
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->dp2)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->dp2);
|
||||
print '<td width="30" align="center">'.strftime("%b",$obj->dp2)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->dp2);
|
||||
print '<td width="20">'.strftime("%d",$obj->dp2)."</td>\n";
|
||||
print '<td width="30">'.strftime("%H:%M",$obj->dp2)."</td>\n";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$oldyear='';
|
||||
$oldmonth='';
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Champ date
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->dp2)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->dp2);
|
||||
print '<td width="30" align="center">'.strftime("%b",$obj->dp2)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->dp2);
|
||||
print '<td width="20">'.strftime("%d",$obj->dp2)."</td>\n";
|
||||
print '<td width="30">'.strftime("%H:%M",$obj->dp2)."</td>\n";
|
||||
|
||||
// Picto
|
||||
print '<td width="16"> </td>';
|
||||
|
||||
// Espace
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
print '<td width="16"> </td>';
|
||||
|
||||
// Espace
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
// Action
|
||||
print '<td>';
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
$actionstatic->id=$obj->id;
|
||||
print $actionstatic->getNomUrl(1,16);
|
||||
print '<td>';
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
$actionstatic->id=$obj->id;
|
||||
print $actionstatic->getNomUrl(1,16);
|
||||
print '</td>';
|
||||
|
||||
// Objet lie
|
||||
print '<td>';
|
||||
|
||||
// Objet lie
|
||||
print '<td>';
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowPropal"),"propal");
|
||||
@ -556,47 +556,136 @@ function show_actions_done($conf,$langs,$db,$objsoc)
|
||||
print $facturestatic->getNomUrl(1,'compta');
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Libelle
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print '<td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print '<td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="80">';
|
||||
print '<td nowrap="nowrap" width="80">';
|
||||
$userstatic->id=$obj->rowid;
|
||||
$userstatic->login=$obj->login;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Statut
|
||||
print '<td nowrap="nowrap" width="20">'.$actionstatic->LibStatut($obj->percent,3).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br>\n";
|
||||
}
|
||||
print '<td nowrap="nowrap" width="20">'.$actionstatic->LibStatut($obj->percent,3).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show footer of page for PDF generation
|
||||
* \param pdf Object PDF
|
||||
* \param outputlang Object lang for output
|
||||
* \param paramfreetext Constant name of free text
|
||||
* \param fromcompany Object company
|
||||
* \param marge_basse
|
||||
* \param marge_gauche
|
||||
* \param page_hauteur
|
||||
*/
|
||||
function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//$paramfreetext='FACTURE_FREE_TEXT';
|
||||
|
||||
// Line of free text
|
||||
$ligne=(! empty($conf->global->$paramfreetext))?$conf->global->$paramfreetext:"";
|
||||
|
||||
// First line of company infos
|
||||
$ligne1="";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
|
||||
}
|
||||
if ($fromcompany->capital)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
// Prof Id
|
||||
if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2))
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code).": ".$fromcompany->profid1;
|
||||
}
|
||||
if ($fromcompany->profid2)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code).": ".$fromcompany->profid2;
|
||||
}
|
||||
|
||||
// Second line of company infos
|
||||
$ligne2="";
|
||||
if ($fromcompany->profid3)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code).": ".$fromcompany->profid3;
|
||||
}
|
||||
if ($fromcompany->profid4)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code).": ".$fromcompany->profid4;
|
||||
}
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','',7);
|
||||
$pdf->SetDrawColor(224,224,224);
|
||||
|
||||
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
|
||||
$posy=$marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
|
||||
if ($ligne)
|
||||
{
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
|
||||
$posy-=9; // 6 of ligne + 3 of MultiCell
|
||||
}
|
||||
|
||||
$pdf->SetY(-$posy);
|
||||
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
|
||||
$posy--;
|
||||
|
||||
if ($ligne1)
|
||||
{
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
|
||||
}
|
||||
|
||||
if ($ligne2)
|
||||
{
|
||||
$posy-=3;
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
|
||||
}
|
||||
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -39,16 +39,20 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e
|
||||
*/
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
/**
|
||||
* \brief Constructor
|
||||
* \param db Database handler
|
||||
*/
|
||||
function pdf_typhon($db)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "typhon";
|
||||
$this->description = "Modele de bon de livraison complet (logo...)";
|
||||
|
||||
@ -67,10 +71,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$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;
|
||||
$this->franchise=1;
|
||||
|
||||
// Recupere code pays de l'emmetteur
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
|
||||
|
||||
$this->tva=array();
|
||||
|
||||
@ -271,7 +276,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
if ($nexY > 200 && $i < ($nblignes - 1))
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY);
|
||||
$this->_pagefoot($pdf);
|
||||
$this->_pagefoot($pdf,$outputlangs);
|
||||
|
||||
// Nouvelle page
|
||||
$pdf->AddPage();
|
||||
@ -300,7 +305,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
/*
|
||||
* Pied de page
|
||||
*/
|
||||
$this->_pagefoot($pdf);
|
||||
$this->_pagefoot($pdf,$outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->Close();
|
||||
@ -518,76 +523,13 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Affiche le pied de page
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _pagefoot(&$pdf)
|
||||
function _pagefoot(&$pdf,$outputlangs)
|
||||
{
|
||||
global $langs, $conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("companies");
|
||||
|
||||
// Premiere ligne d'info r<>glementaires
|
||||
$ligne1="";
|
||||
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||
}
|
||||
if ($conf->global->MAIN_INFO_CAPITAL)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$langs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
if ($conf->global->MAIN_INFO_SIRET)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$conf->global->MAIN_INFO_SIRET;
|
||||
}
|
||||
if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->pays_code != 'FR'))
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$conf->global->MAIN_INFO_SIREN;
|
||||
}
|
||||
if ($conf->global->MAIN_INFO_APE)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$langs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".MAIN_INFO_APE;
|
||||
}
|
||||
|
||||
// Deuxieme ligne d'info reglementaires
|
||||
$ligne2="";
|
||||
if ($conf->global->MAIN_INFO_RCS)
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$langs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$conf->global->MAIN_INFO_RCS;
|
||||
}
|
||||
if ($conf->global->MAIN_INFO_TVAINTRA != '')
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA;
|
||||
}
|
||||
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetDrawColor(224,224,224);
|
||||
|
||||
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
|
||||
$posy=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
|
||||
$pdf->SetY(-$posy);
|
||||
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
|
||||
$posy--;
|
||||
|
||||
if ($ligne1)
|
||||
{
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
|
||||
}
|
||||
|
||||
if ($ligne2)
|
||||
{
|
||||
$posy-=3;
|
||||
$pdf->SetXY($this->marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
|
||||
}
|
||||
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
$pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user