New: Sur page config choix module génération facture, un clic sur info affiche un aperçu d'un specimen.
This commit is contained in:
parent
085274aa92
commit
b89b5f8a31
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
*
|
*
|
||||||
@ -30,6 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@ -40,11 +41,36 @@ if (!$user->admin)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$typeconst=array('yesno','texte','chaine');
|
$typeconst=array('yesno','texte','chaine');
|
||||||
|
$dir = DOL_DOCUMENT_ROOT."/includes/modules/facture/";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
if ($_GET["action"] == 'specimen')
|
||||||
|
{
|
||||||
|
$modele=$_GET["module"];
|
||||||
|
|
||||||
|
$facture = new Facture($db);
|
||||||
|
$facture->initAsSpecimen();
|
||||||
|
|
||||||
|
// Charge le modele
|
||||||
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/";
|
||||||
|
$file = "pdf_".$modele.".modules.php";
|
||||||
|
if (file_exists($dir.$file))
|
||||||
|
{
|
||||||
|
$classname = "pdf_".$modele;
|
||||||
|
require_once($dir.$file);
|
||||||
|
|
||||||
|
$obj = new $classname($db);
|
||||||
|
|
||||||
|
if ($obj->write_pdf_file($facture) > 0)
|
||||||
|
{
|
||||||
|
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'set')
|
if ($_GET["action"] == 'set')
|
||||||
{
|
{
|
||||||
@ -81,7 +107,7 @@ if ($_GET["action"] == 'setdoc')
|
|||||||
// On active le modele
|
// On active le modele
|
||||||
$type='invoice';
|
$type='invoice';
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
$sql_del.= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||||
$result1=$db->query($sql_del);
|
$result1=$db->query($sql_del);
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||||
$result2=$db->query($sql);
|
$result2=$db->query($sql);
|
||||||
@ -142,7 +168,6 @@ if ($_GET["action"] == 'delete')
|
|||||||
|
|
||||||
llxHeader("","");
|
llxHeader("","");
|
||||||
|
|
||||||
$dir = "../includes/modules/facture/";
|
|
||||||
$html=new Form($db);
|
$html=new Form($db);
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
@ -285,6 +310,7 @@ while (($file = readdir($handle))!==false)
|
|||||||
print '<tr '.$bc[$var].'><td width="100">';
|
print '<tr '.$bc[$var].'><td width="100">';
|
||||||
echo "$name";
|
echo "$name";
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
|
|
||||||
require_once($dir.$file);
|
require_once($dir.$file);
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
print $module->description;
|
print $module->description;
|
||||||
@ -333,7 +359,9 @@ while (($file = readdir($handle))!==false)
|
|||||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
|
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" alt="" title="">'.img_help(0,0).'</a>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -954,7 +954,7 @@ class Facture
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ajoute un produit dans l'objet facture
|
* \brief Ajoute un produit dans les tableaux products, products_qty, products_date_start|end
|
||||||
* \param idproduct
|
* \param idproduct
|
||||||
* \param qty
|
* \param qty
|
||||||
* \param remise_percent
|
* \param remise_percent
|
||||||
@ -1235,6 +1235,8 @@ class Facture
|
|||||||
$sql .= ' WHERE rowid = '.$facid;
|
$sql .= ' WHERE rowid = '.$facid;
|
||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
|
// \TODO Supprimer l'utilisation de facture_tva_sum non utilisable
|
||||||
|
// dans un context compta propre.
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_tva_sum WHERE fk_facture='.$this->id;
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_tva_sum WHERE fk_facture='.$this->id;
|
||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
@ -1351,6 +1353,8 @@ class Facture
|
|||||||
*/
|
*/
|
||||||
function getSumTva()
|
function getSumTva()
|
||||||
{
|
{
|
||||||
|
$tvs=array();
|
||||||
|
|
||||||
$sql = 'SELECT amount, tva_tx FROM '.MAIN_DB_PREFIX.'facture_tva_sum WHERE fk_facture = '.$this->id;
|
$sql = 'SELECT amount, tva_tx FROM '.MAIN_DB_PREFIX.'facture_tva_sum WHERE fk_facture = '.$this->id;
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
@ -1366,6 +1370,7 @@ class Facture
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2228,6 +2233,81 @@ class Facture
|
|||||||
return $this->getIdContact('external','SHIPPING');
|
return $this->getIdContact('external','SHIPPING');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialise la facture avec valeurs fictives aléatoire
|
||||||
|
* Sert à générer une facture pour l'aperu des modèles ou demo
|
||||||
|
*/
|
||||||
|
function initAsSpecimen()
|
||||||
|
{
|
||||||
|
global $user,$langs;
|
||||||
|
|
||||||
|
// Charge tableau des id de société socids
|
||||||
|
$socids = array();
|
||||||
|
$sql = "SELECT idp FROM ".MAIN_DB_PREFIX."societe WHERE client=1 LIMIT 10";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num_socs = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num_socs)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
$socids[$i] = $row[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Charge tableau des produits prodids
|
||||||
|
$prodids = array();
|
||||||
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE envente=1";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num_prods = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num_prods)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
$prodids[$i] = $row[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialise paramètres
|
||||||
|
$this->id=0;
|
||||||
|
$this->ref = 'SPECIMEN';
|
||||||
|
$this->specimen=1;
|
||||||
|
$socid = rand(1, $num_socs);
|
||||||
|
$this->socidp = $socids[$socid];
|
||||||
|
$this->date = time();
|
||||||
|
$this->date_lim_reglement=$this->date+3600*24*30;
|
||||||
|
$this->cond_reglement_id = 3;
|
||||||
|
$this->mode_reglement_id = 3;
|
||||||
|
$this->note_public='SPECIMEN';
|
||||||
|
$nbp = rand(1, 9);
|
||||||
|
$xnbp = 0;
|
||||||
|
while ($xnbp < $nbp)
|
||||||
|
{
|
||||||
|
$ligne=new FactureLigne($this->db);
|
||||||
|
$ligne->desc=$langs->trans("Description")." ".$xnbp;
|
||||||
|
$ligne->qty=1;
|
||||||
|
$ligne->subprice=100;
|
||||||
|
$ligne->price=100;
|
||||||
|
$ligne->tva_taux=19.6;
|
||||||
|
$prodid = rand(1, $num_prods);
|
||||||
|
$ligne->produit_id=$prodids[$prodid];
|
||||||
|
$this->lignes[$xnbp]=$ligne;
|
||||||
|
$xnbp++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->amount_ht = $xnbp*100;
|
||||||
|
$this->total_ht = $xnbp*100;
|
||||||
|
$this->total_tva = $xnbp*19.6;
|
||||||
|
$this->total_ttc = $xnbp*119.6;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -56,18 +56,36 @@ class pdf_bernique extends ModelePDFFactures {
|
|||||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||||
}
|
}
|
||||||
|
|
||||||
function write_pdf_file($facid)
|
/**
|
||||||
|
* \brief Fonction générant la facture sur le disque
|
||||||
|
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||||
|
* \return int 1=ok, 0=ko
|
||||||
|
*/
|
||||||
|
function write_pdf_file($fac,$outputlangs='')
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
$fac = new Facture($this->db,"",$facid);
|
|
||||||
$fac->fetch($facid);
|
|
||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
|
// Définition de l'objet $fac (pour compatibilite ascendante)
|
||||||
|
if (! is_object($fac))
|
||||||
|
{
|
||||||
|
$fac = new Facture($this->db,"",$fac);
|
||||||
|
$ret=$fac->fetch($fac);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définition de $dir et $file
|
||||||
|
if ($fac->specimen)
|
||||||
|
{
|
||||||
|
$dir = $conf->facture->dir_output;
|
||||||
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$facref = sanitize_string($fac->ref);
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref . "/" ;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
@ -201,6 +219,7 @@ class pdf_bernique extends ModelePDFFactures {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -252,6 +271,7 @@ class pdf_bernique extends ModelePDFFactures {
|
|||||||
$pdf->SetFont('Arial','', 9);
|
$pdf->SetFont('Arial','', 9);
|
||||||
|
|
||||||
$tvas = $fac->getSumTva();
|
$tvas = $fac->getSumTva();
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$tab4_top = $tab2_top + 2 + ($tab2_hl * 2);
|
$tab4_top = $tab2_top + 2 + ($tab2_hl * 2);
|
||||||
|
|||||||
@ -57,19 +57,36 @@ class pdf_bulot extends ModelePDFFactures {
|
|||||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
function write_pdf_file($facid)
|
* \brief Fonction générant la facture sur le disque
|
||||||
|
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||||
|
* \return int 1=ok, 0=ko
|
||||||
|
*/
|
||||||
|
function write_pdf_file($fac,$outputlangs='')
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
$fac = new Facture($this->db,"",$facid);
|
// Définition de l'objet $fac (pour compatibilite ascendante)
|
||||||
$fac->fetch($facid);
|
if (! is_object($fac))
|
||||||
|
{
|
||||||
|
$fac = new Facture($this->db,"",$fac);
|
||||||
|
$ret=$fac->fetch($fac);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définition de $dir et $file
|
||||||
|
if ($fac->specimen)
|
||||||
|
{
|
||||||
|
$dir = $conf->facture->dir_output;
|
||||||
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$facref = sanitize_string($fac->ref);
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction générant la facture sur le disque
|
* \brief Fonction générant la facture sur le disque
|
||||||
* \param id Id de la facture à générer
|
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||||
* \return int 1=ok, 0=ko
|
* \return int 1=ok, 0=ko
|
||||||
* \remarks Variables utilisées
|
* \remarks Variables utilisées
|
||||||
* \remarks MAIN_INFO_SOCIETE_NOM
|
* \remarks MAIN_INFO_SOCIETE_NOM
|
||||||
@ -124,19 +124,31 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
* \remarks FACTURE_CHQ_NUMBER
|
* \remarks FACTURE_CHQ_NUMBER
|
||||||
* \remarks FACTURE_RIB_NUMBER
|
* \remarks FACTURE_RIB_NUMBER
|
||||||
*/
|
*/
|
||||||
function write_pdf_file($id)
|
function write_pdf_file($fac,$outputlangs='')
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf,$mysoc;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
$fac = new Facture($this->db,"",$id);
|
// Définition de l'objet $fac (pour compatibilite ascendante)
|
||||||
$ret=$fac->fetch($id);
|
if (! is_object($fac))
|
||||||
$nblignes = sizeof($fac->lignes);
|
{
|
||||||
|
$fac = new Facture($this->db,"",$fac);
|
||||||
|
$ret=$fac->fetch($fac);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définition de $dir et $file
|
||||||
|
if ($fac->specimen)
|
||||||
|
{
|
||||||
|
$dir = $conf->facture->dir_output;
|
||||||
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$facref = sanitize_string($fac->ref);
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
@ -149,6 +161,8 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
|
$nblignes = sizeof($fac->lignes);
|
||||||
|
|
||||||
// Initialisation document vierge
|
// Initialisation document vierge
|
||||||
$pdf=new FPDF('P','mm',$this->format);
|
$pdf=new FPDF('P','mm',$this->format);
|
||||||
$pdf->Open();
|
$pdf->Open();
|
||||||
@ -574,7 +588,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->SetXY($this->marge_gauche, $tab2_top + 0);
|
$pdf->SetXY($this->marge_gauche, $tab2_top + 0);
|
||||||
if ($this->franchise==1)
|
if ($this->franchise==1)
|
||||||
{
|
{
|
||||||
$pdf->MultiCell(100, $tab2_hl, $langs->trans("VATIsNotUsed"), 0, 'L', 0);
|
$pdf->MultiCell(100, $tab2_hl, $langs->trans("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tableau total
|
// Tableau total
|
||||||
|
|||||||
@ -62,18 +62,37 @@ class pdf_huitre extends ModelePDFFactures {
|
|||||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||||
}
|
}
|
||||||
|
|
||||||
function write_pdf_file($facid)
|
|
||||||
|
/**
|
||||||
|
* \brief Fonction générant la facture sur le disque
|
||||||
|
* \param fac Objet facture à générer (ou id si ancienne methode)
|
||||||
|
* \return int 1=ok, 0=ko
|
||||||
|
*/
|
||||||
|
function write_pdf_file($fac,$outputlangs='')
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
$fac = new Facture($this->db,"",$facid);
|
// Définition de l'objet $fac (pour compatibilite ascendante)
|
||||||
$fac->fetch($facid);
|
if (! is_object($fac))
|
||||||
|
{
|
||||||
|
$fac = new Facture($this->db,"",$fac);
|
||||||
|
$ret=$fac->fetch($fac);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définition de $dir et $file
|
||||||
|
if ($fac->specimen)
|
||||||
|
{
|
||||||
|
$dir = $conf->facture->dir_output;
|
||||||
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$facref = sanitize_string($fac->ref);
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
@ -182,13 +201,13 @@ class pdf_huitre extends ModelePDFFactures {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// if ( $fac->note >0 )
|
if ( $fac->note_public)
|
||||||
// {
|
{
|
||||||
$pdf->SetFont('Arial','',7);
|
$pdf->SetFont('Arial','',7);
|
||||||
$pdf->SetXY(10, 211);
|
$pdf->SetXY(10, 211);
|
||||||
$note = "Note : ".$fac->note;
|
$note = $langs->trans("Note").' : '.$fac->note_public;
|
||||||
$pdf->MultiCell(110, 3, $note, 0, 'J');
|
$pdf->MultiCell(110, 3, $note, 0, 'J');
|
||||||
// }
|
}
|
||||||
|
|
||||||
$pdf->SetFont('Arial','U',11);
|
$pdf->SetFont('Arial','U',11);
|
||||||
$pdf->SetXY(10, 225);
|
$pdf->SetXY(10, 225);
|
||||||
@ -241,6 +260,8 @@ class pdf_huitre extends ModelePDFFactures {
|
|||||||
$this->error=$langs->trans("ErrorUnknown");
|
$this->error=$langs->trans("ErrorUnknown");
|
||||||
return 0; // Erreur par defaut
|
return 0; // Erreur par defaut
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -499,10 +520,11 @@ class pdf_huitre extends ModelePDFFactures {
|
|||||||
/*
|
/*
|
||||||
* Definition du document
|
* Definition du document
|
||||||
*/
|
*/
|
||||||
$pdf->SetXY(10,50);
|
$pdf->SetXY(10,16);
|
||||||
$pdf->SetFont('Arial','B',16);
|
$pdf->SetFont('Arial','B',16);
|
||||||
$pdf->SetTextColor(0,0,200);
|
$pdf->SetTextColor(0,0,200);
|
||||||
$pdf->MultiCell(50, 8, "FACTURE", '' , 'C');
|
$pdf->MultiCell(50, 2, "FACTURE", '' , 'C');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adresse Client
|
* Adresse Client
|
||||||
*/
|
*/
|
||||||
@ -528,15 +550,12 @@ class pdf_huitre extends ModelePDFFactures {
|
|||||||
$pdf->Text(35, 88, ": " . strftime("%d %b %Y", $fac->date));
|
$pdf->Text(35, 88, ": " . strftime("%d %b %Y", $fac->date));
|
||||||
$pdf->Text(11, 94, $langs->trans('Invoice'));
|
$pdf->Text(11, 94, $langs->trans('Invoice'));
|
||||||
$pdf->Text(35, 94, ": ".$fac->ref);
|
$pdf->Text(35, 94, ": ".$fac->ref);
|
||||||
/*
|
|
||||||
*/
|
// Montants exprimes en euros
|
||||||
$pdf->line(200, 94, 205, 94 );
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
$pdf->SetTextColor(0,0,0);
|
||||||
$pdf->SetFont('Arial','',10);
|
$pdf->SetFont('Arial','',10);
|
||||||
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie));
|
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie));
|
||||||
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
|
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
* \remarks MAIN_INFO_CAPITAL
|
* \remarks MAIN_INFO_CAPITAL
|
||||||
* \remarks MAIN_INFO_TVAINTRA
|
* \remarks MAIN_INFO_TVAINTRA
|
||||||
*/
|
*/
|
||||||
function write_pdf_file($facid)
|
function write_pdf_file($fac,$outputlangs='')
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf,$mysoc;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
@ -118,12 +118,25 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
|
|
||||||
if ($conf->facture->dir_output)
|
if ($conf->facture->dir_output)
|
||||||
{
|
{
|
||||||
$fac = new Facture($this->db,"",$facid);
|
// Définition de l'objet $fac (pour compatibilite ascendante)
|
||||||
$fac->fetch($facid);
|
if (! is_object($fac))
|
||||||
|
{
|
||||||
|
$fac = new Facture($this->db,"",$fac);
|
||||||
|
$ret=$fac->fetch($fac);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définition de $dir et $file
|
||||||
|
if ($fac->specimen)
|
||||||
|
{
|
||||||
|
$dir = $conf->facture->dir_output;
|
||||||
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$facref = sanitize_string($fac->ref);
|
||||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||||
$file = $dir . "/" . $facref . ".pdf";
|
$file = $dir . "/" . $facref . ".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
{
|
{
|
||||||
@ -144,7 +157,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
$this->_pagehead($pdf, $fac);
|
$this->_pagehead($pdf, $fac);
|
||||||
|
|
||||||
$pdf->SetTitle($fac->ref);
|
$pdf->SetTitle($fac->ref);
|
||||||
$pdf->SetSubject($langs->trans("Bill"));
|
$pdf->SetSubject($langs->trans("Invoice"));
|
||||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||||
$pdf->SetAuthor($user->fullname);
|
$pdf->SetAuthor($user->fullname);
|
||||||
|
|
||||||
@ -199,7 +212,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
$pdf->SetXY ($this->marges['g']+132, $curY);
|
$pdf->SetXY ($this->marges['g']+132, $curY);
|
||||||
$pdf->MultiCell(16, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0);
|
$pdf->MultiCell(16, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0);
|
||||||
|
|
||||||
// Quantité
|
// Quantit
|
||||||
$pdf->SetXY ($this->marges['g']+150, $curY);
|
$pdf->SetXY ($this->marges['g']+150, $curY);
|
||||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R');
|
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R');
|
||||||
|
|
||||||
@ -469,7 +482,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
$pdf->SetXY ($this->marges['g'], $tab2_top + 0);
|
$pdf->SetXY ($this->marges['g'], $tab2_top + 0);
|
||||||
if ($this->franchise==1)
|
if ($this->franchise==1)
|
||||||
{
|
{
|
||||||
$pdf->MultiCell(100, $tab2_hl, $langs->trans("VATIsNotUsed"), 0, 'L', 0);
|
$pdf->MultiCell(100, $tab2_hl, $langs->trans("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tableau total
|
// Tableau total
|
||||||
|
|||||||
@ -175,7 +175,7 @@ IntracommunityVATNumber=Intracommunity number of VAT
|
|||||||
PaymentByChequeOrderedTo=Règlement par chèque à l'ordre de
|
PaymentByChequeOrderedTo=Règlement par chèque à l'ordre de
|
||||||
SendTo=envoyé à
|
SendTo=envoyé à
|
||||||
PaymentByTransferOnThisBankAccount=Payment by transfer on the following bank account
|
PaymentByTransferOnThisBankAccount=Payment by transfer on the following bank account
|
||||||
VATIsNotUsed=* TVA non applicable art-293B du CGI
|
VATIsNotUsedForInvoice=* TVA non applicable art-293B du CGI
|
||||||
LawApplicationPart1=Par application de la loi 80.335 du 12/05/80
|
LawApplicationPart1=Par application de la loi 80.335 du 12/05/80
|
||||||
LawApplicationPart2=les marchandises demeurent la propriété du
|
LawApplicationPart2=les marchandises demeurent la propriété du
|
||||||
LawApplicationPart3=vendeur jusqu'à complet encaissement de
|
LawApplicationPart3=vendeur jusqu'à complet encaissement de
|
||||||
|
|||||||
@ -175,7 +175,7 @@ IntracommunityVATNumber=Num
|
|||||||
PaymentByChequeOrderedTo=Règlement par chèque à l'ordre de
|
PaymentByChequeOrderedTo=Règlement par chèque à l'ordre de
|
||||||
SendTo=envoyé à
|
SendTo=envoyé à
|
||||||
PaymentByTransferOnThisBankAccount=Règlement par virement sur le compte bancaire suivant
|
PaymentByTransferOnThisBankAccount=Règlement par virement sur le compte bancaire suivant
|
||||||
VATIsNotUsed=* TVA non applicable art-293B du CGI
|
VATIsNotUsedForInvoice=* TVA non applicable art-293B du CGI
|
||||||
LawApplicationPart1=Par application de la loi 80.335 du 12/05/80
|
LawApplicationPart1=Par application de la loi 80.335 du 12/05/80
|
||||||
LawApplicationPart2=les marchandises demeurent la propriété du
|
LawApplicationPart2=les marchandises demeurent la propriété du
|
||||||
LawApplicationPart3=vendeur jusqu'à complet encaissement de
|
LawApplicationPart3=vendeur jusqu'à complet encaissement de
|
||||||
|
|||||||
@ -731,10 +731,15 @@ function img_disable($alt = "default")
|
|||||||
\brief Affiche logo help avec curseur "?"
|
\brief Affiche logo help avec curseur "?"
|
||||||
\return string Retourne tag img
|
\return string Retourne tag img
|
||||||
*/
|
*/
|
||||||
function img_help($usehelpcursor=1)
|
function img_help($usehelpcursor=1,$usealttitle=1)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
return '<img '.($usehelpcursor?'style="cursor: help;" ':'').'src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/help.png" border="0" alt="'.$langs->trans("Info").'" title="'.$langs->trans("Info").'">';
|
$s ='<img ';
|
||||||
|
if ($usehelpcursor) $s.='style="cursor: help;" ';
|
||||||
|
$s.='src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/help.png" border="0"';
|
||||||
|
if ($usealttitle) $s.=' alt="'.$langs->trans("Info").'" title="'.$langs->trans("Info");
|
||||||
|
$s.='">';
|
||||||
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user