Gestion d'affichage de specimen sur propale

This commit is contained in:
Laurent Destailleur 2006-06-12 22:20:24 +00:00
parent 4aeb30dd08
commit 0d3affa1f8
17 changed files with 1100 additions and 1028 deletions

View File

@ -22,7 +22,7 @@
* $Source$ * $Source$
*/ */
/** /**
\file htdocs/admin/facture.php \file htdocs/admin/facture.php
\ingroup facture \ingroup facture
\brief Page d'administration/configuration du module Facture \brief Page d'administration/configuration du module Facture
@ -96,7 +96,7 @@ if ($_GET["action"] == 'del')
if ($_GET["action"] == 'setdoc') if ($_GET["action"] == 'setdoc')
{ {
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"])) if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"]))
{ {
// La constante qui a été lue en avant du nouveau set // La constante qui a été lue en avant du nouveau set
@ -111,7 +111,7 @@ if ($_GET["action"] == 'setdoc')
$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);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
} }
@ -214,18 +214,18 @@ while (($file = readdir($handle))!==false)
print '<tr '.$bc[$var].'><td width="100">'; print '<tr '.$bc[$var].'><td width="100">';
echo "$file"; echo "$file";
print "</td><td>\n"; print "</td><td>\n";
// Chargement de la classe de numérotation // Chargement de la classe de numérotation
require_once($dir.$filebis); require_once($dir.$filebis);
$classname = "mod_facture_".$file; $classname = "mod_facture_".$file;
$module = new $classname($db); $module = new $classname($db);
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Affiche example // Affiche example
print '<td nowrap="nowrap">'.$module->getExample().'</td>'; print '<td nowrap="nowrap">'.$module->getExample().'</td>';
print '<td align="center">'; print '<td align="center">';
if ($conf->global->FACTURE_ADDON == "$file") if ($conf->global->FACTURE_ADDON == "$file")
{ {
@ -236,7 +236,7 @@ while (($file = readdir($handle))!==false)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip=''; $htmltooltip='';
$nextval=$module->getNextValue(); $nextval=$module->getNextValue();
@ -247,7 +247,7 @@ while (($file = readdir($handle))!==false)
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'; print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
print ($htmltooltip?img_help(0):''); print ($htmltooltip?img_help(0):'');
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
} }
@ -306,7 +306,7 @@ while (($file = readdir($handle))!==false)
$var = !$var; $var = !$var;
$name = substr($file, 4, strlen($file) -16); $name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12); $classname = substr($file, 0, strlen($file) -12);
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";
@ -315,12 +315,12 @@ while (($file = readdir($handle))!==false)
$module = new $classname($db); $module = new $classname($db);
print $module->description; print $module->description;
print '</td>'; print '</td>';
// Activé // Activé
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->FACTURE_ADDON_PDF != "$name") if ($conf->global->FACTURE_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable")); print img_tick($langs->trans("Disable"));
@ -350,7 +350,7 @@ while (($file = readdir($handle))!==false)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur; $htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
@ -410,11 +410,11 @@ if ($conf->banque->enabled)
{ {
$var=!$var; $var=!$var;
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"'; print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected="true"':''; print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected="true"':'';
print '>'.$row[1].'</option>'; print '>'.$row[1].'</option>';
$i++; $i++;
} }
print "</select>"; print "</select>";
@ -450,7 +450,7 @@ if ($resql)
{ {
$var=!$var; $var=!$var;
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"'; print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected="true"':''; print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected="true"':'';
print '>'.$langs->trans("OwnerOfBankAccount",$row[1]).'</option>'; print '>'.$langs->trans("OwnerOfBankAccount",$row[1]).'</option>';

View File

@ -31,6 +31,7 @@
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills"); $langs->load("bills");
@ -44,7 +45,32 @@ if (!$user->admin)
/* /*
* Actions * Actions
*/ */
if ($_GET["action"] == 'specimen')
{
$modele=$_GET["module"];
$propal = new Propal($db);
$propal->initAsSpecimen();
// Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/propale/";
$file = "pdf_propale_".$modele.".modules.php";
if (file_exists($dir.$file))
{
$classname = "pdf_propale_".$modele;
require_once($dir.$file);
$obj = new $classname($db);
if ($obj->write_pdf_file($propal) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
return;
}
}
}
if ($_POST["action"] == 'nbprod') if ($_POST["action"] == 'nbprod')
{ {
dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]); dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]);
@ -88,7 +114,7 @@ if ($_GET["action"] == 'del')
if ($_GET["action"] == 'setdoc') if ($_GET["action"] == 'setdoc')
{ {
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"])) if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"]))
{ {
// La constante qui a été lue en avant du nouveau set // La constante qui a été lue en avant du nouveau set
@ -103,7 +129,7 @@ if ($_GET["action"] == 'setdoc')
$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);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
} }
@ -175,7 +201,7 @@ if ($handle)
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Examples // Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n"; print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
@ -273,7 +299,7 @@ while (($file = readdir($handle))!==false)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->PROPALE_ADDON_PDF != "$name") if ($conf->global->PROPALE_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable")); print img_tick($langs->trans("Disable"));
@ -303,7 +329,7 @@ while (($file = readdir($handle))!==false)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($obj->type?$obj->type:$langs->trans("Unknown")); $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($obj->type?$obj->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$obj->page_largeur; $htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$obj->page_largeur;
@ -312,7 +338,9 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($obj->option_logo); $htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($obj->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($obj->option_modereg); $htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($obj->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($obj->option_condreg); $htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($obj->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";
} }
@ -397,7 +425,7 @@ if ($conf->commande->enabled)
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} }

View File

@ -59,7 +59,7 @@ $month=isset($_GET["month"])?$_GET["month"]:"";
// Sécurité accés client // Sécurité accés client
$socidp=''; $socidp='';
if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socidp = $user->societe_id; $socidp = $user->societe_id;
@ -139,10 +139,10 @@ if ($_POST['action'] == 'setdeliveryadress' && $user->rights->propale->creer)
if ($result < 0) dolibarr_print_error($db,$propal->error); if ($result < 0) dolibarr_print_error($db,$propal->error);
} }
if ($_POST['action'] == 'add') if ($_POST['action'] == 'add')
{ {
$propal = new Propal($db, $_POST['socidp']); $propal = new Propal($db, $_POST['socidp']);
/* /*
* Si on seléctionné une propal à copier, on réalise la copie * Si on seléctionné une propal à copier, on réalise la copie
*/ */
@ -180,15 +180,15 @@ if ($_POST['action'] == 'add')
$propal->duree_validite = $_POST['duree_validite']; $propal->duree_validite = $_POST['duree_validite'];
$propal->cond_reglement_id = $_POST['cond_reglement_id']; $propal->cond_reglement_id = $_POST['cond_reglement_id'];
$propal->mode_reglement_id = $_POST['mode_reglement_id']; $propal->mode_reglement_id = $_POST['mode_reglement_id'];
$propal->contactid = $_POST['contactidp']; $propal->contactid = $_POST['contactidp'];
$propal->projetidp = $_POST['projetidp']; $propal->projetidp = $_POST['projetidp'];
$propal->modelpdf = $_POST['model']; $propal->modelpdf = $_POST['model'];
$propal->author = $user->id; $propal->author = $user->id;
$propal->note = $_POST['note']; $propal->note = $_POST['note'];
$propal->ref = $_POST['ref']; $propal->ref = $_POST['ref'];
for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++) for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++)
{ {
if ($_POST['idprod'.$i]) if ($_POST['idprod'.$i])
@ -199,7 +199,7 @@ if ($_POST['action'] == 'add')
$propal->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); $propal->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]);
} }
} }
$id = $propal->create(); $id = $propal->create();
} }
/* /*
@ -208,7 +208,7 @@ if ($_POST['action'] == 'add')
if ($id > 0) if ($id > 0)
{ {
propale_pdf_create($db, $id, $_POST['model']); propale_pdf_create($db, $id, $_POST['model']);
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
exit; exit;
} }
@ -222,7 +222,7 @@ if ($_POST['action'] == 'add')
/* /*
* Cloture de la propale * Cloture de la propale
*/ */
if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer) if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer)
{ {
if (! $_POST['cancel']) if (! $_POST['cancel'])
{ {
@ -265,25 +265,25 @@ if ($_POST['action'] == 'send')
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$message = $_POST['message']; $message = $_POST['message'];
$sendtocc = $_POST['sendtocc']; $sendtocc = $_POST['sendtocc'];
if ($_POST['action'] == 'send') if ($_POST['action'] == 'send')
{ {
$subject = $_POST['subject']; $subject = $_POST['subject'];
if($subject == '') if($subject == '')
{ {
$subject = $langs->trans('Propal').' '.$propal->ref; $subject = $langs->trans('Propal').' '.$propal->ref;
} }
$actiontypeid=3; $actiontypeid=3;
$actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>'; $actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.<br>';
if ($message) if ($message)
{ {
$actionmsg.='Texte utilisé dans le corps du message:<br>'; $actionmsg.='Texte utilisé dans le corps du message:<br>';
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2='Envoi Propal par mail'; $actionmsg2='Envoi Propal par mail';
} }
@ -357,7 +357,7 @@ if ($_GET['action'] == 'commande')
$propal->create_commande($user); $propal->create_commande($user);
} }
if ($_GET['action'] == 'modif' && $user->rights->propale->creer) if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
{ {
/* /*
* Repasse la propale en mode brouillon * Repasse la propale en mode brouillon
@ -372,7 +372,7 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
{ {
$propal = new Propal($db); $propal = new Propal($db);
$ret=$propal->fetch($_POST['propalid']); $ret=$propal->fetch($_POST['propalid']);
if ($_POST["remise_id"]) if ($_POST["remise_id"])
{ {
$propal->insert_discount($_POST["remise_id"]); $propal->insert_discount($_POST["remise_id"]);
@ -382,23 +382,23 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
/* /*
* Ajout d'une ligne produit dans la propale * Ajout d'une ligne produit dans la propale
*/ */
if ($_POST['action'] == "addligne" && $user->rights->propale->creer) if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
{ {
if ($_POST['qty'] && (($_POST['np_price']!=0 && $_POST['np_desc']) || $_POST['idprod'])) if ($_POST['qty'] && (($_POST['np_price']!=0 && $_POST['np_desc']) || $_POST['idprod']))
{ {
$propal = new Propal($db); $propal = new Propal($db);
$ret=$propal->fetch($_POST['propalid']); $ret=$propal->fetch($_POST['propalid']);
if (isset($_POST['np_tva_tx'])) if (isset($_POST['np_tva_tx']))
{ {
$propal->insert_product_generic( $propal->insert_product_generic(
$_POST['np_desc'], $_POST['np_desc'],
$_POST['np_price'], $_POST['np_price'],
$_POST['qty'], $_POST['qty'],
$_POST['np_tva_tx'], $_POST['np_tva_tx'],
$_POST['np_remise']); $_POST['np_remise']);
} }
else else
{ {
$propal->insert_product( $propal->insert_product(
$_POST['idprod'], $_POST['idprod'],
@ -410,7 +410,7 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
} }
} }
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save")) if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
{ {
/* /*
* Mise à jour d'une ligne dans la propale * Mise à jour d'une ligne dans la propale
@ -433,7 +433,7 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
} }
if ($_GET['action'] == 'del_ligne' && $user->rights->propale->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE) if ($_GET['action'] == 'del_ligne' && $user->rights->propale->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{ {
/* /*
* Supprime une ligne produit dans la propale * Supprime une ligne produit dans la propale
@ -460,7 +460,7 @@ if ($_POST['action'] == 'set_contact')
// Conditions de règlement // Conditions de règlement
if ($_POST["action"] == 'setconditions') if ($_POST["action"] == 'setconditions')
{ {
$propal = new Propal($db, $_GET["propalid"]); $propal = new Propal($db, $_GET["propalid"]);
$propal->cond_reglement_id = $_POST['cond_reglement_id']; $propal->cond_reglement_id = $_POST['cond_reglement_id'];
$sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
@ -546,7 +546,7 @@ if ($_GET['propalid'] > 0)
$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete');
print '<br>'; print '<br>';
} }
/* /*
* Confirmation de la suppression d'une ligne produit * Confirmation de la suppression d'une ligne produit
*/ */
@ -1490,7 +1490,7 @@ else
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
$sql.= ' WHERE p.fk_soc = s.idp'; $sql.= ' WHERE p.fk_soc = s.idp';
if (!$user->rights->commercial->client->voir && !$socidp) //restriction if (!$user->rights->commercial->client->voir && !$socidp) //restriction
{ {
$sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -1508,10 +1508,10 @@ else
$sql .= " AND p.price='".addslashes($_GET['search_montant_ht'])."'"; $sql .= " AND p.price='".addslashes($_GET['search_montant_ht'])."'";
} }
if ($sall) $sql.= " AND (s.nom like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%' OR pd.description like '%".addslashes($sall)."%')"; if ($sall) $sql.= " AND (s.nom like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%' OR pd.description like '%".addslashes($sall)."%')";
if ($socidp) $sql .= ' AND s.idp = '.$socidp; if ($socidp) $sql .= ' AND s.idp = '.$socidp;
if ($_GET['viewstatut'] <> '') if ($_GET['viewstatut'] <> '')
{ {
$sql .= ' AND p.fk_statut in ('.$_GET['viewstatut'].')'; $sql .= ' AND p.fk_statut in ('.$_GET['viewstatut'].')';
} }
if ($month > 0) if ($month > 0)
{ {
@ -1571,7 +1571,7 @@ else
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?propalid='.$objp->propalid.'">'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."</a></td>\n"; print '<td><a href="'.$_SERVER["PHP_SELF"].'?propalid='.$objp->propalid.'">'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."</a></td>\n";
if ($objp->client == 1) if ($objp->client == 1)
{ {
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp; $url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp;
@ -1583,18 +1583,18 @@ else
// Société // Société
print '<td><a href="'.$url.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; print '<td><a href="'.$url.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
// Date propale // Date propale
print '<td align="center">'; print '<td align="center">';
$y = strftime('%Y',$objp->dp); $y = strftime('%Y',$objp->dp);
$m = strftime('%m',$objp->dp); $m = strftime('%m',$objp->dp);
print strftime('%d',$objp->dp)."\n"; print strftime('%d',$objp->dp)."\n";
print ' <a href="'.$_SERVER["PHP_SELF"].'?year='.$y.'&amp;month='.$m.'">'; print ' <a href="'.$_SERVER["PHP_SELF"].'?year='.$y.'&amp;month='.$m.'">';
print dolibarr_print_date($objp->dp,'%b')."</a>\n"; print dolibarr_print_date($objp->dp,'%b')."</a>\n";
print ' <a href="'.$_SERVER["PHP_SELF"].'?year='.$y.'">'; print ' <a href="'.$_SERVER["PHP_SELF"].'?year='.$y.'">';
print strftime('%Y',$objp->dp)."</a></td>\n"; print strftime('%Y',$objp->dp)."</a></td>\n";
// Date fin validite // Date fin validite
if ($objp->dfv) if ($objp->dfv)
{ {
@ -1606,15 +1606,15 @@ else
{ {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
print '<td align="right">'.price($objp->price)."</td>\n"; print '<td align="right">'.price($objp->price)."</td>\n";
$propal=New Propal($db); $propal=New Propal($db);
print '<td align="right">'.$propal->LibStatut($objp->fk_statut,5)."</td>\n"; print '<td align="right">'.$propal->LibStatut($objp->fk_statut,5)."</td>\n";
print "</tr>\n"; print "</tr>\n";
$total = $total + $objp->price; $total = $total + $objp->price;
$subtotal = $subtotal + $objp->price; $subtotal = $subtotal + $objp->price;
$i++; $i++;
} }
print '</table>'; print '</table>';

View File

@ -48,7 +48,7 @@ class Facture
var $socidp; // Id client var $socidp; // Id client
var $client; // Objet societe client (à charger par fetch_client) var $client; // Objet societe client (à charger par fetch_client)
var $number; var $number;
var $author; var $author;
var $date; var $date;
@ -68,6 +68,14 @@ class Facture
var $mode_reglement_id; var $mode_reglement_id;
var $mode_reglement_code; var $mode_reglement_code;
// Pour board
var $nbtodo;
var $nbtodolate;
var $specimen;
var $error;
/** /**
* \brief Constructeur de la classe * \brief Constructeur de la classe
* \param DB handler accès base de données * \param DB handler accès base de données
@ -260,7 +268,7 @@ class Facture
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CREATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_CREATE',$this,$user,$langs,$conf);
// Fin appel triggers // Fin appel triggers
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
@ -350,15 +358,15 @@ class Facture
$this->commande_id = $obj->fk_commande; $this->commande_id = $obj->fk_commande;
$this->lignes = array(); $this->lignes = array();
if ($this->user_author) if ($this->user_author)
{ {
$sql = "SELECT name, firstname"; $sql = "SELECT name, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."user"; $sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE rowid = ".$this->user_author; $sql.= " WHERE rowid = ".$this->user_author;
$resqluser = $this->db->query($sql); $resqluser = $this->db->query($sql);
if ($resqluser) if ($resqluser)
{ {
$obju = $this->db->fetch_object($resqluser); $obju = $this->db->fetch_object($resqluser);
@ -366,22 +374,22 @@ class Facture
$this->user_author_firstname = $obju->firstname; $this->user_author_firstname = $obju->firstname;
} }
} }
if ($this->commande_id) if ($this->commande_id)
{ {
$sql = "SELECT ref"; $sql = "SELECT ref";
$sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE rowid = ".$this->commande_id; $sql.= " WHERE rowid = ".$this->commande_id;
$resqlcomm = $this->db->query($sql); $resqlcomm = $this->db->query($sql);
if ($resqlcomm) if ($resqlcomm)
{ {
$objc = $this->db->fetch_object($resqlcomm); $objc = $this->db->fetch_object($resqlcomm);
$this->commande_ref = $objc->ref; $this->commande_ref = $objc->ref;
} }
} }
if ($this->statut == 0) if ($this->statut == 0)
{ {
$this->brouillon = 1; $this->brouillon = 1;
@ -457,12 +465,12 @@ class Facture
$client->fetch($this->socidp); $client->fetch($this->socidp);
$this->client = $client; $this->client = $client;
} }
/** /**
* *
* *
*/ */
function fetch_contact_facture($id) function fetch_contact_facture($id)
{ {
$idcontact = $id; $idcontact = $id;
@ -520,7 +528,7 @@ class Facture
function delete($rowid) function delete($rowid)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
$this->db->begin(); $this->db->begin();
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_tva_sum WHERE fk_facture = '.$rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_tva_sum WHERE fk_facture = '.$rowid;
@ -550,7 +558,7 @@ class Facture
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_DELETE',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_DELETE',$this,$user,$langs,$conf);
// Fin appel triggers // Fin appel triggers
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@ -622,12 +630,12 @@ class Facture
return -1; return -1;
} }
$this->db->free($resqltemp); $this->db->free($resqltemp);
/* Definition de la date limite */ /* Definition de la date limite */
// 1 : ajout du nombre de jours // 1 : ajout du nombre de jours
$datelim = $this->date + ( $cdr_nbjour * 3600 * 24 ); $datelim = $this->date + ( $cdr_nbjour * 3600 * 24 );
// 2 : application de la règle "fin de mois" // 2 : application de la règle "fin de mois"
if ($cdr_fdm) if ($cdr_fdm)
{ {
@ -646,22 +654,22 @@ class Facture
$datelim=mktime(12,0,0,$mois,1,$annee); $datelim=mktime(12,0,0,$mois,1,$annee);
$datelim -= (3600 * 24); $datelim -= (3600 * 24);
} }
// 3 : application du décalage // 3 : application du décalage
$datelim += ( $cdr_decalage * 3600 * 24); $datelim += ( $cdr_decalage * 3600 * 24);
return $datelim; return $datelim;
} }
/** /**
* \brief Tag la facture comme payée complètement + appel trigger BILL_PAYED * \brief Tag la facture comme payée complètement + appel trigger BILL_PAYED
* \param user Objet utilisateur qui modifie * \param user Objet utilisateur qui modifie
* \return int <0 si ok, >0 si ok * \return int <0 si ok, >0 si ok
*/ */
function set_payed($user) function set_payed($user)
{ {
global $conf,$langs; global $conf,$langs;
dolibarr_syslog("Facture.class.php::set_payed rowid=".$this->id); dolibarr_syslog("Facture.class.php::set_payed rowid=".$this->id);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET paye=1 WHERE rowid = '.$this->id ; $sql.= ' SET paye=1 WHERE rowid = '.$this->id ;
@ -670,20 +678,20 @@ class Facture
if ($resql) if ($resql)
{ {
$this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0); $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_PAYED',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_PAYED',$this,$user,$langs,$conf);
// Fin appel triggers // Fin appel triggers
} }
return 1; return 1;
} }
/** /**
* \brief Tag la facture comme non payée complètement + appel trigger BILL_UNPAYED * \brief Tag la facture comme non payée complètement + appel trigger BILL_UNPAYED
* \param user Objet utilisateur qui modifie * \param user Objet utilisateur qui modifie
* \return int <0 si ok, >0 si ok * \return int <0 si ok, >0 si ok
*/ */
function set_unpayed($user) function set_unpayed($user)
@ -698,17 +706,17 @@ class Facture
if ($resql) if ($resql)
{ {
$this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0); $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_UNPAYED',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_UNPAYED',$this,$user,$langs,$conf);
// Fin appel triggers // Fin appel triggers
} }
return 1; return 1;
} }
/** /**
* \brief Tag la facture comme payer partiellement * \brief Tag la facture comme payer partiellement
* \param rowid id de la facture à modifier * \param rowid id de la facture à modifier
@ -721,7 +729,7 @@ class Facture
/** /**
* \brief Tag la facture comme abandonnée + appel trigger BILL_CANCEL * \brief Tag la facture comme abandonnée + appel trigger BILL_CANCEL
* \param user Objet utilisateur qui modifie * \param user Objet utilisateur qui modifie
* \return int <0 si ok, >0 si ok * \return int <0 si ok, >0 si ok
*/ */
function set_canceled($user) function set_canceled($user)
@ -758,7 +766,7 @@ class Facture
function set_valid($rowid, $user, $soc, $force_number='') function set_valid($rowid, $user, $soc, $force_number='')
{ {
global $conf,$langs; global $conf,$langs;
$error = 0; $error = 0;
if ($this->brouillon) if ($this->brouillon)
{ {
@ -829,7 +837,7 @@ class Facture
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$avoir=$obj->amount; $avoir=$obj->amount;
// On met à jour avoir comme affecté à facture // On met à jour avoir comme affecté à facture
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except';
$sql.= ' SET fk_facture = '.$this->id.','; $sql.= ' SET fk_facture = '.$this->id.',';
@ -864,8 +872,8 @@ class Facture
$i++; $i++;
} }
*/ */
/* /*
* Pour chaque produit, on met a jour indicateur nbvente * Pour chaque produit, on met a jour indicateur nbvente
* On crée ici une dénormalisation des données pas forcément utilisée. * On crée ici une dénormalisation des données pas forcément utilisée.
@ -896,7 +904,7 @@ class Facture
$this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0); $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);
$this->ref = $numfa; $this->ref = $numfa;
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
@ -926,13 +934,13 @@ class Facture
} }
} }
} }
/* /*
* *
* *
* *
*/ */
function set_pdf_model($user, $modelpdf) function set_pdf_model($user, $modelpdf)
{ {
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
@ -940,7 +948,7 @@ class Facture
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET model_pdf = '$modelpdf'"; $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET model_pdf = '$modelpdf'";
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;"; $sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
return 1; return 1;
@ -1056,7 +1064,7 @@ class Facture
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$rangmax = $row[0]; $rangmax = $row[0];
} }
if ($conf->global->PRODUIT_CHANGE_PROD_DESC) if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{ {
if (!$product_desc) if (!$product_desc)
@ -1071,7 +1079,7 @@ class Facture
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet '; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet ';
$sql.= ' (fk_facture, description, price, qty, tva_taux, fk_product, remise_percent, subprice, remise, date_start, date_end, fk_code_ventilation, rang)'; $sql.= ' (fk_facture, description, price, qty, tva_taux, fk_product, remise_percent, subprice, remise, date_start, date_end, fk_code_ventilation, rang)';
if ($conf->global->PRODUIT_CHANGE_PROD_DESC) if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{ {
$sql.= " VALUES ($facid, '".addslashes($product_desc)."','$price','$qty','$txtva',"; $sql.= " VALUES ($facid, '".addslashes($product_desc)."','$price','$qty','$txtva',";
@ -1080,7 +1088,7 @@ class Facture
{ {
$sql.= " VALUES ($facid, '".addslashes($desc)."','$price','$qty','$txtva',"; $sql.= " VALUES ($facid, '".addslashes($desc)."','$price','$qty','$txtva',";
} }
if ($fk_product) { $sql.= "'$fk_product',"; } if ($fk_product) { $sql.= "'$fk_product',"; }
else { $sql.='0,'; } else { $sql.='0,'; }
$sql.= " '$remise_percent','$subprice','$remise',"; $sql.= " '$remise_percent','$subprice','$remise',";
@ -1322,11 +1330,11 @@ class Facture
function set_remise_absolue($user, $remise) function set_remise_absolue($user, $remise)
{ {
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
{ {
$remise=price2num($remise); $remise=price2num($remise);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= ' SET remise_absolue = '.$remise; $sql.= ' SET remise_absolue = '.$remise;
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;'; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
@ -1354,7 +1362,7 @@ class Facture
function getSumTva() function getSumTva()
{ {
$tvs=array(); $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))
{ {
@ -1518,22 +1526,22 @@ class Facture
{ {
global $db, $langs; global $db, $langs;
$langs->load("bills"); $langs->load("bills");
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/";
if (defined("FACTURE_ADDON") && FACTURE_ADDON) if (defined("FACTURE_ADDON") && FACTURE_ADDON)
{ {
$file = FACTURE_ADDON."/".FACTURE_ADDON.".modules.php"; $file = FACTURE_ADDON."/".FACTURE_ADDON.".modules.php";
// Chargement de la classe de numérotation // Chargement de la classe de numérotation
$classname = "mod_facture_".FACTURE_ADDON; $classname = "mod_facture_".FACTURE_ADDON;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname(); $obj = new $classname();
$numref = ""; $numref = "";
$numref = $obj->getNumRef($soc,$this); $numref = $obj->getNumRef($soc,$this);
if ( $numref != "") if ( $numref != "")
{ {
return $numref; return $numref;
@ -1550,7 +1558,7 @@ class Facture
return ""; return "";
} }
} }
/** /**
* \brief Mets à jour les commentaires privés * \brief Mets à jour les commentaires privés
* \param note Commentaire * \param note Commentaire
@ -1596,7 +1604,7 @@ class Facture
return -1; return -1;
} }
} }
/** /**
* \brief Charge les informations de l'onglet info dans l'objet facture * \brief Charge les informations de l'onglet info dans l'objet facture
* \param id Id de la facture a charger * \param id Id de la facture a charger
@ -1712,7 +1720,7 @@ class Facture
/** /**
* \brief Créé une demande de prélèvement * \brief Créé une demande de prélèvement
* \param user Utilisateur créant la demande * \param user Utilisateur créant la demande
* \return int <0 si ko, >0 si ok * \return int <0 si ko, >0 si ok
*/ */
function demande_prelevement($user) function demande_prelevement($user)
{ {
@ -1967,14 +1975,14 @@ class Facture
if ($fk_socpeople <= 0) return -1; if ($fk_socpeople <= 0) return -1;
// Verifie type_contact // Verifie type_contact
if (! $type_contact || ! is_numeric($type_contact)) if (! $type_contact || ! is_numeric($type_contact))
{ {
$this->error="Valeur pour type_contact incorrect"; $this->error="Valeur pour type_contact incorrect";
return -3; return -3;
} }
$datecreate = time(); $datecreate = time();
// Insertion dans la base // Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
@ -1982,7 +1990,7 @@ class Facture
$sql.= $this->db->idate($datecreate); $sql.= $this->db->idate($datecreate);
$sql.= ", 4, '". $type_contact . "' "; $sql.= ", 4, '". $type_contact . "' ";
$sql.= ")"; $sql.= ")";
// Retour // Retour
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{ {
@ -1993,7 +2001,7 @@ class Facture
$this->error=$this->db->error()." - $sql"; $this->error=$this->db->error()." - $sql";
return -1; return -1;
} }
} }
/** /**
* \brief Mise a jour du contact associé une facture * \brief Mise a jour du contact associé une facture
@ -2019,16 +2027,16 @@ class Facture
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return -1; return -1;
} }
} }
/** /**
* \brief Supprime une ligne de contact * \brief Supprime une ligne de contact
* \param rowid La reference du contact * \param rowid La reference du contact
* \return statur >0 si ok, <0 si ko * \return statur >0 si ok, <0 si ko
*/ */
function delete_contact($rowid) function delete_contact($rowid)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE rowid =".$rowid; $sql.= " WHERE rowid =".$rowid;
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -2041,7 +2049,7 @@ class Facture
} }
} }
/** /**
* \brief Récupère les lignes de contact de l'objet * \brief Récupère les lignes de contact de l'objet
* \param statut Statut des lignes detail à récupérer * \param statut Statut des lignes detail à récupérer
* \param source Source du contact external (llx_socpeople) ou internal (llx_user) * \param source Source du contact external (llx_socpeople) ou internal (llx_user)
@ -2050,11 +2058,11 @@ class Facture
function liste_contact($statut=-1,$source='external') function liste_contact($statut=-1,$source='external')
{ {
global $langs; global $langs;
$element='facture'; $element='facture';
$tab=array(); $tab=array();
$sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id,"; $sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id,";
if ($source == 'internal') $sql.=" '-1' as socid,"; if ($source == 'internal') $sql.=" '-1' as socid,";
if ($source == 'external') $sql.=" t.fk_soc as socid,"; if ($source == 'external') $sql.=" t.fk_soc as socid,";
@ -2075,7 +2083,7 @@ class Facture
if ($source == 'external') $sql.= " AND ec.fk_socpeople = t.idp"; if ($source == 'external') $sql.= " AND ec.fk_socpeople = t.idp";
if ($statut >= 0) $sql.= " AND statut = '$statut'"; if ($statut >= 0) $sql.= " AND statut = '$statut'";
$sql.=" ORDER BY t.name ASC"; $sql.=" ORDER BY t.name ASC";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -2084,7 +2092,7 @@ class Facture
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code; $transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code;
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom,
@ -2101,7 +2109,7 @@ class Facture
} }
} }
/** /**
* \brief Le détail d'un contact * \brief Le détail d'un contact
* \param rowid L'identifiant du contact * \param rowid L'identifiant du contact
* \return object L'objet construit par DoliDb.fetch_object * \return object L'objet construit par DoliDb.fetch_object
@ -2131,9 +2139,9 @@ class Facture
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return null; return null;
} }
} }
/** /**
* \brief Liste les valeurs possibles de type de contacts pour les factures * \brief Liste les valeurs possibles de type de contacts pour les factures
* \param source 'internal' ou 'external' * \param source 'internal' ou 'external'
* \return array Tableau des types de contacts * \return array Tableau des types de contacts
@ -2141,11 +2149,11 @@ class Facture
function liste_type_contact($source) function liste_type_contact($source)
{ {
global $langs; global $langs;
$element='facture'; $element='facture';
$tab = array(); $tab = array();
$sql = "SELECT distinct tc.rowid, tc.code, tc.libelle"; $sql = "SELECT distinct tc.rowid, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE element='".$element."'"; $sql.= " WHERE element='".$element."'";
@ -2173,7 +2181,7 @@ class Facture
$this->error=$this->db->error(); $this->error=$this->db->error();
return null; return null;
} }
} }
/** /**
* \brief Retourne id des contacts d'une source et d'un type donné * \brief Retourne id des contacts d'une source et d'un type donné
@ -2181,14 +2189,14 @@ class Facture
* Exemple: contact client de livraison ('external', 'SHIPPING') * Exemple: contact client de livraison ('external', 'SHIPPING')
* Exemple: contact interne suivi paiement ('internal', 'SALESREPFOLL') * Exemple: contact interne suivi paiement ('internal', 'SALESREPFOLL')
* \return array Liste des id contacts * \return array Liste des id contacts
*/ */
function getIdContact($source,$code) function getIdContact($source,$code)
{ {
$element='facture'; // Contact sur la facture $element='facture'; // Contact sur la facture
$result=array(); $result=array();
$i=0; $i=0;
$sql = "SELECT ec.fk_socpeople"; $sql = "SELECT ec.fk_socpeople";
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE ec.element_id = ".$this->id; $sql.= " WHERE ec.element_id = ".$this->id;
@ -2211,14 +2219,14 @@ class Facture
$this->error=$this->db->error(); $this->error=$this->db->error();
return null; return null;
} }
return $result; return $result;
} }
/** /**
* \brief Retourne id des contacts clients de facturation * \brief Retourne id des contacts clients de facturation
* \return array Liste des id contacts facturation * \return array Liste des id contacts facturation
*/ */
function getIdBillingContact() function getIdBillingContact()
{ {
return $this->getIdContact('external','BILLING'); return $this->getIdContact('external','BILLING');
@ -2227,7 +2235,7 @@ class Facture
/** /**
* \brief Retourne id des contacts clients de livraison * \brief Retourne id des contacts clients de livraison
* \return array Liste des id contacts livraison * \return array Liste des id contacts livraison
*/ */
function getIdShippingContact() function getIdShippingContact()
{ {
return $this->getIdContact('external','SHIPPING'); return $this->getIdContact('external','SHIPPING');
@ -2253,12 +2261,12 @@ class Facture
while ($i < $num_socs) while ($i < $num_socs)
{ {
$i++; $i++;
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$socids[$i] = $row[0]; $socids[$i] = $row[0];
} }
} }
// Charge tableau des produits prodids // Charge tableau des produits prodids
$prodids = array(); $prodids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE envente=1"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE envente=1";
@ -2274,7 +2282,7 @@ class Facture
$prodids[$i] = $row[0]; $prodids[$i] = $row[0];
} }
} }
// Initialise paramètres // Initialise paramètres
$this->id=0; $this->id=0;
$this->ref = 'SPECIMEN'; $this->ref = 'SPECIMEN';
@ -2301,7 +2309,7 @@ class Facture
$this->lignes[$xnbp]=$ligne; $this->lignes[$xnbp]=$ligne;
$xnbp++; $xnbp++;
} }
$this->amount_ht = $xnbp*100; $this->amount_ht = $xnbp*100;
$this->total_ht = $xnbp*100; $this->total_ht = $xnbp*100;
$this->total_tva = $xnbp*19.6; $this->total_tva = $xnbp*19.6;

View File

@ -64,7 +64,7 @@ class ModelePDFFactures extends FPDF
$sql ="SELECT nom as id, nom as lib"; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'"; $sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -189,7 +189,7 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
else else
{ {
dolibarr_print_error('',"facture_pdf_create Error: ".$obj->error); dolibarr_print_error('',"facture_pdf_create Error: ".$obj->error);
$this->error=$langs->trans("Error")." ".$obj->error; $this->error=$langs->trans("Error")." ".$obj->error;
return -1; return -1;
} }
@ -210,17 +210,17 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
function facture_meta_create($db, $facid, $message="") function facture_meta_create($db, $facid, $message="")
{ {
global $langs,$conf; global $langs,$conf;
$fac = new Facture($db,"",$facid); $fac = new Facture($db,"",$facid);
$fac->fetch($facid); $fac->fetch($facid);
$fac->fetch_client(); $fac->fetch_client();
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$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 . ".meta"; $file = $dir . "/" . $facref . ".meta";
if (! file_exists($dir)) if (! file_exists($dir))
{ {
umask(0); umask(0);
@ -230,7 +230,7 @@ function facture_meta_create($db, $facid, $message="")
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
@ -241,7 +241,7 @@ NB_ITEMS=\"" . $nblignes . "\"
CLIENT=\"" . $client . "\" CLIENT=\"" . $client . "\"
TOTAL_HT=\"" . $fac->total_ht . "\" TOTAL_HT=\"" . $fac->total_ht . "\"
TOTAL_TTC=\"" . $fac->total_ttc . "\"\n"; TOTAL_TTC=\"" . $fac->total_ttc . "\"\n";
for ($i = 0 ; $i < $nblignes ; $i++) { for ($i = 0 ; $i < $nblignes ; $i++) {
//Pour les articles //Pour les articles
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $fac->lignes[$i]->qty . "\" $meta .= "ITEM_" . $i . "_QUANTITY=\"" . $fac->lignes[$i]->qty . "\"
@ -268,13 +268,13 @@ function facture_delete_preview($db, $facid)
global $langs,$conf; global $langs,$conf;
$fac = new Facture($db,"",$facid); $fac = new Facture($db,"",$facid);
$fac->fetch($facid); $fac->fetch($facid);
$fac->fetch_client(); $fac->fetch_client();
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$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.png"; $file = $dir . "/" . $facref . ".pdf.png";
if ( file_exists( $file ) && is_writable( $file ) ) if ( file_exists( $file ) && is_writable( $file ) )

View File

@ -32,7 +32,7 @@
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
/** /**
\class pdf_bernique \class pdf_bernique
\brief Classe permettant de générer les factures au modèle Bernique \brief Classe permettant de générer les factures au modèle Bernique
*/ */
@ -40,13 +40,13 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php")
class pdf_bernique extends ModelePDFFactures { class pdf_bernique extends ModelePDFFactures {
function pdf_bernique($db=0) function pdf_bernique($db=0)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("products"); $langs->load("products");
$this->db = $db; $this->db = $db;
$this->description = $langs->trans('PDFBerniqueDescription'); $this->description = $langs->trans('PDFBerniqueDescription');
@ -65,7 +65,7 @@ class pdf_bernique extends ModelePDFFactures {
function write_pdf_file($fac,$outputlangs='') 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)
{ {
// Définition de l'objet $fac (pour compatibilite ascendante) // Définition de l'objet $fac (pour compatibilite ascendante)
@ -88,7 +88,7 @@ class pdf_bernique extends ModelePDFFactures {
$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))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -97,61 +97,61 @@ class pdf_bernique extends ModelePDFFactures {
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
// Initialisation facture vierge // Initialisation facture vierge
$pdf=new FPDF('P','mm','A4'); $pdf=new FPDF('P','mm','A4');
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$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("Bill"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$tab_top = 100; $tab_top = 100;
$tab_height = 110; $tab_height = 110;
/* /*
* *
*/ */
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetXY (11, $curY ); $pdf->SetXY (11, $curY );
$pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J'); $pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (133, $curY); $pdf->SetXY (133, $curY);
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C'); $pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C');
$pdf->SetXY (145, $curY); $pdf->SetXY (145, $curY);
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C'); $pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
$pdf->SetXY (156, $curY); $pdf->SetXY (156, $curY);
$pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0); $pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (174, $curY); $pdf->SetXY (174, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); $total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
if ($nexY > 200 && $i < $nblignes - 1) if ($nexY > 200 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -161,14 +161,14 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$this->_tableau_tot($pdf, $fac, $tab_top, $tab_height); $this->_tableau_tot($pdf, $fac, $tab_top, $tab_height);
$this->_tableau_compl($pdf, $fac); $this->_tableau_compl($pdf, $fac);
/* /*
* *
*/ */
@ -178,7 +178,7 @@ class pdf_bernique extends ModelePDFFactures {
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_RIB_NUMBER); $account->fetch(FACTURE_RIB_NUMBER);
$pdf->SetXY (10, 40); $pdf->SetXY (10, 40);
$pdf->SetFont('Arial','U',8); $pdf->SetFont('Arial','U',8);
$pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0); $pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0);
@ -192,21 +192,21 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); $pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0);
} }
} }
/* /*
* *
* *
*/ */
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY(10, 260); $pdf->SetXY(10, 260);
$pdf->MultiCell(190, 5, $langs->trans("IntracommunityVATNumber").' : '.MAIN_INFO_TVAINTRA, 0, 'J'); $pdf->MultiCell(190, 5, $langs->trans("IntracommunityVATNumber").' : '.MAIN_INFO_TVAINTRA, 0, 'J');
$pdf->MultiCell(190, 5, $langs->trans("PrettyLittleSentence"), 0, 'J'); $pdf->MultiCell(190, 5, $langs->trans("PrettyLittleSentence"), 0, 'J');
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
return 1; return 1;
} }
else else
@ -221,7 +221,7 @@ class pdf_bernique extends ModelePDFFactures {
return 0; return 0;
} }
} }
/* /*
* *
* *
@ -232,18 +232,18 @@ class pdf_bernique extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab3_top = 240; $tab3_top = 240;
$tab3_height = 18; $tab3_height = 18;
$tab3_width = 60; $tab3_width = 60;
$pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height); $pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height);
$pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 ); $pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 );
$pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 ); $pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 );
$pdf->line(30, $tab3_top, 30, $tab3_top + $tab3_height ); $pdf->line(30, $tab3_top, 30, $tab3_top + $tab3_height );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY (10, $tab3_top - 6); $pdf->SetXY (10, $tab3_top - 6);
$pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0); $pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0);
@ -253,7 +253,7 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->MultiCell(20, 6, $langs->trans("ChequeNumber"), 0, 'L', 0); $pdf->MultiCell(20, 6, $langs->trans("ChequeNumber"), 0, 'L', 0);
$pdf->SetXY (10, $tab3_top + 12); $pdf->SetXY (10, $tab3_top + 12);
$pdf->MultiCell(20, 6, $langs->trans("Bank"), 0, 'L', 0); $pdf->MultiCell(20, 6, $langs->trans("Bank"), 0, 'L', 0);
/* /*
* Conditions de règlements * Conditions de règlements
*/ */
@ -267,25 +267,25 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->MultiCell(120, 5, $titre.$lib_condition_paiement, 0, 'J'); $pdf->MultiCell(120, 5, $titre.$lib_condition_paiement, 0, 'J');
} }
} }
function _tableau_tot(&$pdf, $fac, $top, $height) function _tableau_tot(&$pdf, $fac, $top, $height)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab2_top = $top + $height; $tab2_top = $top + $height;
$tab2_hl = 5; $tab2_hl = 5;
$tab2_height = $tab2_hl * 4; $tab2_height = $tab2_hl * 4;
$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);
foreach ($tvas as $key => $value) foreach ($tvas as $key => $value)
{ {
$pdf->SetXY (10, $tab4_top + ( $i * $tab2_hl)); $pdf->SetXY (10, $tab4_top + ( $i * $tab2_hl));
@ -299,43 +299,43 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->line(10, $tab4_top, 10, $tab4_top + ($tab2_hl * $i)); $pdf->line(10, $tab4_top, 10, $tab4_top + ($tab2_hl * $i));
$pdf->line(35, $tab4_top, 35, $tab4_top + ($tab2_hl * $i)); $pdf->line(35, $tab4_top, 35, $tab4_top + ($tab2_hl * $i));
$pdf->line(55, $tab4_top, 55, $tab4_top + ($tab2_hl * $i)); $pdf->line(55, $tab4_top, 55, $tab4_top + ($tab2_hl * $i));
$pdf->Rect(10, $tab2_top, 190, $tab2_hl * 2); $pdf->Rect(10, $tab2_top, 190, $tab2_hl * 2);
$pdf->line(10, $tab2_top + $tab2_hl, 200, $tab2_top + $tab2_hl); $pdf->line(10, $tab2_top + $tab2_hl, 200, $tab2_top + $tab2_hl);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0);
$pdf->SetXY (11, $tab2_top + $tab2_hl); $pdf->SetXY (11, $tab2_top + $tab2_hl);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("Discount")." ". $fac->remise_percent . " %", 0, 'L', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("Discount")." ". $fac->remise_percent . " %", 0, 'L', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * 2); $pdf->SetXY (132, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("WithDiscountTotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("WithDiscountTotalHT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * 3); $pdf->SetXY (132, $tab2_top + $tab2_hl * 3);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalVAT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalVAT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * 4); $pdf->SetXY (132, $tab2_top + $tab2_hl * 4);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl); $pdf->SetXY (174, $tab2_top + $tab2_hl);
$pdf->MultiCell(26, $tab2_hl, price($fac->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->remise), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * 2); $pdf->SetXY (174, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * 3); $pdf->SetXY (174, $tab2_top + $tab2_hl * 3);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * 4); $pdf->SetXY (174, $tab2_top + $tab2_hl * 4);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
} }
/* /*
* *
*/ */
@ -344,23 +344,23 @@ class pdf_bernique extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(11,$tab_top + 5,$langs->trans("Designation")); $pdf->Text(11,$tab_top + 5,$langs->trans("Designation"));
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->trans("VAT")); $pdf->Text(134,$tab_top + 5,$langs->trans("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->trans("Qty")); $pdf->Text(147,$tab_top + 5,$langs->trans("Qty"));
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height); $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
$pdf->Text(160,$tab_top + 5,$langs->trans("PriceU")); $pdf->Text(160,$tab_top + 5,$langs->trans("PriceU"));
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height); $pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->trans("Total")); $pdf->Text(187,$tab_top + 5,$langs->trans("Total"));
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
$pdf->line(10, $tab_top + 10, 200, $tab_top + 10 ); $pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
} }
@ -375,7 +375,7 @@ class pdf_bernique extends ModelePDFFactures {
global $langs,$conf; global $langs,$conf;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$pdf->SetXY(10,5); $pdf->SetXY(10,5);
if (defined("FAC_PDF_INTITULE")) if (defined("FAC_PDF_INTITULE"))
{ {
@ -383,7 +383,7 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L'); $pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
{ {
@ -400,7 +400,7 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(40, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(40, 5, "SIREN : ".MAIN_INFO_SIREN);
} }
if (defined("FAC_PDF_INTITULE2")) if (defined("FAC_PDF_INTITULE2"))
{ {
$pdf->SetXY(100,5); $pdf->SetXY(100,5);
@ -420,13 +420,13 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->SetXY(102,$pdf->GetY()); $pdf->SetXY(102,$pdf->GetY());
$pdf->MultiCell(66,5, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville); $pdf->MultiCell(66,5, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville);
$pdf->rect(100, 40, 100, 40); $pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->Text(11, 88, $langs->trans('Date').' : ' . strftime("%d %b %Y", $fac->date)); $pdf->Text(11, 88, $langs->trans('Date').' : ' . strftime("%d %b %Y", $fac->date));
$pdf->Text(11, 94, $langs->trans('Invoice').' : '.$fac->ref); $pdf->Text(11, 94, $langs->trans('Invoice').' : '.$fac->ref);
/* /*
*/ */
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@ -435,7 +435,7 @@ class pdf_bernique extends ModelePDFFactures {
$pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre); $pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
/* /*
*/ */
} }
} }

View File

@ -41,13 +41,13 @@ class pdf_bulot extends ModelePDFFactures {
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_bulot($db) function pdf_bulot($db)
{ {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("products"); $langs->load("products");
$this->db = $db; $this->db = $db;
$this->description = $langs->trans('PDFBulotDescription'); $this->description = $langs->trans('PDFBulotDescription');
@ -66,7 +66,7 @@ class pdf_bulot extends ModelePDFFactures {
function write_pdf_file($fac,$outputlangs='') 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)
{ {
// Définition de l'objet $fac (pour compatibilite ascendante) // Définition de l'objet $fac (pour compatibilite ascendante)
@ -89,7 +89,7 @@ class pdf_bulot extends ModelePDFFactures {
$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))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -98,61 +98,61 @@ class pdf_bulot extends ModelePDFFactures {
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
// Initialisation facture vierge // Initialisation facture vierge
$pdf=new FPDF('P','mm','A4'); $pdf=new FPDF('P','mm','A4');
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$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("Bill"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$tab_top = 100; $tab_top = 100;
$tab_height = 110; $tab_height = 110;
/* /*
* *
*/ */
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetXY (11, $curY ); $pdf->SetXY (11, $curY );
$pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J'); $pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (133, $curY); $pdf->SetXY (133, $curY);
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C'); $pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C');
$pdf->SetXY (145, $curY); $pdf->SetXY (145, $curY);
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C'); $pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
$pdf->SetXY (156, $curY); $pdf->SetXY (156, $curY);
$pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0); $pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (174, $curY); $pdf->SetXY (174, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); $total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
if ($nexY > 200 && $i < $nblignes - 1) if ($nexY > 200 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -162,14 +162,14 @@ class pdf_bulot extends ModelePDFFactures {
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$this->_tableau_tot($pdf, $fac, $tab_top, $tab_height); $this->_tableau_tot($pdf, $fac, $tab_top, $tab_height);
$this->_tableau_compl($pdf, $fac); $this->_tableau_compl($pdf, $fac);
/* /*
* *
*/ */
@ -179,7 +179,7 @@ class pdf_bulot extends ModelePDFFactures {
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_RIB_NUMBER); $account->fetch(FACTURE_RIB_NUMBER);
$pdf->SetXY (10, 40); $pdf->SetXY (10, 40);
$pdf->SetFont('Arial','U',8); $pdf->SetFont('Arial','U',8);
$pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0); $pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0);
@ -193,25 +193,25 @@ class pdf_bulot extends ModelePDFFactures {
$pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); $pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0);
} }
} }
/* /*
* *
* *
*/ */
$pdf->SetFont('Arial','U',12); $pdf->SetFont('Arial','U',12);
$pdf->SetXY(10, 220); $pdf->SetXY(10, 220);
$titre = $langs->trans("PaymentConditions").' : '.$fac->cond_reglement_facture; $titre = $langs->trans("PaymentConditions").' : '.$fac->cond_reglement_facture;
$pdf->MultiCell(190, 5, $titre, 0, 'J'); $pdf->MultiCell(190, 5, $titre, 0, 'J');
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY(10, 265); $pdf->SetXY(10, 265);
$pdf->MultiCell(190, 5, $langs->trans("PrettyLittleSentence"), 0, 'J'); $pdf->MultiCell(190, 5, $langs->trans("PrettyLittleSentence"), 0, 'J');
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
return 1; return 1;
} }
else else
@ -237,18 +237,18 @@ class pdf_bulot extends ModelePDFFactures {
function _tableau_compl(&$pdf, $fac) function _tableau_compl(&$pdf, $fac)
{ {
global $langs; global $langs;
$tab3_top = 240; $tab3_top = 240;
$tab3_height = 18; $tab3_height = 18;
$tab3_width = 60; $tab3_width = 60;
$pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height); $pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height);
$pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 ); $pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 );
$pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 ); $pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 );
$pdf->line(30, $tab3_top, 30, $tab3_top + $tab3_height ); $pdf->line(30, $tab3_top, 30, $tab3_top + $tab3_height );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY (10, $tab3_top - 6); $pdf->SetXY (10, $tab3_top - 6);
$pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0); $pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0);
@ -271,78 +271,78 @@ class pdf_bulot extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab2_top = $top + $height; $tab2_top = $top + $height;
$tab2_hl = 5; $tab2_hl = 5;
$tab2_height = $tab2_hl * 4; $tab2_height = $tab2_hl * 4;
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
// $pdf->Rect(132, $tab2_top, 68, $tab2_height); // $pdf->Rect(132, $tab2_top, 68, $tab2_height);
// $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height); // $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
// $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 ); // $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 );
// $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 ); // $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 );
// $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 ); // $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 );
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalHT"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
if ($fac->remise > 0) if ($fac->remise > 0)
{ {
$pdf->SetXY (132, $tab2_top + $tab2_hl); $pdf->SetXY (132, $tab2_top + $tab2_hl);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("GlobalDiscount"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("GlobalDiscount"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl); $pdf->SetXY (174, $tab2_top + $tab2_hl);
$pdf->MultiCell(26, $tab2_hl, price($fac->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->remise), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * 2); $pdf->SetXY (132, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("WithDiscountTotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("WithDiscountTotalHT"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * 2); $pdf->SetXY (174, $tab2_top + $tab2_hl * 2);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ht), 0, 'R', 0);
$index = 3; $index = 3;
} }
else else
{ {
$index = 1; $index = 1;
} }
$pdf->SetXY (132, $tab2_top + $tab2_hl * $index); $pdf->SetXY (132, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalVAT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalVAT"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * $index); $pdf->SetXY (174, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1)); $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1)); $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
$deja_regle = $fac->getSommePaiement(); $deja_regle = $fac->getSommePaiement();
if ($deja_regle > 0) if ($deja_regle > 0)
{ {
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+2)); $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+2));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+2)); $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+2));
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+3)); $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+3));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("RemainderToPay"), 0, 'R', 1); $pdf->MultiCell(42, $tab2_hl, $langs->trans("RemainderToPay"), 0, 'R', 1);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+3)); $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+3));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1);
} }
} }
/* /*
* \brief Affiche la grille des lignes de factures * \brief Affiche la grille des lignes de factures
* \param pdf objet PDF * \param pdf objet PDF
@ -352,23 +352,23 @@ class pdf_bulot extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(11,$tab_top + 5,$langs->trans("Designation")); $pdf->Text(11,$tab_top + 5,$langs->trans("Designation"));
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->trans("VAT")); $pdf->Text(134,$tab_top + 5,$langs->trans("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->trans("Qty")); $pdf->Text(147,$tab_top + 5,$langs->trans("Qty"));
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height); $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
$pdf->Text(160,$tab_top + 5,$langs->trans("PriceU")); $pdf->Text(160,$tab_top + 5,$langs->trans("PriceU"));
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height); $pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->trans("Total")); $pdf->Text(187,$tab_top + 5,$langs->trans("Total"));
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
$pdf->line(10, $tab_top + 10, 200, $tab_top + 10 ); $pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
} }
@ -384,7 +384,7 @@ class pdf_bulot extends ModelePDFFactures {
global $langs,$conf; global $langs,$conf;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$pdf->SetXY(10,5); $pdf->SetXY(10,5);
if (defined("FAC_PDF_INTITULE")) if (defined("FAC_PDF_INTITULE"))
{ {
@ -392,7 +392,7 @@ class pdf_bulot extends ModelePDFFactures {
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L'); $pdf->MultiCell(60, 8, FAC_PDF_INTITULE, 0, 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
{ {
@ -409,7 +409,7 @@ class pdf_bulot extends ModelePDFFactures {
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(40, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(40, 5, "SIREN : ".MAIN_INFO_SIREN);
} }
if (defined("FAC_PDF_INTITULE2")) if (defined("FAC_PDF_INTITULE2"))
{ {
$pdf->SetXY(100,5); $pdf->SetXY(100,5);
@ -429,13 +429,13 @@ class pdf_bulot extends ModelePDFFactures {
$pdf->SetXY(102,$pdf->GetY()); $pdf->SetXY(102,$pdf->GetY());
$pdf->MultiCell(66,5, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville); $pdf->MultiCell(66,5, $fac->client->adresse . "\n" . $fac->client->cp . " " . $fac->client->ville);
$pdf->rect(100, 40, 100, 40); $pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->Text(11, 88, $langs->trans('Date').' : ' . strftime("%d %b %Y", $fac->date)); $pdf->Text(11, 88, $langs->trans('Date').' : ' . strftime("%d %b %Y", $fac->date));
$pdf->Text(11, 94, $langs->trans('Invoice').' : '.$fac->ref); $pdf->Text(11, 94, $langs->trans('Invoice').' : '.$fac->ref);
/* /*
*/ */
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@ -444,9 +444,9 @@ class pdf_bulot extends ModelePDFFactures {
$pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre); $pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
/* /*
*/ */
} }
} }
?> ?>

View File

@ -39,7 +39,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
class pdf_crabe extends ModelePDFFactures class pdf_crabe extends ModelePDFFactures
{ {
/** /**
\brief Constructeur \brief Constructeur
\param db Handler accès base de donnée \param db Handler accès base de donnée
@ -47,11 +47,11 @@ class pdf_crabe extends ModelePDFFactures
function pdf_crabe($db) function pdf_crabe($db)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("products"); $langs->load("products");
$this->db = $db; $this->db = $db;
$this->name = "crabe"; $this->name = "crabe";
$this->description = $langs->trans('PDFCrabeDescription'); $this->description = $langs->trans('PDFCrabeDescription');
@ -71,7 +71,7 @@ class pdf_crabe extends ModelePDFFactures
$this->option_modereg = 1; // Affiche mode règlement $this->option_modereg = 1; // Affiche mode règlement
$this->option_condreg = 1; // Affiche conditions règlement $this->option_condreg = 1; // Affiche conditions règlement
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;
// Recupere code pays de l'emmetteur // Recupere code pays de l'emmetteur
@ -87,9 +87,9 @@ class pdf_crabe extends ModelePDFFactures
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
} }
$this->db->free($result); $this->db->free($result);
$this->tva=array(); $this->tva=array();
// Defini position des colonnes // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxtva=121; $this->posxtva=121;
@ -189,7 +189,7 @@ class pdf_crabe extends ModelePDFFactures
} }
$this->_pagehead($pdf, $fac); $this->_pagehead($pdf, $fac);
// Affiches lignes // Affiches lignes
$pagenb = 1; $pagenb = 1;
$tab_top = 90; $tab_top = 90;
@ -247,7 +247,7 @@ class pdf_crabe extends ModelePDFFactures
$prefix_prodserv = $langs->trans("Product")." "; $prefix_prodserv = $langs->trans("Product")." ";
if($prodser->type == 1) if($prodser->type == 1)
$prefix_prodserv = $langs->trans("Service")." "; $prefix_prodserv = $langs->trans("Service")." ";
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice; $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
} }
@ -259,7 +259,7 @@ class pdf_crabe extends ModelePDFFactures
if ($libelleproduitservice) $libelleproduitservice.="\n"; if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$fac->lignes[$i]->product_desc; $libelleproduitservice.=$fac->lignes[$i]->product_desc;
} }
} }
} }
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) { if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) {
@ -310,7 +310,7 @@ class pdf_crabe extends ModelePDFFactures
{ {
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY); $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY);
$this->_pagefoot($pdf); $this->_pagefoot($pdf);
// Nouvelle page // Nouvelle page
$pdf->AddPage(); $pdf->AddPage();
$pagenb++; $pagenb++;
@ -328,17 +328,17 @@ class pdf_crabe extends ModelePDFFactures
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$bottomlasttab=$tab_top + $tab_height + 1; $bottomlasttab=$tab_top + $tab_height + 1;
} }
else else
{ {
$this->_tableau($pdf, $tab_top_newpage, $tab_height, $nexY); $this->_tableau($pdf, $tab_top_newpage, $tab_height, $nexY);
$bottomlasttab=$tab_top_newpage + $tab_height + 1; $bottomlasttab=$tab_top_newpage + $tab_height + 1;
} }
$deja_regle = $fac->getSommePaiement(); $deja_regle = $fac->getSommePaiement();
$posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $bottomlasttab); $posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $bottomlasttab);
if ($deja_regle) { if ($deja_regle) {
$this->_tableau_versements($pdf, $fac, $posy); $this->_tableau_versements($pdf, $fac, $posy);
} }
@ -393,7 +393,7 @@ class pdf_crabe extends ModelePDFFactures
$account->fetch($conf->global->FACTURE_RIB_NUMBER); $account->fetch($conf->global->FACTURE_RIB_NUMBER);
$this->marges['g']=$this->marge_gauche; $this->marges['g']=$this->marge_gauche;
$cury=242; $cury=242;
$pdf->SetXY ($this->marges['g'], $cury); $pdf->SetXY ($this->marges['g'], $cury);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
@ -413,7 +413,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($this->marges['g']+60, $cury); $pdf->SetXY ($this->marges['g']+60, $cury);
$pdf->MultiCell(13, 3, $langs->trans("BankAccountNumberKey"), 0, 'C', 0); $pdf->MultiCell(13, 3, $langs->trans("BankAccountNumberKey"), 0, 'C', 0);
$pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY ($this->marges['g'], $cury+5); $pdf->SetXY ($this->marges['g'], $cury+5);
$pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0);
@ -423,7 +423,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0);
$pdf->SetXY ($this->marges['g']+60, $cury+5); $pdf->SetXY ($this->marges['g']+60, $cury+5);
$pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0);
$pdf->SetXY ($this->marges['g'], $cury+12); $pdf->SetXY ($this->marges['g'], $cury+12);
$pdf->MultiCell(90, 3, $langs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); $pdf->MultiCell(90, 3, $langs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0);
$pdf->SetXY ($this->marges['g'], $cury+22); $pdf->SetXY ($this->marges['g'], $cury+22);
@ -454,7 +454,7 @@ class pdf_crabe extends ModelePDFFactures
*/ */
$this->_pagefoot($pdf); $this->_pagefoot($pdf);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
@ -487,7 +487,7 @@ class pdf_crabe extends ModelePDFFactures
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab3_posx = 120; $tab3_posx = 120;
$tab3_top = $posy + 8; $tab3_top = $posy + 8;
$tab3_width = 80; $tab3_width = 80;
@ -520,7 +520,7 @@ class pdf_crabe extends ModelePDFFactures
while ($i < $num) { while ($i < $num) {
$y+=3; $y+=3;
$row = $this->db->fetch_row(); $row = $this->db->fetch_row();
$pdf->SetXY ($tab3_posx, $tab3_top+$y ); $pdf->SetXY ($tab3_posx, $tab3_top+$y );
$pdf->MultiCell(20, 4, strftime("%d/%m/%y",$row[0]), 0, 'L', 0); $pdf->MultiCell(20, 4, strftime("%d/%m/%y",$row[0]), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
@ -553,7 +553,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(20, 4, $oper, 0, 'L', 0); $pdf->MultiCell(20, 4, $oper, 0, 'L', 0);
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y); $pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
$pdf->MultiCell(20, 4, $row[3], 0, 'L', 0); $pdf->MultiCell(20, 4, $row[3], 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++;
@ -632,12 +632,12 @@ class pdf_crabe extends ModelePDFFactures
if ($tvakey) // On affiche pas taux 0 if ($tvakey) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = ( (float)$tvakey < 0 ) ? " (".$langs->trans("NonPercuRecuperable").")" : '' ; $tvacompl = ( (float)$tvakey < 0 ) ? " (".$langs->trans("NonPercuRecuperable").")" : '' ;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval * (float)$tvakey / 100 ), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval * (float)$tvakey / 100 ), 0, 'R', 1);
} }
@ -653,7 +653,7 @@ class pdf_crabe extends ModelePDFFactures
} }
$useborder=0; $useborder=0;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -668,7 +668,7 @@ class pdf_crabe extends ModelePDFFactures
if ($deja_regle > 0) if ($deja_regle > 0)
{ {
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'L', 0);
@ -686,7 +686,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
/* Ne semble pas requis par la réglementation /* Ne semble pas requis par la réglementation
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
@ -705,7 +705,7 @@ class pdf_crabe extends ModelePDFFactures
global $langs,$conf; global $langs,$conf;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
// Montants exprimés en (en tab_top - 1) // Montants exprimés en (en tab_top - 1)
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
@ -742,7 +742,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($this->posxdiscount-1, $tab_top+2); $pdf->SetXY ($this->posxdiscount-1, $tab_top+2);
$pdf->MultiCell(16,2, $langs->trans("ReductionShort"),'','C'); $pdf->MultiCell(16,2, $langs->trans("ReductionShort"),'','C');
} }
if ($this->atleastonediscount) if ($this->atleastonediscount)
{ {
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
@ -761,12 +761,12 @@ class pdf_crabe extends ModelePDFFactures
function _pagehead(&$pdf, $fac, $showadress=1) function _pagehead(&$pdf, $fac, $showadress=1)
{ {
global $langs,$conf,$mysoc; global $langs,$conf,$mysoc;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("propal"); $langs->load("propal");
$langs->load("companies"); $langs->load("companies");
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',13); $pdf->SetFont('Arial','B',13);
@ -800,7 +800,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $langs->trans("Invoice")." ".$fac->ref, '' , 'R'); $pdf->MultiCell(100, 4, $langs->trans("Invoice")." ".$fac->ref, '' , 'R');
$pdf->SetFont('Arial','',12); $pdf->SetFont('Arial','',12);
$posy+=6; $posy+=6;
$pdf->SetXY(100,$posy); $pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -820,21 +820,21 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY($this->marge_gauche,$posy-5); $pdf->SetXY($this->marge_gauche,$posy-5);
$pdf->MultiCell(66,5, $langs->trans("BillFrom").":"); $pdf->MultiCell(66,5, $langs->trans("BillFrom").":");
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
$pdf->SetFillColor(230,230,230); $pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetXY($this->marge_gauche+2,$posy+3); $pdf->SetXY($this->marge_gauche+2,$posy+3);
// Nom emetteur // Nom emetteur
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',11); $pdf->SetFont('Arial','B',11);
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L'); else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L');
// Caractéristiques emetteur // Caractéristiques emetteur
$carac_emetteur = ''; $carac_emetteur = '';
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE;
@ -855,11 +855,11 @@ class pdf_crabe extends ModelePDFFactures
// Web // Web
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW; if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW;
elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".$mysoc->url; elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".$mysoc->url;
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY($this->marge_gauche+2,$posy+8); $pdf->SetXY($this->marge_gauche+2,$posy+8);
$pdf->MultiCell(80,4, $carac_emetteur); $pdf->MultiCell(80,4, $carac_emetteur);
// Client destinataire // Client destinataire
$posy=42; $posy=42;
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@ -869,12 +869,12 @@ class pdf_crabe extends ModelePDFFactures
$fac->fetch_client(); $fac->fetch_client();
// Cadre client destinataire // Cadre client destinataire
$pdf->rect(100, $posy, 100, $hautcadre); $pdf->rect(100, $posy, 100, $hautcadre);
// Nom client // Nom client
$pdf->SetXY(102,$posy+3); $pdf->SetXY(102,$posy+3);
$pdf->SetFont('Arial','B',11); $pdf->SetFont('Arial','B',11);
$pdf->MultiCell(106,4, $fac->client->nom, 0, 'L'); $pdf->MultiCell(106,4, $fac->client->nom, 0, 'L');
// Caractéristiques client // Caractéristiques client
$carac_client=$fac->client->adresse; $carac_client=$fac->client->adresse;
$carac_client.="\n".$fac->client->cp . " " . $fac->client->ville."\n"; $carac_client.="\n".$fac->client->cp . " " . $fac->client->ville."\n";
@ -883,7 +883,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY(102,$posy+8); $pdf->SetXY(102,$posy+8);
$pdf->MultiCell(86,4, $carac_client); $pdf->MultiCell(86,4, $carac_client);
} }
} }
/* /*
@ -896,9 +896,9 @@ class pdf_crabe extends ModelePDFFactures
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$html=new Form($this->db); $html=new Form($this->db);
// Premiere ligne d'info réglementaires // Premiere ligne d'info réglementaires
$ligne1=""; $ligne1="";
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE)
@ -942,7 +942,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetY(-$posy); $pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); $pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--; $posy--;
if ($ligne1) if ($ligne1)
{ {
$pdf->SetXY($this->marge_gauche,-$posy); $pdf->SetXY($this->marge_gauche,-$posy);
@ -955,7 +955,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->marge_gauche,-$posy); $pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
} }
$pdf->SetXY(-20,-$posy); $pdf->SetXY(-20,-$posy);
$pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); $pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }

View File

@ -50,7 +50,7 @@ class pdf_huitre extends ModelePDFFactures {
$langs->load("bills"); $langs->load("bills");
$langs->load("products"); $langs->load("products");
$this->db = $db; $this->db = $db;
$this->name = "huitre"; $this->name = "huitre";
$this->description = $langs->trans('PDFHuitreDescription'); $this->description = $langs->trans('PDFHuitreDescription');
@ -71,7 +71,7 @@ class pdf_huitre extends ModelePDFFactures {
function write_pdf_file($fac,$outputlangs='') 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)
{ {
// Définition de l'objet $fac (pour compatibilite ascendante) // Définition de l'objet $fac (pour compatibilite ascendante)
@ -94,7 +94,7 @@ class pdf_huitre extends ModelePDFFactures {
$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))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -103,16 +103,16 @@ class pdf_huitre extends ModelePDFFactures {
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
// Initialisation facture vierge // Initialisation facture vierge
$pdf=new FPDF('P','mm','A4'); $pdf=new FPDF('P','mm','A4');
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$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("Bill"));
$pdf->SetCreator("Dolibarr (By ADYTEK)".DOL_VERSION); $pdf->SetCreator("Dolibarr (By ADYTEK)".DOL_VERSION);
@ -121,41 +121,41 @@ class pdf_huitre extends ModelePDFFactures {
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
$tab_top = 100; $tab_top = 100;
$tab_height = 110; $tab_height = 110;
$pdf->SetFillColor(242,239,119); $pdf->SetFillColor(242,239,119);
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
// Boucle sur les lignes de factures // Boucle sur les lignes de factures
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetXY (11, $curY ); $pdf->SetXY (11, $curY );
$pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J'); $pdf->MultiCell(118, 5, $fac->lignes[$i]->desc, 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (133, $curY); $pdf->SetXY (133, $curY);
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C'); $pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_taux, 0, 'C');
$pdf->SetXY (145, $curY); $pdf->SetXY (145, $curY);
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C'); $pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
$pdf->SetXY (156, $curY); $pdf->SetXY (156, $curY);
$pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0); $pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (174, $curY); $pdf->SetXY (174, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); $total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
if ($nexY > 200 && $i < $nblignes - 1) if ($nexY > 200 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -165,14 +165,14 @@ class pdf_huitre extends ModelePDFFactures {
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$this->_tableau_tot($pdf, $fac); $this->_tableau_tot($pdf, $fac);
$this->_tableau_compl($pdf, $fac); $this->_tableau_compl($pdf, $fac);
/* /*
* *
*/ */
@ -182,7 +182,7 @@ class pdf_huitre extends ModelePDFFactures {
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_RIB_NUMBER); $account->fetch(FACTURE_RIB_NUMBER);
$pdf->SetXY (10, 40); $pdf->SetXY (10, 40);
$pdf->SetFont('Arial','U',8); $pdf->SetFont('Arial','U',8);
$pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0); $pdf->MultiCell(40, 4, $langs->trans("BankDetails"), 0, 'L', 0);
@ -196,12 +196,12 @@ class pdf_huitre extends ModelePDFFactures {
$pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); $pdf->MultiCell(40, 4, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0);
} }
} }
/* /*
* *
* *
*/ */
if ( $fac->note_public) if ( $fac->note_public)
{ {
$pdf->SetFont('Arial','',7); $pdf->SetFont('Arial','',7);
@ -209,12 +209,12 @@ class pdf_huitre extends ModelePDFFactures {
$note = $langs->trans("Note").' : '.$fac->note_public; $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);
$titre = $langs->trans("PaymentConditions").' : '.$fac->cond_reglement_facture; $titre = $langs->trans("PaymentConditions").' : '.$fac->cond_reglement_facture;
$pdf->MultiCell(190, 5, $titre, 0, 'J'); $pdf->MultiCell(190, 5, $titre, 0, 'J');
$pdf->SetFont('Arial','',6); $pdf->SetFont('Arial','',6);
$pdf->SetXY(10, 265); $pdf->SetXY(10, 265);
$pdf->MultiCell(90, 2, $langs->trans('LawApplicationPart1'), 0, 'J'); $pdf->MultiCell(90, 2, $langs->trans('LawApplicationPart1'), 0, 'J');
@ -224,27 +224,27 @@ class pdf_huitre extends ModelePDFFactures {
$pdf->MultiCell(90, 2, $langs->trans('LawApplicationPart3'), 0, 'J'); $pdf->MultiCell(90, 2, $langs->trans('LawApplicationPart3'), 0, 'J');
$pdf->SetXY(10, 271); $pdf->SetXY(10, 271);
$pdf->MultiCell(90, 2, $langs->trans('LawApplicationPart4'), 0, 'J'); $pdf->MultiCell(90, 2, $langs->trans('LawApplicationPart4'), 0, 'J');
$pdf->SetFont('Arial','',7); $pdf->SetFont('Arial','',7);
$pdf->SetXY(85, 271); $pdf->SetXY(85, 271);
$pdf->MultiCell(90, 3, $langs->trans('VATDischarged'), 0, 'J'); $pdf->MultiCell(90, 3, $langs->trans('VATDischarged'), 0, 'J');
$this->_pagefoot($pdf, $fac); $this->_pagefoot($pdf, $fac);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
//---- //----
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFillColor(242,239,119); $pdf->SetFillColor(242,239,119);
$pdf->SetLineWidth(0.5); $pdf->SetLineWidth(0.5);
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
return 1; // Pas d'erreur return 1; // Pas d'erreur
} }
else else
@ -261,8 +261,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
} }
/* /*
* *
* *
@ -312,18 +312,18 @@ class pdf_huitre extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab3_top = 240; $tab3_top = 240;
$tab3_height = 18; $tab3_height = 18;
$tab3_width = 60; $tab3_width = 60;
$pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height); $pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height);
$pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 ); $pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 );
$pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 ); $pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 );
$pdf->line(40, $tab3_top, 40, $tab3_top + $tab3_height ); $pdf->line(40, $tab3_top, 40, $tab3_top + $tab3_height );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY (10, $tab3_top - 6); $pdf->SetXY (10, $tab3_top - 6);
$pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0); $pdf->MultiCell(60, 6, $langs->trans("ExtraInfos"), 0, 'L', 0);
@ -345,15 +345,15 @@ class pdf_huitre extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab2_top = 212; $tab2_top = 212;
$tab2_hl = 5; $tab2_hl = 5;
$tab2_height = $tab2_hl * 4; $tab2_height = $tab2_hl * 4;
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
// $pdf->Rect(132, $tab2_top, 68, $tab2_height); // $pdf->Rect(132, $tab2_top, 68, $tab2_height);
// $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height); // $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
// $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 ); // $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 );
// $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 ); // $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 );
// $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 ); // $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 );
@ -390,10 +390,10 @@ class pdf_huitre extends ModelePDFFactures {
$pdf->SetXY (174, $tab2_top + $tab2_hl * $index); $pdf->SetXY (174, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1)); $pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1); $pdf->MultiCell(42, $tab2_hl, $langs->trans("TotalTTC"), 0, 'R', 1);
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1)); $pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1));
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1); $pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
@ -423,14 +423,14 @@ class pdf_huitre extends ModelePDFFactures {
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(11,$tab_top + 5,$langs->trans("Designation")); $pdf->Text(11,$tab_top + 5,$langs->trans("Designation"));
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->trans("VAT")); $pdf->Text(134,$tab_top + 5,$langs->trans("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->trans("Qty")); $pdf->Text(147,$tab_top + 5,$langs->trans("Qty"));
@ -439,7 +439,7 @@ class pdf_huitre extends ModelePDFFactures {
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height); $pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->trans("Total")); $pdf->Text(187,$tab_top + 5,$langs->trans("Total"));
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
$pdf->line(10, $tab_top + 10, 200, $tab_top + 10 ); $pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
} }
@ -531,7 +531,7 @@ class pdf_huitre extends ModelePDFFactures {
*/ */
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFillColor(242,239,119); $pdf->SetFillColor(242,239,119);
// $this->RoundedRect(100, 40, 100, 40, 3, 'F'); // $this->RoundedRect(100, 40, 100, 40, 3, 'F');
$pdf->rect(100, 40, 100, 40, 'F'); $pdf->rect(100, 40, 100, 40, 'F');
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);

View File

@ -41,8 +41,8 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php")
class pdf_oursin extends ModelePDFFactures class pdf_oursin extends ModelePDFFactures
{ {
var $marges=array("g"=>10,"h"=>5,"d"=>10,"b"=>15); var $marges=array("g"=>10,"h"=>5,"d"=>10,"b"=>15);
/** /**
\brief Constructeur \brief Constructeur
\param db handler accès base de donnée \param db handler accès base de donnée
@ -50,7 +50,7 @@ class pdf_oursin extends ModelePDFFactures
function pdf_oursin($db) function pdf_oursin($db)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("products"); $langs->load("products");
@ -71,7 +71,7 @@ class pdf_oursin extends ModelePDFFactures
$this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE $this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;
// Recupere code pays de l'emmetteur // Recupere code pays de l'emmetteur
$this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas $this->emetteur->code_pays=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
@ -111,11 +111,11 @@ class pdf_oursin extends ModelePDFFactures
function write_pdf_file($fac,$outputlangs='') function write_pdf_file($fac,$outputlangs='')
{ {
global $user,$langs,$conf,$mysoc; global $user,$langs,$conf,$mysoc;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("products"); $langs->load("products");
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
// Définition de l'objet $fac (pour compatibilite ascendante) // Définition de l'objet $fac (pour compatibilite ascendante)
@ -138,7 +138,7 @@ class pdf_oursin extends ModelePDFFactures
$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))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -147,49 +147,49 @@ class pdf_oursin extends ModelePDFFactures
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
// Initialisation facture vierge // Initialisation facture vierge
$pdf=new FPDF('P','mm',$this->format); $pdf=new FPDF('P','mm',$this->format);
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$this->_pagehead($pdf, $fac); $this->_pagehead($pdf, $fac);
$pdf->SetTitle($fac->ref); $pdf->SetTitle($fac->ref);
$pdf->SetSubject($langs->trans("Invoice")); $pdf->SetSubject($langs->trans("Invoice"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$pdf->SetMargins(10, 10, 10); $pdf->SetMargins(10, 10, 10);
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
$tab_top = $this->marges['h']+90; $tab_top = $this->marges['h']+90;
$tab_height = 110; $tab_height = 110;
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetXY ($this->marges['g'], $tab_top + $this->marges['g'] ); $pdf->SetXY ($this->marges['g'], $tab_top + $this->marges['g'] );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
// Boucle sur les lignes de factures // Boucle sur les lignes de factures
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
// Description produit // Description produit
$codeproduitservice=""; $codeproduitservice="";
$pdf->SetXY ($this->marges['g']+ 1, $curY ); $pdf->SetXY ($this->marges['g']+ 1, $curY );
if (defined("FACTURE_CODEPRODUITSERVICE") && FACTURE_CODEPRODUITSERVICE) { if (defined("FACTURE_CODEPRODUITSERVICE") && FACTURE_CODEPRODUITSERVICE) {
// Affiche code produit si ligne associée à un code produit // Affiche code produit si ligne associée à un code produit
$prodser = new Product($this->db); $prodser = new Product($this->db);
$prodser->fetch($fac->lignes[$i]->produit_id); $prodser->fetch($fac->lignes[$i]->produit_id);
if ($prodser->ref) { if ($prodser->ref) {
$codeproduitservice=" - ".$langs->trans("ProductCode")." ".$prodser->ref; $codeproduitservice=" - ".$langs->trans("ProductCode")." ".$prodser->ref;
@ -200,9 +200,9 @@ class pdf_oursin extends ModelePDFFactures
$codeproduitservice.=" (".$langs->trans("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")"; $codeproduitservice.=" (".$langs->trans("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")";
} }
$pdf->MultiCell(108, 5, $fac->lignes[$i]->desc."$codeproduitservice", 0, 'J'); $pdf->MultiCell(108, 5, $fac->lignes[$i]->desc."$codeproduitservice", 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA
if ($this->franchise!=1) if ($this->franchise!=1)
{ {
@ -212,23 +212,23 @@ class pdf_oursin extends ModelePDFFactures
// Prix unitaire HT avant remise // Prix unitaire HT avant remise
$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');
// Remise sur ligne // Remise sur ligne
$pdf->SetXY ($this->marges['g']+160, $curY); $pdf->SetXY ($this->marges['g']+160, $curY);
if ($fac->lignes[$i]->remise_percent) { if ($fac->lignes[$i]->remise_percent) {
$pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R'); $pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R');
} }
// Total HT // Total HT
$pdf->SetXY ($this->marges['g']+168, $curY); $pdf->SetXY ($this->marges['g']+168, $curY);
$total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty); $total = price($fac->lignes[$i]->price * $fac->lignes[$i]->qty);
$pdf->MultiCell(21, 5, $total, 0, 'R', 0); $pdf->MultiCell(21, 5, $total, 0, 'R', 0);
if ($nexY > 200 && $i < $nblignes - 1) if ($nexY > 200 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac); $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac);
@ -238,18 +238,18 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac); $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac);
$deja_regle = $fac->getSommePaiement(); $deja_regle = $fac->getSommePaiement();
$this->_tableau_tot($pdf, $fac, $deja_regle); $this->_tableau_tot($pdf, $fac, $deja_regle);
if ($deja_regle) { if ($deja_regle) {
$this->_tableau_versements($pdf, $fac); $this->_tableau_versements($pdf, $fac);
} }
/* /*
* Mode de règlement * Mode de règlement
*/ */
@ -261,7 +261,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(90, 3, $langs->trans("ErrorCreateBankAccount"),0,'L',0); $pdf->MultiCell(90, 3, $langs->trans("ErrorCreateBankAccount"),0,'L',0);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
/* /*
* Propose mode règlement par CHQ * Propose mode règlement par CHQ
*/ */
@ -271,7 +271,7 @@ class pdf_oursin extends ModelePDFFactures
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_CHQ_NUMBER); $account->fetch(FACTURE_CHQ_NUMBER);
$pdf->SetXY ($this->marges['g'], 225); $pdf->SetXY ($this->marges['g'], 225);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $langs->trans('PaymentByChequeOrderedTo').' '.$account->proprio.' '.$langs->trans('SendTo').':',0,'L',0); $pdf->MultiCell(90, 3, $langs->trans('PaymentByChequeOrderedTo').' '.$account->proprio.' '.$langs->trans('SendTo').':',0,'L',0);
@ -280,7 +280,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0);
} }
} }
/* /*
* Propose mode règlement par RIB * Propose mode règlement par RIB
*/ */
@ -290,7 +290,7 @@ class pdf_oursin extends ModelePDFFactures
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_RIB_NUMBER); $account->fetch(FACTURE_RIB_NUMBER);
$cury=240; $cury=240;
$pdf->SetXY ($this->marges['g'], $cury); $pdf->SetXY ($this->marges['g'], $cury);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
@ -310,7 +310,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY ($this->marges['g']+60, $cury); $pdf->SetXY ($this->marges['g']+60, $cury);
$pdf->MultiCell(13, 3, $langs->trans("BankAccountNumberKey"), 0, 'C', 0); $pdf->MultiCell(13, 3, $langs->trans("BankAccountNumberKey"), 0, 'C', 0);
$pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY ($this->marges['g'], $cury+5); $pdf->SetXY ($this->marges['g'], $cury+5);
$pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0);
@ -320,7 +320,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0);
$pdf->SetXY ($this->marges['g']+60, $cury+5); $pdf->SetXY ($this->marges['g']+60, $cury+5);
$pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0);
$pdf->SetXY ($this->marges['g'], $cury+15); $pdf->SetXY ($this->marges['g'], $cury+15);
$pdf->MultiCell(90, 3, $langs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); $pdf->MultiCell(90, 3, $langs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0);
$pdf->SetXY ($this->marges['g'], $cury+25); $pdf->SetXY ($this->marges['g'], $cury+25);
@ -329,7 +329,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(90, 3, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); $pdf->MultiCell(90, 3, $langs->trans("BIC").' : ' . $account->bic, 0, 'L', 0);
} }
} }
/* /*
* Conditions de règlements * Conditions de règlements
*/ */
@ -343,17 +343,17 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY($this->marges['g']+44, 217); $pdf->SetXY($this->marges['g']+44, 217);
$pdf->MultiCell(80, 5, $fac->cond_reglement_facture,0,'L'); $pdf->MultiCell(80, 5, $fac->cond_reglement_facture,0,'L');
} }
/* /*
* Pied de page * Pied de page
*/ */
$this->_pagefoot($pdf, $fac); $this->_pagefoot($pdf, $fac);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
return 1; // Pas d'erreur return 1; // Pas d'erreur
} }
else else
@ -382,7 +382,7 @@ class pdf_oursin extends ModelePDFFactures
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$tab3_posx = $this->marges['g']+110; $tab3_posx = $this->marges['g']+110;
$tab3_top = $this->marges['h']+235; $tab3_top = $this->marges['h']+235;
$tab3_width = 80; $tab3_width = 80;
@ -415,7 +415,7 @@ class pdf_oursin extends ModelePDFFactures
while ($i < $num) { while ($i < $num) {
$y+=3; $y+=3;
$row = $this->db->fetch_row(); $row = $this->db->fetch_row();
$pdf->SetXY ($tab3_posx, $tab3_top+$y ); $pdf->SetXY ($tab3_posx, $tab3_top+$y );
$pdf->MultiCell(20, 4, strftime("%d/%m/%y",$row[0]), 0, 'L', 0); $pdf->MultiCell(20, 4, strftime("%d/%m/%y",$row[0]), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
@ -448,7 +448,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(20, 4, $oper, 0, 'L', 0); $pdf->MultiCell(20, 4, $oper, 0, 'L', 0);
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y); $pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
$pdf->MultiCell(20, 4, $row[3], 0, 'L', 0); $pdf->MultiCell(20, 4, $row[3], 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++;
@ -558,7 +558,7 @@ class pdf_oursin extends ModelePDFFactures
global $langs; global $langs;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $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+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->line( $this->marges['g'], $tab_top + $tab_height, 210-$this->marges['d'], $tab_top + $tab_height );
@ -572,8 +572,8 @@ class pdf_oursin extends ModelePDFFactures
$nblignes = sizeof($fac->lignes); $nblignes = sizeof($fac->lignes);
$rem=0; $rem=0;
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
if ($fac->lignes[$i]->remise_percent) if ($fac->lignes[$i]->remise_percent)
{ {
$rem=1; $rem=1;
} }
if ($rem==1) if ($rem==1)
@ -595,7 +595,7 @@ class pdf_oursin extends ModelePDFFactures
$langs->load("bills"); $langs->load("bills");
$langs->load("propal"); $langs->load("propal");
$langs->load("companies"); $langs->load("companies");
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',13); $pdf->SetFont('Arial','B',13);
@ -603,15 +603,15 @@ class pdf_oursin extends ModelePDFFactures
// Logo // Logo
$logo=$conf->societe->dir_logos.'/'.$mysoc->logo; $logo=$conf->societe->dir_logos.'/'.$mysoc->logo;
if ($mysoc->logo) if ($mysoc->logo)
{ {
if (is_readable($logo)) if (is_readable($logo))
{ {
$taille=getimagesize($logo); $taille=getimagesize($logo);
$longueur=$taille[0]/2.835; $longueur=$taille[0]/2.835;
$pdf->Image($logo, $this->marges['g'], $this->marges['h'], 0, 24); $pdf->Image($logo, $this->marges['g'], $this->marges['h'], 0, 24);
} }
else else
{ {
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
@ -632,7 +632,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY($this->marges['g'],$posy-5); $pdf->SetXY($this->marges['g'],$posy-5);
$pdf->SetXY($this->marges['g'],$posy); $pdf->SetXY($this->marges['g'],$posy);
$pdf->SetFillColor(255,255,255); $pdf->SetFillColor(255,255,255);
@ -652,7 +652,7 @@ class pdf_oursin extends ModelePDFFactures
{ {
$pdf->MultiCell(80, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L'); $pdf->MultiCell(80, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L');
} }
// Caractéristiques emetteur // Caractéristiques emetteur
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
@ -722,7 +722,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->MultiCell(60, 4, $langs->trans("Project")." : ".$projet->title); $pdf->MultiCell(60, 4, $langs->trans("Project")." : ".$projet->title);
} }
/* /*
* ref propal * ref propal
*/ */
@ -734,8 +734,8 @@ class pdf_oursin extends ModelePDFFactures
$objp = $fac->db->fetch_object(); $objp = $fac->db->fetch_object();
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->MultiCell(60, 4, $langs->trans("RefProposal")." : ".$objp->ref); $pdf->MultiCell(60, 4, $langs->trans("RefProposal")." : ".$objp->ref);
} }
/* /*
* monnaie * monnaie
*/ */
@ -759,7 +759,7 @@ class pdf_oursin extends ModelePDFFactures
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$footy=13; $footy=13;
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);

View File

@ -21,7 +21,7 @@
* $Source$ * $Source$
*/ */
/** /**
\file htdocs/includes/modules/propale/modules_propale.php \file htdocs/includes/modules/propale/modules_propale.php
\ingroup propale \ingroup propale
\brief Fichier contenant la classe mère de generation des propales en PDF \brief Fichier contenant la classe mère de generation des propales en PDF
@ -40,16 +40,16 @@ require_once(FPDF_PATH.'fpdf.php');
class ModelePDFPropales extends FPDF class ModelePDFPropales extends FPDF
{ {
var $error=''; var $error='';
/** /**
* \brief Renvoi le dernier message d'erreur de création de propale * \brief Renvoi le dernier message d'erreur de création de propale
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
* \brief Renvoi la liste des modèles actifs * \brief Renvoi la liste des modèles actifs
*/ */
function liste_modeles($db) function liste_modeles($db)
@ -59,7 +59,7 @@ class ModelePDFPropales extends FPDF
$sql ="SELECT nom as id, nom as lib"; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'"; $sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -128,7 +128,7 @@ class ModeleNumRefPropales
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
} }
@ -206,14 +206,14 @@ function propale_delete_preview($db, $propalid, $propalref='')
$propal->fetch($propalid); $propal->fetch($propalid);
$propalref = $propal->ref; $propalref = $propal->ref;
} }
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
$propref = sanitize_string($propalref); $propref = sanitize_string($propalref);
$dir = $conf->propal->dir_output . "/" . $propalref ; $dir = $conf->propal->dir_output . "/" . $propalref ;
$file = $dir . "/" . $propalref . ".pdf.png"; $file = $dir . "/" . $propalref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";
if ( file_exists( $file ) && is_writable( $file ) ) if ( file_exists( $file ) && is_writable( $file ) )
{ {
if ( ! unlink($file) ) if ( ! unlink($file) )
@ -227,7 +227,7 @@ function propale_delete_preview($db, $propalid, $propalref='')
for ($i = 0; $i < 20; $i++) for ($i = 0; $i < 20; $i++)
{ {
$preview = $multiple.$i; $preview = $multiple.$i;
if ( file_exists( $preview ) && is_writable( $preview ) ) if ( file_exists( $preview ) && is_writable( $preview ) )
{ {
if ( ! unlink($preview) ) if ( ! unlink($preview) )

View File

@ -40,7 +40,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
class pdf_propale_azur extends ModelePDFPropales class pdf_propale_azur extends ModelePDFPropales
{ {
/** /**
\brief Constructeur \brief Constructeur
\param db Handler accès base de donnée \param db Handler accès base de donnée
@ -49,6 +49,10 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("main");
$langs->load("bills");
$langs->load("products");
$this->db = $db; $this->db = $db;
$this->name = "azur"; $this->name = "azur";
$this->description = "Modèle de propositions commerciales complet (logo...)"; $this->description = "Modèle de propositions commerciales complet (logo...)";
@ -62,13 +66,13 @@ class pdf_propale_azur extends ModelePDFPropales
$this->marge_droite=10; $this->marge_droite=10;
$this->marge_haute=10; $this->marge_haute=10;
$this->marge_basse=10; $this->marge_basse=10;
$this->option_logo = 1; // Affiche logo $this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Affiche mode règlement $this->option_modereg = 1; // Affiche mode règlement
$this->option_condreg = 1; // Affiche conditions règlement $this->option_condreg = 1; // Affiche conditions règlement
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;
// Recupere code pays de l'emmetteur // Recupere code pays de l'emmetteur
@ -94,7 +98,7 @@ class pdf_propale_azur extends ModelePDFPropales
$this->posxqty=151; $this->posxqty=151;
$this->posxdiscount=162; $this->posxdiscount=162;
$this->postotalht=177; $this->postotalht=177;
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
$this->atleastonediscount=0; $this->atleastonediscount=0;
} }
@ -103,7 +107,7 @@ class pdf_propale_azur extends ModelePDFPropales
\brief Renvoi dernière erreur \brief Renvoi dernière erreur
\return string Dernière erreur \return string Dernière erreur
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
@ -127,10 +131,10 @@ class pdf_propale_azur extends ModelePDFPropales
\remarks MAIN_INFO_CAPITAL \remarks MAIN_INFO_CAPITAL
\remarks MAIN_INFO_TVAINTRA \remarks MAIN_INFO_TVAINTRA
*/ */
function write_pdf_file($propale) function write_pdf_file($propale,$outputlangs='')
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$mysoc;
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
// Définition de l'objet $propale (pour compatibilite ascendante) // Définition de l'objet $propale (pour compatibilite ascendante)
@ -140,7 +144,7 @@ class pdf_propale_azur extends ModelePDFPropales
$propale = new Propal($this->db,"",$id); $propale = new Propal($this->db,"",$id);
$ret=$propale->fetch($id); $ret=$propale->fetch($id);
} }
// Définition de $dir et $file // Définition de $dir et $file
if ($propale->specimen) if ($propale->specimen)
{ {
@ -153,7 +157,7 @@ class pdf_propale_azur extends ModelePDFPropales
$dir = $conf->propal->dir_output . "/" . $propref; $dir = $conf->propal->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }
if (! file_exists($dir)) if (! file_exists($dir))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -162,24 +166,26 @@ class pdf_propale_azur extends ModelePDFPropales
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
$nblignes = sizeof($propale->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();
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetDrawColor(128,128,128); $pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject($langs->trans("Bill")); $pdf->SetSubject($langs->trans("Bill"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise // Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
@ -188,30 +194,30 @@ class pdf_propale_azur extends ModelePDFPropales
$this->atleastonediscount++; $this->atleastonediscount++;
} }
} }
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale);
// Affiches lignes // Affiches lignes
$pagenb = 1; $pagenb = 1;
$tab_top = 90; $tab_top = 90;
$tab_top_newpage = 50; $tab_top_newpage = 50;
$tab_height = 110; $tab_height = 110;
// Affiche notes // Affiche notes
if ($propale->note_public) if ($propale->note_public)
{ {
$tab_top = 88; $tab_top = 88;
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
$pdf->SetXY ($this->posxdesc-1, $tab_top); $pdf->SetXY ($this->posxdesc-1, $tab_top);
$pdf->MultiCell(190, 3, $propale->note_public, 0, 'J'); $pdf->MultiCell(190, 3, $propale->note_public, 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$height_note=$nexY-$tab_top; $height_note=$nexY-$tab_top;
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192); $pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note; $tab_height = $tab_height - $height_note;
$tab_top = $nexY+6; $tab_top = $nexY+6;
} }
@ -219,16 +225,16 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
$height_note=0; $height_note=0;
} }
$iniY = $tab_top + 8; $iniY = $tab_top + 8;
$curY = $tab_top + 8; $curY = $tab_top + 8;
$nexY = $tab_top + 8; $nexY = $tab_top + 8;
// Boucle sur les lignes // Boucle sur les lignes
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
// Description de la ligne produit // Description de la ligne produit
$libelleproduitservice=$propale->lignes[$i]->libelle; $libelleproduitservice=$propale->lignes[$i]->libelle;
if ($propale->lignes[$i]->desc&&$propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle) if ($propale->lignes[$i]->desc&&$propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
@ -240,7 +246,7 @@ class pdf_propale_azur extends ModelePDFPropales
if ($propale->lignes[$i]->product_id) if ($propale->lignes[$i]->product_id)
{ {
$prodser = new Product($this->db); $prodser = new Product($this->db);
$prodser->fetch($propale->lignes[$i]->product_id); $prodser->fetch($propale->lignes[$i]->product_id);
if ($prodser->ref) if ($prodser->ref)
{ {
@ -249,10 +255,10 @@ class pdf_propale_azur extends ModelePDFPropales
$prefix_prodserv = $langs->trans("Product")." "; $prefix_prodserv = $langs->trans("Product")." ";
if($prodser->type == 1) if($prodser->type == 1)
$prefix_prodserv = $langs->trans("Service")." "; $prefix_prodserv = $langs->trans("Service")." ";
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice; $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
} }
// Ajoute description du produit // Ajoute description du produit
if ($conf->global->PROP_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) if ($conf->global->PROP_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{ {
@ -268,46 +274,46 @@ class pdf_propale_azur extends ModelePDFPropales
// Affichage durée si il y en a une // Affichage durée si il y en a une
$libelleproduitservice.="\n(".$langs->trans("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end).")"; $libelleproduitservice.="\n(".$langs->trans("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start)." ".$langs->trans("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end).")";
} }
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
$pdf->SetXY ($this->posxdesc-1, $curY); $pdf->SetXY ($this->posxdesc-1, $curY);
$pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J'); $pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA
$pdf->SetXY ($this->posxtva, $curY); $pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell(10, 4, ($propale->lignes[$i]->tva_tx < 0 ? '*':'').abs($propale->lignes[$i]->tva_tx), 0, 'R'); $pdf->MultiCell(10, 4, ($propale->lignes[$i]->tva_tx < 0 ? '*':'').abs($propale->lignes[$i]->tva_tx), 0, 'R');
// Prix unitaire HT avant remise // Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY); $pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell(18, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0); $pdf->MultiCell(18, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0);
// Quantit // Quantit
$pdf->SetXY ($this->posxqty, $curY); $pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell(10, 4, $propale->lignes[$i]->qty, 0, 'R'); $pdf->MultiCell(10, 4, $propale->lignes[$i]->qty, 0, 'R');
// Remise sur ligne // Remise sur ligne
$pdf->SetXY ($this->posxdiscount, $curY); $pdf->SetXY ($this->posxdiscount, $curY);
if ($propale->lignes[$i]->remise_percent) if ($propale->lignes[$i]->remise_percent)
{ {
$pdf->MultiCell(14, 4, $propale->lignes[$i]->remise_percent."%", 0, 'R'); $pdf->MultiCell(14, 4, $propale->lignes[$i]->remise_percent."%", 0, 'R');
} }
// Total HT ligne // Total HT ligne
$pdf->SetXY ($this->postotalht, $curY); $pdf->SetXY ($this->postotalht, $curY);
$total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty); $total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty);
$pdf->MultiCell(23, 4, $total, 0, 'R', 0); $pdf->MultiCell(23, 4, $total, 0, 'R', 0);
// Collecte des totaux par valeur de tva // Collecte des totaux par valeur de tva
// dans le tableau tva["taux"]=total_tva // dans le tableau tva["taux"]=total_tva
$tvaligne=$propale->lignes[$i]->price * $propale->lignes[$i]->qty; $tvaligne=$propale->lignes[$i]->price * $propale->lignes[$i]->qty;
if ($propale->remise_percent) $tvaligne-=($tvaligne*$propale->remise_percent)/100; if ($propale->remise_percent) $tvaligne-=($tvaligne*$propale->remise_percent)/100;
$this->tva[ (string)$propale->lignes[$i]->tva_tx ] += $tvaligne; $this->tva[ (string)$propale->lignes[$i]->tva_tx ] += $tvaligne;
$nexY+=2; // Passe espace entre les lignes $nexY+=2; // Passe espace entre les lignes
if ($nexY > 200 && $i < ($nblignes - 1)) if ($nexY > 200 && $i < ($nblignes - 1))
{ {
//$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY); //$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY);
@ -316,24 +322,24 @@ class pdf_propale_azur extends ModelePDFPropales
else else
$this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY); $this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY);
$this->_pagefoot($pdf); $this->_pagefoot($pdf);
// Nouvelle page // Nouvelle page
$pdf->AddPage(); $pdf->AddPage();
$pagenb++; $pagenb++;
$this->_pagehead($pdf, $propale, 0); $this->_pagehead($pdf, $propale, 0);
$nexY = $tab_top_newpage + 8; $nexY = $tab_top_newpage + 8;
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
// Affiche cadre tableau // Affiche cadre tableau
if ($pagenb == 1) if ($pagenb == 1)
{ {
//$this->_tableau($pdf, $tab_top, $tab_height, $nexY); //$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
//$bottomlasttab=$tab_top + $tab_height + 1; //$bottomlasttab=$tab_top + $tab_height + 1;
$this->_tableau($pdf, $tab_top, $nexY - $tab_top + 20, $nexY); $this->_tableau($pdf, $tab_top, $nexY - $tab_top + 20, $nexY);
$bottomlasttab=$tab_top + $nexY - $tab_top + 20 + 1; $bottomlasttab=$tab_top + $nexY - $tab_top + 20 + 1;
} }
@ -344,15 +350,15 @@ class pdf_propale_azur extends ModelePDFPropales
$this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY); $this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY);
$bottomlasttab=$tab_top_newpage + $nexY - $tab_top_newpage + 20 + 1; $bottomlasttab=$tab_top_newpage + $nexY - $tab_top_newpage + 20 + 1;
} }
$deja_regle = ""; $deja_regle = "";
$posy=$this->_tableau_tot($pdf, $propale, $deja_regle, $bottomlasttab); $posy=$this->_tableau_tot($pdf, $propale, $deja_regle, $bottomlasttab);
if ($deja_regle) { if ($deja_regle) {
$this->_tableau_versements($pdf, $fac, $posy); $this->_tableau_versements($pdf, $fac, $posy);
} }
/* /*
* Mode de règlement * Mode de règlement
*/ */
@ -366,7 +372,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
*/ */
/* /*
* Propose mode règlement par CHQ * Propose mode règlement par CHQ
*/ */
@ -377,7 +383,7 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_CHQ_NUMBER); $account->fetch(FACTURE_CHQ_NUMBER);
$pdf->SetXY ($this->marge_gauche, 227); $pdf->SetXY ($this->marge_gauche, 227);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, "Règlement par chèque à l'ordre de ".$account->proprio." envoyé à:",0,'L',0); $pdf->MultiCell(90, 3, "Règlement par chèque à l'ordre de ".$account->proprio." envoyé à:",0,'L',0);
@ -387,7 +393,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
} }
*/ */
/* /*
* Propose mode règlement par RIB * Propose mode règlement par RIB
*/ */
@ -398,9 +404,9 @@ class pdf_propale_azur extends ModelePDFPropales
{ {
$account = new Account($this->db); $account = new Account($this->db);
$account->fetch(FACTURE_RIB_NUMBER); $account->fetch(FACTURE_RIB_NUMBER);
$this->marges['g']=$this->marge_gauche; $this->marges['g']=$this->marge_gauche;
$cury=242; $cury=242;
$pdf->SetXY ($this->marges['g'], $cury); $pdf->SetXY ($this->marges['g'], $cury);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
@ -420,7 +426,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY ($this->marges['g']+60, $cury); $pdf->SetXY ($this->marges['g']+60, $cury);
$pdf->MultiCell(13, 3, "Clé RIB", 0, 'C', 0); $pdf->MultiCell(13, 3, "Clé RIB", 0, 'C', 0);
$pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY ($this->marges['g'], $cury+5); $pdf->SetXY ($this->marges['g'], $cury+5);
$pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0);
@ -430,18 +436,18 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0);
$pdf->SetXY ($this->marges['g']+60, $cury+5); $pdf->SetXY ($this->marges['g']+60, $cury+5);
$pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0);
$pdf->SetXY ($this->marges['g'], $cury+12); $pdf->SetXY ($this->marges['g'], $cury+12);
$pdf->MultiCell(90, 3, "Domiciliation : " . $account->domiciliation, 0, 'L', 0); $pdf->MultiCell(90, 3, "Domiciliation : " . $account->domiciliation, 0, 'L', 0);
$pdf->SetXY ($this->marges['g'], $cury+22); $pdf->SetXY ($this->marges['g'], $cury+22);
$pdf->MultiCell(90, 3, "Prefix IBAN : " . $account->iban_prefix, 0, 'L', 0); $pdf->MultiCell(90, 3, "Prefix IBAN : " . $account->iban_prefix, 0, 'L', 0);
$pdf->SetXY ($this->marges['g'], $cury+25); $pdf->SetXY ($this->marges['g'], $cury+25);
$pdf->MultiCell(90, 3, "BIC : " . $account->bic, 0, 'L', 0); $pdf->MultiCell(90, 3, "BIC : " . $account->bic, 0, 'L', 0);
} }
} }
*/ */
/* /*
* Conditions de règlements * Conditions de règlements
*/ */
@ -456,17 +462,17 @@ class pdf_propale_azur extends ModelePDFPropales
$lib_condition_paiement=$langs->trans("PaymentCondition".$propale->cond_reglement_code)?$langs->trans("PaymentCondition".$propale->cond_reglement_code):$propale->cond_reglement; $lib_condition_paiement=$langs->trans("PaymentCondition".$propale->cond_reglement_code)?$langs->trans("PaymentCondition".$propale->cond_reglement_code):$propale->cond_reglement;
$pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L');
} }
/* /*
* Pied de page * Pied de page
*/ */
$this->_pagefoot($pdf); $this->_pagefoot($pdf);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
return 1; // Pas d'erreur return 1; // Pas d'erreur
} }
else else
@ -550,12 +556,12 @@ class pdf_propale_azur extends ModelePDFPropales
if ($tvakey) // On affiche pas taux 0 if ($tvakey) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = ( (float)$tvakey < 0 ) ? " (".$langs->trans("NonPercuRecuperable").")" : '' ; $tvacompl = ( (float)$tvakey < 0 ) ? " (".$langs->trans("NonPercuRecuperable").")" : '' ;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval * abs((float)$tvakey) / 100 ), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval * abs((float)$tvakey) / 100 ), 0, 'R', 1);
} }
@ -565,13 +571,13 @@ class pdf_propale_azur extends ModelePDFPropales
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("TotalVAT"), 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($propale->total_tva), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($propale->total_tva), 0, 'R', 1);
} }
$useborder=0; $useborder=0;
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -586,7 +592,7 @@ class pdf_propale_azur extends ModelePDFPropales
if ($deja_regle > 0) if ($deja_regle > 0)
{ {
$index++; $index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'L', 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $langs->trans("AlreadyPayed"), 0, 'L', 0);
@ -604,7 +610,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
$index++; $index++;
return ($tab2_top + ($tab2_hl * $index)); return ($tab2_top + ($tab2_hl * $index));
} }
@ -618,7 +624,7 @@ class pdf_propale_azur extends ModelePDFPropales
global $langs,$conf; global $langs,$conf;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
// Montants exprimés en (en tab_top - 1) // Montants exprimés en (en tab_top - 1)
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
@ -679,12 +685,12 @@ class pdf_propale_azur extends ModelePDFPropales
$langs->load("bills"); $langs->load("bills");
$langs->load("propal"); $langs->load("propal");
$langs->load("companies"); $langs->load("companies");
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',13); $pdf->SetFont('Arial','B',13);
$posy=$this->marge_haute; $posy=$this->marge_haute;
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
// Logo // Logo
@ -713,7 +719,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $langs->trans("Proposal")." ".$propale->ref, '' , 'R'); $pdf->MultiCell(100, 4, $langs->trans("Proposal")." ".$propale->ref, '' , 'R');
$pdf->SetFont('Arial','',12); $pdf->SetFont('Arial','',12);
$posy+=6; $posy+=6;
$pdf->SetXY(100,$posy); $pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -733,21 +739,21 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY($this->marge_gauche,$posy-5); $pdf->SetXY($this->marge_gauche,$posy-5);
$pdf->MultiCell(66,5, $langs->trans("BillFrom").":"); $pdf->MultiCell(66,5, $langs->trans("BillFrom").":");
$pdf->SetXY($this->marge_gauche,$posy); $pdf->SetXY($this->marge_gauche,$posy);
$pdf->SetFillColor(230,230,230); $pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetXY($this->marge_gauche+2,$posy+3); $pdf->SetXY($this->marge_gauche+2,$posy+3);
// Nom emetteur // Nom emetteur
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',11); $pdf->SetFont('Arial','B',11);
if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L');
else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L'); else $pdf->MultiCell(80, 4, $mysoc->nom, 0, 'L');
// Caractéristiques emetteur // Caractéristiques emetteur
$carac_emetteur = ''; $carac_emetteur = '';
if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE;
@ -768,11 +774,11 @@ class pdf_propale_azur extends ModelePDFPropales
// Web // Web
if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW; if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".FAC_PDF_WWW;
elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".$mysoc->url; elseif ($mysoc->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$langs->trans("Web").": ".$mysoc->url;
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->SetXY($this->marge_gauche+2,$posy+8); $pdf->SetXY($this->marge_gauche+2,$posy+8);
$pdf->MultiCell(80,4, $carac_emetteur); $pdf->MultiCell(80,4, $carac_emetteur);
// Client destinataire // Client destinataire
$posy=42; $posy=42;
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@ -780,15 +786,15 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY(102,$posy-5); $pdf->SetXY(102,$posy-5);
$pdf->MultiCell(80,5, $langs->trans("BillTo").":"); $pdf->MultiCell(80,5, $langs->trans("BillTo").":");
$propale->fetch_client(); $propale->fetch_client();
// Cadre client destinataire // Cadre client destinataire
$pdf->rect(100, $posy, 100, $hautcadre); $pdf->rect(100, $posy, 100, $hautcadre);
// Nom client // Nom client
$pdf->SetXY(102,$posy+3); $pdf->SetXY(102,$posy+3);
$pdf->SetFont('Arial','B',11); $pdf->SetFont('Arial','B',11);
$pdf->MultiCell(106,4, $propale->client->nom, 0, 'L'); $pdf->MultiCell(106,4, $propale->client->nom, 0, 'L');
// Caractéristiques client // Caractéristiques client
$carac_client=$propale->client->adresse; $carac_client=$propale->client->adresse;
$carac_client.="\n".$propale->client->cp . " " . $propale->client->ville."\n"; $carac_client.="\n".$propale->client->cp . " " . $propale->client->ville."\n";
@ -810,9 +816,9 @@ class pdf_propale_azur extends ModelePDFPropales
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$html=new Form($this->db); $html=new Form($this->db);
// Premiere ligne d'info réglementaires // Premiere ligne d'info réglementaires
$ligne1=""; $ligne1="";
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE)
@ -856,7 +862,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetY(-$posy); $pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); $pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--; $posy--;
if ($ligne1) if ($ligne1)
{ {
$pdf->SetXY($this->marge_gauche,-$posy); $pdf->SetXY($this->marge_gauche,-$posy);
@ -869,7 +875,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY($this->marge_gauche,-$posy); $pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
} }
$pdf->SetXY(-20,-$posy); $pdf->SetXY(-20,-$posy);
$pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); $pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }

View File

@ -41,7 +41,7 @@ class pdf_propale_bleu extends ModelePDFPropales
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_propale_bleu($db=0) function pdf_propale_bleu($db=0)
{ {
$this->db = $db; $this->db = $db;
$this->name = "bleu"; $this->name = "bleu";
$this->description = "Modèle de propale sans remise."; $this->description = "Modèle de propale sans remise.";
@ -60,12 +60,12 @@ class pdf_propale_bleu extends ModelePDFPropales
\brief Renvoi dernière erreur \brief Renvoi dernière erreur
\return string Dernière erreur \return string Dernière erreur
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
\brief Fonction générant la propale sur le disque \brief Fonction générant la propale sur le disque
\param propale Objet propal \param propale Objet propal
@ -85,10 +85,10 @@ class pdf_propale_bleu extends ModelePDFPropales
\remarks MAIN_INFO_CAPITAL \remarks MAIN_INFO_CAPITAL
\remarks MAIN_INFO_TVAINTRA \remarks MAIN_INFO_TVAINTRA
*/ */
function write_pdf_file($propale) function write_pdf_file($propale,$outputlangs='')
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$mysoc;
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
// Définition de l'objet $propal (pour compatibilite ascendante) // Définition de l'objet $propal (pour compatibilite ascendante)
@ -98,7 +98,7 @@ class pdf_propale_bleu extends ModelePDFPropales
$propale = new Propal($this->db,"",$id); $propale = new Propal($this->db,"",$id);
$ret=$propale->fetch($id); $ret=$propale->fetch($id);
} }
// Définition de $dir et $file // Définition de $dir et $file
if ($propale->specimen) if ($propale->specimen)
{ {
@ -111,7 +111,7 @@ class pdf_propale_bleu extends ModelePDFPropales
$dir = $conf->propal->dir_output . "/" . $propref; $dir = $conf->propal->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }
if (! file_exists($dir)) if (! file_exists($dir))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -120,21 +120,21 @@ class pdf_propale_bleu extends ModelePDFPropales
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
$pdf=new FPDF('P','mm',$this->format); $pdf=new FPDF('P','mm',$this->format);
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject("Proposition commerciale"); $pdf->SetSubject("Proposition commerciale");
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale);
/* /*
*/ */
$tab_top = 100; $tab_top = 100;
@ -142,49 +142,49 @@ class pdf_propale_bleu extends ModelePDFPropales
/* /*
* *
*/ */
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($propale->lignes); $nblignes = sizeof($propale->lignes);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetXY (30, $curY ); $pdf->SetXY (30, $curY );
$pdf->MultiCell(100, 5, $propale->lignes[$i]->desc, 0, 'J', 0); $pdf->MultiCell(100, 5, $propale->lignes[$i]->desc, 0, 'J', 0);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (10, $curY ); $pdf->SetXY (10, $curY );
$pdf->MultiCell(20, 5, $propale->lignes[$i]->ref, 0, 'C'); $pdf->MultiCell(20, 5, $propale->lignes[$i]->ref, 0, 'C');
$pdf->SetXY (133, $curY ); $pdf->SetXY (133, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->tva_tx, 0, 'C'); $pdf->MultiCell(10, 5, $propale->lignes[$i]->tva_tx, 0, 'C');
$pdf->SetXY (145, $curY ); $pdf->SetXY (145, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C'); $pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C');
$pdf->SetXY (156, $curY ); $pdf->SetXY (156, $curY );
$pdf->MultiCell(18, 5, price($propale->lignes[$i]->price), 0, 'R', 0); $pdf->MultiCell(18, 5, price($propale->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (174, $curY ); $pdf->SetXY (174, $curY );
$total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty); $total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
$pdf->line(10, $curY, 200, $curY ); $pdf->line(10, $curY, 200, $curY );
if ($nexY > 240 && $i < $nblignes - 1) if ($nexY > 240 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -195,7 +195,7 @@ class pdf_propale_bleu extends ModelePDFPropales
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
/* /*
* *
@ -203,39 +203,39 @@ class pdf_propale_bleu extends ModelePDFPropales
$tab2_top = 254; $tab2_top = 254;
$tab2_lh = 7; $tab2_lh = 7;
$tab2_height = $tab2_lh * 3; $tab2_height = $tab2_lh * 3;
$pdf->SetFont('Arial','', 11); $pdf->SetFont('Arial','', 11);
$pdf->Rect(132, $tab2_top, 68, $tab2_height); $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*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*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(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->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_lh, "Total HT", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, "Total HT", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh); $pdf->SetXY (132, $tab2_top + $tab2_lh);
$pdf->MultiCell(42, $tab2_lh, "Total TVA", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, "Total TVA", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + ($tab2_lh*2)); $pdf->SetXY (132, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(42, $tab2_lh, "Total TTC", 1, 'R', 1); $pdf->MultiCell(42, $tab2_lh, "Total TTC", 1, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh); $pdf->SetXY (174, $tab2_top + $tab2_lh);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + ($tab2_lh*2)); $pdf->SetXY (174, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1);
/* /*
* *
*/ */
$pdf->Output($file); $pdf->Output($file);
return 1; return 1;
} }
@ -249,21 +249,21 @@ class pdf_propale_bleu extends ModelePDFPropales
$langs->load("bills"); $langs->load("bills");
$pdf->SetFont('Arial','',11); $pdf->SetFont('Arial','',11);
$pdf->Text(30,$tab_top + 5,$langs->trans("Designation")); $pdf->Text(30,$tab_top + 5,$langs->trans("Designation"));
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->trans("VAT")); $pdf->Text(134,$tab_top + 5,$langs->trans("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->trans("Qty")); $pdf->Text(147,$tab_top + 5,$langs->trans("Qty"));
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height); $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
$pdf->Text(160,$tab_top + 5,$langs->trans("PriceU")); $pdf->Text(160,$tab_top + 5,$langs->trans("PriceU"));
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height); $pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->trans("Total")); $pdf->Text(187,$tab_top + 5,$langs->trans("Total"));
// $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top); // $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top);
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
@ -285,7 +285,7 @@ class pdf_propale_bleu extends ModelePDFPropales
$pdf->SetFont('Times','B',14); $pdf->SetFont('Times','B',14);
$pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L'); $pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
{ {
@ -296,13 +296,13 @@ class pdf_propale_bleu extends ModelePDFPropales
{ {
$pdf->SetFont('Times','',10); $pdf->SetFont('Times','',10);
$pdf->MultiCell(76, 5, $langs->trans("Phone")." : ".FAC_PDF_TEL); $pdf->MultiCell(76, 5, $langs->trans("Phone")." : ".FAC_PDF_TEL);
} }
if (defined("MAIN_INFO_SIREN")) if (defined("MAIN_INFO_SIREN"))
{ {
$pdf->SetFont('Times','',10); $pdf->SetFont('Times','',10);
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
} }
if (defined("FAC_PDF_INTITULE2")) if (defined("FAC_PDF_INTITULE2"))
{ {
$pdf->SetXY(100,5); $pdf->SetXY(100,5);
@ -322,14 +322,14 @@ class pdf_propale_bleu extends ModelePDFPropales
$pdf->SetXY(102,47); $pdf->SetXY(102,47);
$pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville); $pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville);
$pdf->rect(100, 40, 100, 40); $pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Courier','B',12); $pdf->SetFont('Courier','B',12);
$pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $propale->date)); $pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $propale->date));
$pdf->Text(11, 94, "Proposition commerciale : ".$propale->ref); $pdf->Text(11, 94, "Proposition commerciale : ".$propale->ref);
} }
} }

View File

@ -41,7 +41,7 @@ class pdf_propale_jaune extends ModelePDFPropales
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_propale_jaune($db=0) function pdf_propale_jaune($db=0)
{ {
$this->db = $db; $this->db = $db;
$this->name = "jaune"; $this->name = "jaune";
$this->description = "Modèle de proposition Jaune"; $this->description = "Modèle de proposition Jaune";
@ -51,7 +51,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->error = ""; $this->error = "";
} }
@ -59,21 +59,21 @@ class pdf_propale_jaune extends ModelePDFPropales
/** \brief Renvoi dernière erreur /** \brief Renvoi dernière erreur
\return string Dernière erreur \return string Dernière erreur
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
\brief Fonction générant la propale sur le disque \brief Fonction générant la propale sur le disque
\param propale Objet propal \param propale Objet propal
\return int 1=ok, 0=ko \return int 1=ok, 0=ko
*/ */
function write_pdf_file($propale) function write_pdf_file($propale,$outputlangs='')
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$mysoc;
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
// Définition de l'objet $propal (pour compatibilite ascendante) // Définition de l'objet $propal (pour compatibilite ascendante)
@ -83,7 +83,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$propale = new Propal($this->db,"",$id); $propale = new Propal($this->db,"",$id);
$ret=$propale->fetch($id); $ret=$propale->fetch($id);
} }
// Définition de $dir et $file // Définition de $dir et $file
if ($propale->specimen) if ($propale->specimen)
{ {
@ -96,7 +96,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$dir = $conf->propal->dir_output . "/" . $propref; $dir = $conf->propal->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }
if (! file_exists($dir)) if (! file_exists($dir))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -105,22 +105,22 @@ class pdf_propale_jaune extends ModelePDFPropales
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
$pdf=new FPDF('P','mm',$this->format); $pdf=new FPDF('P','mm',$this->format);
$pdf->Open(); $pdf->Open();
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject("Proposition commerciale"); $pdf->SetSubject("Proposition commerciale");
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$pdf->AddPage(); $pdf->AddPage();
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale);
/* /*
*/ */
$tab_top = 100; $tab_top = 100;
@ -128,46 +128,46 @@ class pdf_propale_jaune extends ModelePDFPropales
/* /*
* *
*/ */
$pdf->SetFillColor(242,239,119); $pdf->SetFillColor(242,239,119);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($propale->lignes); $nblignes = sizeof($propale->lignes);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty); $total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty);
$pdf->SetXY (30, $curY ); $pdf->SetXY (30, $curY );
$pdf->MultiCell(102, 5, $propale->lignes[$i]->desc, 0, 'J', 0); $pdf->MultiCell(102, 5, $propale->lignes[$i]->desc, 0, 'J', 0);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (10, $curY ); $pdf->SetXY (10, $curY );
$pdf->MultiCell(20, 5, $propale->lignes[$i]->ref, 0, 'C', 0); $pdf->MultiCell(20, 5, $propale->lignes[$i]->ref, 0, 'C', 0);
$pdf->SetXY (132, $curY ); $pdf->SetXY (132, $curY );
$pdf->MultiCell(12, 5, $propale->lignes[$i]->tva_tx, 0, 'C', 0); $pdf->MultiCell(12, 5, $propale->lignes[$i]->tva_tx, 0, 'C', 0);
$pdf->SetXY (144, $curY ); $pdf->SetXY (144, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C', 0); $pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C', 0);
$pdf->SetXY (154, $curY ); $pdf->SetXY (154, $curY );
$pdf->MultiCell(22, 5, price($propale->lignes[$i]->price), 0, 'R', 0); $pdf->MultiCell(22, 5, price($propale->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (176, $curY ); $pdf->SetXY (176, $curY );
$pdf->MultiCell(24, 5, $total, 0, 'R', 0); $pdf->MultiCell(24, 5, $total, 0, 'R', 0);
$pdf->line(10, $curY, 200, $curY ); $pdf->line(10, $curY, 200, $curY );
if ($nexY > 240 && $i < $nblignes - 1) if ($nexY > 240 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -178,7 +178,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
/* /*
* *
@ -186,39 +186,39 @@ class pdf_propale_jaune extends ModelePDFPropales
$tab2_top = 254; $tab2_top = 254;
$tab2_lh = 7; $tab2_lh = 7;
$tab2_height = $tab2_lh * 3; $tab2_height = $tab2_lh * 3;
$pdf->SetFont('Arial','', 11); $pdf->SetFont('Arial','', 11);
$pdf->Rect(132, $tab2_top, 68, $tab2_height); $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*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*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(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->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_lh, "Total HT", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, "Total HT", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh); $pdf->SetXY (132, $tab2_top + $tab2_lh);
$pdf->MultiCell(42, $tab2_lh, "Total TVA", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, "Total TVA", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + ($tab2_lh*2)); $pdf->SetXY (132, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(42, $tab2_lh, "Total TTC", 1, 'R', 1); $pdf->MultiCell(42, $tab2_lh, "Total TTC", 1, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh); $pdf->SetXY (174, $tab2_top + $tab2_lh);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + ($tab2_lh*2)); $pdf->SetXY (174, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1);
/* /*
* *
*/ */
$pdf->Output($file); $pdf->Output($file);
return 1; return 1;
} }
@ -238,23 +238,23 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetXY(30,$tab_top); $pdf->SetXY(30,$tab_top);
$pdf->MultiCell(102,10,$langs->trans("Designation"),0,'L',1); $pdf->MultiCell(102,10,$langs->trans("Designation"),0,'L',1);
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->SetXY(132,$tab_top); $pdf->SetXY(132,$tab_top);
$pdf->MultiCell(12, 10,$langs->trans("VAT"),0,'C',1); $pdf->MultiCell(12, 10,$langs->trans("VAT"),0,'C',1);
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->SetXY(144,$tab_top); $pdf->SetXY(144,$tab_top);
$pdf->MultiCell(10,10,$langs->trans("Qty"),0,'C',1); $pdf->MultiCell(10,10,$langs->trans("Qty"),0,'C',1);
$pdf->line(154, $tab_top, 154, $tab_top + $tab_height); $pdf->line(154, $tab_top, 154, $tab_top + $tab_height);
$pdf->SetXY(154,$tab_top); $pdf->SetXY(154,$tab_top);
$pdf->MultiCell(22,10,$langs->trans("PriceU"),0,'R',1); $pdf->MultiCell(22,10,$langs->trans("PriceU"),0,'R',1);
$pdf->line(176, $tab_top, 176, $tab_top + $tab_height); $pdf->line(176, $tab_top, 176, $tab_top + $tab_height);
$pdf->SetXY(176,$tab_top); $pdf->SetXY(176,$tab_top);
$pdf->MultiCell(24,10,$langs->trans("Total"),0,'R',1); $pdf->MultiCell(24,10,$langs->trans("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->SetTextColor(0,0,0);
@ -272,7 +272,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L'); $pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
{ {
@ -285,14 +285,14 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetX(12); $pdf->SetX(12);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL); $pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL);
} }
if (defined("MAIN_INFO_SIREN")) if (defined("MAIN_INFO_SIREN"))
{ {
$pdf->SetX(12); $pdf->SetX(12);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
} }
$pdf->rect(10, 40, 80, 40); $pdf->rect(10, 40, 80, 40);
$pdf->SetXY(10,5); $pdf->SetXY(10,5);
$pdf->SetFont('Arial','B',16); $pdf->SetFont('Arial','B',16);
@ -311,7 +311,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetXY(102,47); $pdf->SetXY(102,47);
$pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville); $pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville);
$pdf->rect(100, 40, 100, 40); $pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);
@ -321,7 +321,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetXY(10,90); $pdf->SetXY(10,90);
$pdf->MultiCell(110, 10, "Numéro : ".$propale->ref); $pdf->MultiCell(110, 10, "Numéro : ".$propale->ref);
$pdf->SetXY(110,90); $pdf->SetXY(110,90);
$pdf->MultiCell(100, 10, "Date : " . strftime("%d %B %Y", $propale->date)); $pdf->MultiCell(100, 10, "Date : " . strftime("%d %B %Y", $propale->date));
} }
} }
?> ?>

View File

@ -21,7 +21,7 @@
* $Source$ * $Source$
*/ */
/** /**
\file htdocs/includes/modules/propale/pdf_propale_rouge.modules.php \file htdocs/includes/modules/propale/pdf_propale_rouge.modules.php
\ingroup propale \ingroup propale
\brief Fichier de la classe permettant de générer les propales au modèle Rouge \brief Fichier de la classe permettant de générer les propales au modèle Rouge
@ -44,7 +44,7 @@ class pdf_propale_rouge extends ModelePDFPropales
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_propale_rouge($db=0) function pdf_propale_rouge($db=0)
{ {
$this->db = $db; $this->db = $db;
$this->name = "rouge"; $this->name = "rouge";
$this->description = "Modèle de propale simple"; $this->description = "Modèle de propale simple";
@ -57,26 +57,26 @@ class pdf_propale_rouge extends ModelePDFPropales
$this->error = ""; $this->error = "";
} }
/** \brief Renvoi dernière erreur /** \brief Renvoi dernière erreur
\return string Dernière erreur \return string Dernière erreur
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
\brief Fonction générant la propale sur le disque \brief Fonction générant la propale sur le disque
\param propale Objet propal \param propale Objet propal
\return int 1=ok, 0=ko \return int 1=ok, 0=ko
*/ */
function write_pdf_file($propale) function write_pdf_file($propale,$outputlangs='')
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$mysoc;
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
// Définition de l'objet $propal (pour compatibilite ascendante) // Définition de l'objet $propal (pour compatibilite ascendante)
@ -114,58 +114,58 @@ class pdf_propale_rouge extends ModelePDFPropales
$pdf=new FPDF('P','mm',$this->format); $pdf=new FPDF('P','mm',$this->format);
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject($langs->trans("CommercialProposal")); $pdf->SetSubject($langs->trans("CommercialProposal"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale);
$tab_top = 100; $tab_top = 100;
$tab_height = 140; $tab_height = 140;
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($propale->lignes); $nblignes = sizeof($propale->lignes);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetXY (30, $curY ); $pdf->SetXY (30, $curY );
$pdf->MultiCell(100, 5, $propale->lignes[$i]->desc, 0, 'J', 0); $pdf->MultiCell(100, 5, $propale->lignes[$i]->desc, 0, 'J', 0);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (10, $curY ); $pdf->SetXY (10, $curY );
$pdf->MultiCell(20, 5, $propale->lignes[$i]->ref, 0, 'C'); $pdf->MultiCell(20, 5, $propale->lignes[$i]->ref, 0, 'C');
$pdf->SetXY (133, $curY ); $pdf->SetXY (133, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->tva_tx, 0, 'C'); $pdf->MultiCell(10, 5, $propale->lignes[$i]->tva_tx, 0, 'C');
$pdf->SetXY (145, $curY ); $pdf->SetXY (145, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C'); $pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C');
$pdf->SetXY (156, $curY ); $pdf->SetXY (156, $curY );
$pdf->MultiCell(18, 5, price($propale->lignes[$i]->price), 0, 'R', 0); $pdf->MultiCell(18, 5, price($propale->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (174, $curY ); $pdf->SetXY (174, $curY );
$total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty); $total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0); $pdf->MultiCell(26, 5, $total, 0, 'R', 0);
$pdf->line(10, $curY, 200, $curY ); $pdf->line(10, $curY, 200, $curY );
if ($nexY > 240 && $i < $nblignes - 1) if ($nexY > 240 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -176,7 +176,7 @@ class pdf_propale_rouge extends ModelePDFPropales
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
/* /*
* *
@ -184,55 +184,55 @@ class pdf_propale_rouge extends ModelePDFPropales
$tab2_top = 241; $tab2_top = 241;
$tab2_lh = 7; $tab2_lh = 7;
$tab2_height = $tab2_lh * 4; $tab2_height = $tab2_lh * 4;
$pdf->SetFont('Arial','', 11); $pdf->SetFont('Arial','', 11);
$pdf->Rect(132, $tab2_top, 68, $tab2_height); $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*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*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(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->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalHT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh); $pdf->SetXY (132, $tab2_top + $tab2_lh);
$pdf->MultiCell(42, $tab2_lh, $langs->trans("Discount"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->trans("Discount"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh*2); $pdf->SetXY (132, $tab2_top + $tab2_lh*2);
$pdf->MultiCell(42, $tab2_lh, "Total HT après remise", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, "Total HT après remise", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh*3); $pdf->SetXY (132, $tab2_top + $tab2_lh*3);
$pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalVAT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalVAT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + ($tab2_lh*4)); $pdf->SetXY (132, $tab2_top + ($tab2_lh*4));
$pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalTTC"), 1, 'R', 1); $pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalTTC"), 1, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht + $propale->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht + $propale->remise), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh); $pdf->SetXY (174, $tab2_top + $tab2_lh);
$pdf->MultiCell(26, $tab2_lh, price($propale->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->remise), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh*2); $pdf->SetXY (174, $tab2_top + $tab2_lh*2);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh*3); $pdf->SetXY (174, $tab2_top + $tab2_lh*3);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + ($tab2_lh*4)); $pdf->SetXY (174, $tab2_top + ($tab2_lh*4));
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1);
if (defined("PROP_PDF_MESSAGE") && PROP_PDF_MESSAGE) if (defined("PROP_PDF_MESSAGE") && PROP_PDF_MESSAGE)
{ {
$pdf->SetXY (10, $tab2_top + 2); $pdf->SetXY (10, $tab2_top + 2);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(120, 5, PROP_PDF_MESSAGE); $pdf->MultiCell(120, 5, PROP_PDF_MESSAGE);
} }
$pdf->Output($file); $pdf->Output($file);
return 1; return 1;
} }
@ -242,8 +242,8 @@ class pdf_propale_rouge extends ModelePDFPropales
$this->error=$langs->trans("ErrorConstantNotDefined","PROPALE_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","PROPALE_OUTPUTDIR");
return 0; return 0;
} }
} }
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
@ -253,21 +253,21 @@ class pdf_propale_rouge extends ModelePDFPropales
$langs->load("bills"); $langs->load("bills");
$pdf->SetFont('Arial','',11); $pdf->SetFont('Arial','',11);
$pdf->Text(30,$tab_top + 5,$langs->trans("Designation")); $pdf->Text(30,$tab_top + 5,$langs->trans("Designation"));
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->Text(134,$tab_top + 5,$langs->trans("VAT")); $pdf->Text(134,$tab_top + 5,$langs->trans("VAT"));
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->Text(147,$tab_top + 5,$langs->trans("Qty")); $pdf->Text(147,$tab_top + 5,$langs->trans("Qty"));
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height); $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
$pdf->Text(160,$tab_top + 5,$langs->trans("PriceU")); $pdf->Text(160,$tab_top + 5,$langs->trans("PriceU"));
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height); $pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
$pdf->Text(187,$tab_top + 5,$langs->trans("Total")); $pdf->Text(187,$tab_top + 5,$langs->trans("Total"));
// $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top); // $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top);
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
@ -288,7 +288,7 @@ class pdf_propale_rouge extends ModelePDFPropales
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L'); $pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
{ {
@ -299,13 +299,13 @@ class pdf_propale_rouge extends ModelePDFPropales
{ {
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL); $pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL);
} }
if (defined("MAIN_INFO_SIREN")) if (defined("MAIN_INFO_SIREN"))
{ {
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
} }
if (defined("FAC_PDF_INTITULE2")) if (defined("FAC_PDF_INTITULE2"))
{ {
$pdf->SetXY(100,5); $pdf->SetXY(100,5);
@ -325,14 +325,14 @@ class pdf_propale_rouge extends ModelePDFPropales
$pdf->SetXY(102,47); $pdf->SetXY(102,47);
$pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville); $pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville);
$pdf->rect(100, 40, 100, 40); $pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);
$pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $propale->date)); $pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $propale->date));
$pdf->Text(11, 94, "Proposition commerciale : ".$propale->ref); $pdf->Text(11, 94, "Proposition commerciale : ".$propale->ref);
} }
} }

View File

@ -42,7 +42,7 @@ class pdf_propale_vert extends ModelePDFPropales
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_propale_vert($db=0) function pdf_propale_vert($db=0)
{ {
$this->db = $db; $this->db = $db;
$this->name = "vert"; $this->name = "vert";
$this->description = "Affichage de la remise par produit"; $this->description = "Affichage de la remise par produit";
@ -52,7 +52,7 @@ class pdf_propale_vert extends ModelePDFPropales
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->error = ""; $this->error = "";
} }
@ -60,21 +60,21 @@ class pdf_propale_vert extends ModelePDFPropales
/** \brief Renvoi dernière erreur /** \brief Renvoi dernière erreur
\return string Dernière erreur \return string Dernière erreur
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
\brief Fonction générant la propale sur le disque \brief Fonction générant la propale sur le disque
\param propale Objet propal \param propale Objet propal
\return int 1=ok, 0=ko \return int 1=ok, 0=ko
*/ */
function write_pdf_file($propale) function write_pdf_file($propale,$outputlangs='')
{ {
global $user,$conf,$langs; global $user,$conf,$langs,$mysoc;
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
// Définition de l'objet $propal (pour compatibilite ascendante) // Définition de l'objet $propal (pour compatibilite ascendante)
@ -84,7 +84,7 @@ class pdf_propale_vert extends ModelePDFPropales
$propale = new Propal($this->db,"",$id); $propale = new Propal($this->db,"",$id);
$ret=$propale->fetch($id); $ret=$propale->fetch($id);
} }
// Définition de $dir et $file // Définition de $dir et $file
if ($propale->specimen) if ($propale->specimen)
{ {
@ -97,7 +97,7 @@ class pdf_propale_vert extends ModelePDFPropales
$dir = $conf->propal->dir_output . "/" . $propref; $dir = $conf->propal->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }
if (! file_exists($dir)) if (! file_exists($dir))
{ {
if (create_exdir($dir) < 0) if (create_exdir($dir) < 0)
@ -106,21 +106,21 @@ class pdf_propale_vert extends ModelePDFPropales
return 0; return 0;
} }
} }
if (file_exists($dir)) if (file_exists($dir))
{ {
$pdf=new FPDF('P','mm',$this->format); $pdf=new FPDF('P','mm',$this->format);
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject("Proposition commerciale"); $pdf->SetSubject("Proposition commerciale");
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale);
/* /*
*/ */
$tab_top = 100; $tab_top = 100;
@ -128,53 +128,53 @@ class pdf_propale_vert extends ModelePDFPropales
/* /*
* *
*/ */
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
$pdf->SetXY (10, $tab_top + 10 ); $pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$nblignes = sizeof($propale->lignes); $nblignes = sizeof($propale->lignes);
for ($i = 0 ; $i < $nblignes ; $i++) for ($i = 0 ; $i < $nblignes ; $i++)
{ {
$curY = $nexY; $curY = $nexY;
$pdf->SetXY (40, $curY ); $pdf->SetXY (40, $curY );
$pdf->MultiCell(90, 5, $propale->lignes[$i]->desc, 0, 'J', 0); $pdf->MultiCell(90, 5, $propale->lignes[$i]->desc, 0, 'J', 0);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$pdf->SetXY (10, $curY ); $pdf->SetXY (10, $curY );
$pdf->SetFont('Arial','', 8); $pdf->SetFont('Arial','', 8);
$pdf->MultiCell(30, 5, $propale->lignes[$i]->ref, 0, 'L', 0); $pdf->MultiCell(30, 5, $propale->lignes[$i]->ref, 0, 'L', 0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
$pdf->SetXY (132, $curY ); $pdf->SetXY (132, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->tva_tx, 0, 'C', 0); $pdf->MultiCell(10, 5, $propale->lignes[$i]->tva_tx, 0, 'C', 0);
$pdf->SetXY (142, $curY ); $pdf->SetXY (142, $curY );
$pdf->MultiCell(8, 5, $propale->lignes[$i]->qty, 0, 'C'); $pdf->MultiCell(8, 5, $propale->lignes[$i]->qty, 0, 'C');
$pdf->SetXY (150, $curY ); $pdf->SetXY (150, $curY );
$pdf->MultiCell(16, 5, price($propale->lignes[$i]->subprice), 0, 'R', 0); $pdf->MultiCell(16, 5, price($propale->lignes[$i]->subprice), 0, 'R', 0);
$pdf->SetXY (166, $curY ); $pdf->SetXY (166, $curY );
$pdf->MultiCell(14, 5, $propale->lignes[$i]->remise_percent."%", 0, 'R', 0); $pdf->MultiCell(14, 5, $propale->lignes[$i]->remise_percent."%", 0, 'R', 0);
$pdf->SetXY (180, $curY ); $pdf->SetXY (180, $curY );
$total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty); $total = price($propale->lignes[$i]->price * $propale->lignes[$i]->qty);
$pdf->MultiCell(20, 5, $total, 0, 'R', 0); $pdf->MultiCell(20, 5, $total, 0, 'R', 0);
$pdf->line(10, $curY, 200, $curY ); $pdf->line(10, $curY, 200, $curY );
if ($nexY > 240 && $i < $nblignes - 1) if ($nexY > 240 && $i < $nblignes - 1)
{ {
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
@ -185,7 +185,7 @@ class pdf_propale_vert extends ModelePDFPropales
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
/* /*
* *
@ -193,51 +193,51 @@ class pdf_propale_vert extends ModelePDFPropales
$tab2_top = 241; $tab2_top = 241;
$tab2_lh = 7; $tab2_lh = 7;
$tab2_height = $tab2_lh * 4; $tab2_height = $tab2_lh * 4;
$pdf->SetFont('Arial','', 11); $pdf->SetFont('Arial','', 11);
$pdf->Rect(132, $tab2_top, 68, $tab2_height); $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*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*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(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->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalHT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh); $pdf->SetXY (132, $tab2_top + $tab2_lh);
$pdf->MultiCell(42, $tab2_lh, $langs->trans("GlobalDiscount"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->trans("GlobalDiscount"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh*2); $pdf->SetXY (132, $tab2_top + $tab2_lh*2);
$pdf->MultiCell(42, $tab2_lh, "Total HT après remise", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, "Total HT après remise", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh*3); $pdf->SetXY (132, $tab2_top + $tab2_lh*3);
$pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalVAT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalVAT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + ($tab2_lh*4)); $pdf->SetXY (132, $tab2_top + ($tab2_lh*4));
$pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalTTC"), 1, 'R', 1); $pdf->MultiCell(42, $tab2_lh, $langs->trans("TotalTTC"), 1, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht + $propale->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht + $propale->remise), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh); $pdf->SetXY (174, $tab2_top + $tab2_lh);
$pdf->MultiCell(26, $tab2_lh, price($propale->remise), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->remise), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh*2); $pdf->SetXY (174, $tab2_top + $tab2_lh*2);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + $tab2_lh*3); $pdf->SetXY (174, $tab2_top + $tab2_lh*3);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_tva), 0, 'R', 0);
$pdf->SetXY (174, $tab2_top + ($tab2_lh*4)); $pdf->SetXY (174, $tab2_top + ($tab2_lh*4));
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1);
/* /*
* *
*/ */
$pdf->Output($file); $pdf->Output($file);
return 1; return 1;
} }
@ -249,10 +249,10 @@ class pdf_propale_vert extends ModelePDFPropales
global $langs,$conf; global $langs,$conf;
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$yt = 100; $yt = 100;
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->SetXY(10, $yt); $pdf->SetXY(10, $yt);
$pdf->MultiCell(30,5,$langs->trans("Ref"),0,'L'); $pdf->MultiCell(30,5,$langs->trans("Ref"),0,'L');
@ -262,15 +262,15 @@ class pdf_propale_vert extends ModelePDFPropales
$pdf->SetXY(132, $yt); $pdf->SetXY(132, $yt);
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->MultiCell(10,5,$langs->trans("VAT"),0,'C'); $pdf->MultiCell(10,5,$langs->trans("VAT"),0,'C');
$pdf->line(142, $tab_top, 142, $tab_top + $tab_height); $pdf->line(142, $tab_top, 142, $tab_top + $tab_height);
$pdf->SetXY(142, $yt); $pdf->SetXY(142, $yt);
$pdf->MultiCell(8,5,$langs->trans("Qty"),0,'C'); $pdf->MultiCell(8,5,$langs->trans("Qty"),0,'C');
$pdf->line(150, $tab_top, 150, $tab_top + $tab_height); $pdf->line(150, $tab_top, 150, $tab_top + $tab_height);
$pdf->SetXY(150, $yt); $pdf->SetXY(150, $yt);
$pdf->MultiCell(16,5,$langs->trans("PriceU"),0,'C'); $pdf->MultiCell(16,5,$langs->trans("PriceU"),0,'C');
$pdf->line(166, $tab_top, 166, $tab_top + $tab_height); $pdf->line(166, $tab_top, 166, $tab_top + $tab_height);
$pdf->SetXY(166, $yt); $pdf->SetXY(166, $yt);
$pdf->MultiCell(14,5,$langs->trans("ReductionShort"),0,'C'); $pdf->MultiCell(14,5,$langs->trans("ReductionShort"),0,'C');
@ -278,7 +278,7 @@ class pdf_propale_vert extends ModelePDFPropales
$pdf->line(180, $tab_top, 180, $tab_top + $tab_height); $pdf->line(180, $tab_top, 180, $tab_top + $tab_height);
$pdf->SetXY(180, $yt); $pdf->SetXY(180, $yt);
$pdf->MultiCell(20,5,$langs->trans("Total"),0,'R'); $pdf->MultiCell(20,5,$langs->trans("Total"),0,'R');
// $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top); // $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top);
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
@ -303,7 +303,7 @@ class pdf_propale_vert extends ModelePDFPropales
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L'); $pdf->MultiCell(76, 8, FAC_PDF_INTITULE, 0, 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
if (defined("FAC_PDF_ADRESSE")) if (defined("FAC_PDF_ADRESSE"))
{ {
@ -314,13 +314,13 @@ class pdf_propale_vert extends ModelePDFPropales
{ {
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL); $pdf->MultiCell(76, 5, "Tél : ".FAC_PDF_TEL);
} }
if (defined("MAIN_INFO_SIREN")) if (defined("MAIN_INFO_SIREN"))
{ {
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
} }
if (defined("FAC_PDF_INTITULE2")) if (defined("FAC_PDF_INTITULE2"))
{ {
$pdf->SetXY(100,5); $pdf->SetXY(100,5);
@ -340,14 +340,14 @@ class pdf_propale_vert extends ModelePDFPropales
$pdf->SetXY(102,47); $pdf->SetXY(102,47);
$pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville); $pdf->MultiCell(96,5, $propale->client->adresse . "\n" . $propale->client->cp . " " . $propale->client->ville);
$pdf->rect(100, 40, 100, 40); $pdf->rect(100, 40, 100, 40);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);
$pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $propale->date)); $pdf->Text(11, 88, "Date : " . strftime("%d %b %Y", $propale->date));
$pdf->Text(11, 94, "Proposition commerciale : ".$propale->ref); $pdf->Text(11, 94, "Proposition commerciale : ".$propale->ref);
} }
} }

File diff suppressed because it is too large Load Diff