diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index d4897ff72d9..3ea883f802b 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -838,23 +838,6 @@ class Commande extends CommonObject } } - if ($this->user_author_id) - { - $sql = "SELECT name, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE rowid = ".$this->user_author_id; - - $resqluser = $this->db->query($sql); - - if ($resqluser) - { - $obju = $this->db->fetch_object($resqluser); - $this->user_author_name = $obju->name; - $this->user_author_firstname = $obju->firstname; - } - } - - $this->lignes = $this->fetch_lignes(); /* diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 308a69de2de..2a4c96ae76f 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -949,7 +949,7 @@ else $author->fetch(); $head = commande_prepare_head($commande); - dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder")); + dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder")); /* * Confirmation de la suppression de la commande diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 927569739d9..8c43ba831f8 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -81,6 +81,7 @@ if ($_GET["id"] > 0) { $soc = new Societe($db); $soc->fetch($commande->socidp); + $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ce1fa1e4996..ac3a46d6e8c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -224,6 +224,28 @@ if ($_POST['action'] == 'confirm_payed' && $_POST['confirm'] == 'yes' && $user-> $fac->fetch($_GET['facid']); $result = $fac->set_payed($user); } +if ($_POST['action'] == 'confirm_payed_partially' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement) +{ + $fac = new Facture($db); + $fac->fetch($_GET['facid']); + $close_code=$_POST["close_code"]; + $close_note=$_POST["close_note"]; + if ($close_code) + { + if ($close_code == 'other' && ! $close_note) + { + $msg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Comment")).'
'; + } + else + { + $result = $fac->set_payed($user,$close_code,$close_note); + } + } + else + { + $msg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
'; + } +} /* * Insertion facture @@ -284,7 +306,7 @@ if ($_POST['action'] == 'add') else { $_GET["action"]='create'; - $mesg='
'.$facture->error.'
'; + $msg='
'.$facture->error.'
'; } } else @@ -582,7 +604,7 @@ if ($_POST['action'] == 'confirm_canceled' && $_POST['confirm'] == 'yes') if ($user->rights->facture->supprimer) { $fac = new Facture($db); - $fac->fetch($_GET['facid']); + $fac->fetch($_GET['facid']); $result = $fac->set_canceled($user); } } @@ -838,7 +860,7 @@ if ($_GET['action'] == 'create') { print_titre($langs->trans('NewBill')); - if ($mesg) print $mesg; + if ($msg) print $msg; $soc = new Societe($db); @@ -1416,6 +1438,10 @@ else $soc = new Societe($db, $fac->socidp); $soc->fetch($fac->socidp); $absolute_discount=$soc->getCurrentDiscount(); + + $totalpaye = $fac->getSommePaiement(); + $resteapayer = $fac->total_ttc - $totalpaye; + if ($fac->paye) $resteapayer=0; $author = new User($db); if ($fac->user_author) @@ -1470,14 +1496,26 @@ else /* * Confirmation du classement payé */ - if ($_GET['action'] == 'payed') + if ($_GET['action'] == 'payed' && $resteapayer <= 0) { $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed'); print '
'; } + if ($_GET['action'] == 'payed' && $resteapayer > 0) + { + // Crée un tableau formulaire + $formquestion=array( + 'text' => $langs->trans("ConfirmClassifyPayedPartiallyQuestion"), + array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => array('escompte' => $langs->trans("ConfirmClassifyPayedPartiallyReasonEscompte",$resteapayer,$langs->trans("Currency".$conf->monnaie)), 'other' => $langs->trans("ConfirmClassifyPayedPartiallyReasonOther"))), + array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '70') + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedPartially',$fac->ref),'confirm_payed_partially',$formquestion); + print '
'; + } /* - * Confirmation du classement abandonn + * Confirmation du classement abandonne */ if ($_GET['action'] == 'canceled') { @@ -1563,8 +1601,6 @@ else /* * Liste des paiements */ - $totalpaye = 0; - $sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,'; $sql.= ' c.libelle as paiement_type, p.num_paiement, p.rowid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf'; @@ -1588,19 +1624,19 @@ else $var=!$var; print ''; print ''.img_object($langs->trans('ShowPayment'),'payment').' '; - print dolibarr_print_date($objp->dp).''; + print dolibarr_print_date($objp->dp).''; print ''.$objp->paiement_type.' '.$objp->num_paiement.''; print ''.price($objp->amount).''.$langs->trans('Currency'.$conf->monnaie).''; print ''; - $totalpaye += $objp->amount; $i++; } print ''.$langs->trans('AlreadyPayed').' :'.price($totalpaye).''.$langs->trans('Currency'.$conf->monnaie).''; print ''.$langs->trans("Billed").' :'.price($fac->total_ttc).''.$langs->trans('Currency'.$conf->monnaie).''; - - $resteapayer = $fac->total_ttc - $totalpaye; - + if ($fac->close_code == 'escompte') + { + print ''.$langs->trans("EscompteOffered").' :'.price($fac->total_ttc - $totalpaye).''.$langs->trans('Currency'.$conf->monnaie).''; + } print ''.$langs->trans('RemainderToPay').' :'; print ''.price($resteapayer).''.$langs->trans('Currency'.$conf->monnaie).''; @@ -2248,7 +2284,7 @@ else } // Envoyer une relance - if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer) + if ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->envoyer) { print ' '.$langs->trans('SendRemindByMail').''; } @@ -2261,18 +2297,18 @@ else // Classer 'payé' if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement - && price($resteapayer) <= 0) + && $resteapayer <= 0) { print ' '.$langs->trans('ClassifyPayed').''; } - // Classer 'fermée' (possible si validée et pas encore classer payée) - if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement - && price($resteapayer) > 0) + // Classer 'fermée' (possible si validée et pas encore classée payée) + if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0 + && $user->rights->facture->paiement) { if ($totalpaye > 0) { - print ' '.$langs->trans('ClassifyPayedPartially').''; + print ' '.$langs->trans('ClassifyPayedPartially').''; } else { diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index 70ab5763426..e0f0a9a596b 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -147,6 +147,7 @@ class Conf // Module externalrss $this->externalrss->enabled=defined("MAIN_MODULE_EXTERNALRSS")?MAIN_MODULE_EXTERNALRSS:0; + $this->externalrss->dir_temp=DOL_DATA_ROOT."/rss/temp"; // Module commande client $this->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0; diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 17dcb340eb2..59129802572 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -89,6 +89,7 @@ if ($_GET["id"] > 0) $soc = new Societe($db); $soc->fetch($commande->socidp); + $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 82c54d4d001..cc988453fae 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -191,6 +191,7 @@ if ($_GET["action"] == 'create') { $soc = new Societe($db); $soc->fetch($commande->socidp); + $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 161dc850e72..e5f39cc24a5 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -63,6 +63,8 @@ class Facture extends CommonObject var $note_public; var $statut; var $paye; // 1 si facture payée COMPLETEMENT, 0 sinon + var $close_code; // Si mis a paye sans paiement complet, code qui justifie + var $close_note; // Commentaire si mis a paye sans paiement complet var $propalid; var $projetid; var $date_lim_reglement; @@ -312,7 +314,7 @@ class Facture extends CommonObject $sql = 'SELECT f.fk_soc,f.facnumber,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; $sql .= ','.$this->db->pdate('f.datef').' as df, f.fk_projet'; $sql .= ','.$this->db->pdate('f.date_lim_reglement').' as dlr'; - $sql .= ', f.note, f.note_public, f.paye, f.fk_statut, f.fk_user_author, f.model_pdf'; + $sql .= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.model_pdf'; $sql .= ', f.fk_mode_reglement, f.ref_client, p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= ', f.fk_cond_reglement, c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_facture'; $sql .= ', cf.fk_commande'; @@ -346,6 +348,8 @@ class Facture extends CommonObject $this->total_tva = $obj->tva; $this->total_ttc = $obj->total_ttc; $this->paye = $obj->paye; + $this->close_code = $obj->close_code; + $this->close_note = $obj->close_note; $this->socidp = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->date_lim_reglement = $obj->dlr; @@ -365,36 +369,20 @@ class Facture extends CommonObject $this->lignes = array(); - if ($this->user_author) - { - $sql = "SELECT name, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE rowid = ".$this->user_author; - - $resqluser = $this->db->query($sql); - - if ($resqluser) - { - $obju = $this->db->fetch_object($resqluser); - $this->user_author_name = $obju->name; - $this->user_author_firstname = $obju->firstname; - } - } - - if ($this->commande_id) - { - $sql = "SELECT ref"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande"; - $sql.= " WHERE rowid = ".$this->commande_id; - - $resqlcomm = $this->db->query($sql); - - if ($resqlcomm) - { - $objc = $this->db->fetch_object($resqlcomm); - $this->commande_ref = $objc->ref; - } - } + if ($this->commande_id) + { + $sql = "SELECT ref"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande"; + $sql.= " WHERE rowid = ".$this->commande_id; + + $resqlcomm = $this->db->query($sql); + + if ($resqlcomm) + { + $objc = $this->db->fetch_object($resqlcomm); + $this->commande_ref = $objc->ref; + } + } if ($this->statut == 0) { @@ -725,17 +713,23 @@ class Facture extends CommonObject /** * \brief Tag la facture comme payée complètement + appel trigger BILL_PAYED * \param user Objet utilisateur qui modifie + * \param close_code Code renseigné si on classe à payée alors que paiement incomplet + * Les valeurs possibles sont: escompte, other + * \param close_note Commentaire renseigné si on classe à payée alors que paiement incomplet * \return int <0 si ok, >0 si ok */ - function set_payed($user) + function set_payed($user,$close_code='',$close_note='') { global $conf,$langs; dolibarr_syslog("Facture.class.php::set_payed rowid=".$this->id); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; - $sql.= ' SET paye=1 WHERE rowid = '.$this->id ; - $resql = $this->db->query($sql); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET'; + $sql.= ' paye=1'; + if ($close_code) $sql.= ", close_code='".addslashes($close_code)."'"; + if ($close_note) $sql.= ", close_note='".addslashes($close_note)."'"; + $sql.= ' WHERE rowid = '.$this->id; + $resql = $this->db->query($sql); if ($resql) { $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0); @@ -1488,16 +1482,19 @@ class Facture extends CommonObject } /** - * \brief Renvoie la sommes des paiements deja effectués - * \remarks Utilisé entre autre par certains modèles de factures + * \brief Renvoie la sommes des paiements deja effectués + * \return Montant deja versé, <0 si ko */ function getSommePaiement() { - $sql = 'SELECT sum(amount) FROM '.MAIN_DB_PREFIX.'paiement_facture WHERE fk_facture = '.$this->id; - if ($this->db->query($sql)) + $sql = 'SELECT sum(amount) as amount'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture'; + $sql.= ' WHERE fk_facture = '.$this->id; + $resql=$this->db->query($sql); + if ($resql) { - $row = $this->db->fetch_row(0); - return $row[0]; + $obj = $this->db->fetch_object($resql); + return $obj->amount; } else { diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index 4af044ba37f..cbaf50f8ee0 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -53,15 +53,15 @@ if ($_GET["id"] > 0) { $soc->fetch($commande->socidp); + $author = new User($db); + $author->id = $commande->user_author_id; + $author->fetch(); + $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; $addons[0][1] = $soc->nom; llxHeader('',$langs->trans("History"),"CommandeFournisseur",$addons); - $author = new User($db); - $author->id = $commande->user_author_id; - $author->fetch(); - $h = 0; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; $head[$h][1] = $langs->trans("OrderCard"); diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 117901ad348..0c31471006d 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -74,6 +74,7 @@ if ($_GET["id"] > 0) { $soc = new Societe($db); $soc->fetch($commande->socidp); + $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 33274339b59..e386eebd52c 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -483,7 +483,7 @@ class CommandeFournisseur extends Commande { require_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); - $cc = new user($this->db, $this->user_author_id); + $cc = new User($this->db, $this->user_author_id); $cc->fetch(); $sendto = $cc->email; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 6cd70cc2e69..c38ce1b829f 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1487,28 +1487,60 @@ class Form /** * \brief Affiche formulaire de demande de confirmation - * \param page page - * \param title title - * \param question question - * \param action action + * \param page page + * \param title title + * \param question question + * \param action action + * \param formquestion an array with forms compementary inputs */ - function form_confirm($page, $title, $question, $action) + function form_confirm($page, $title, $question, $action, $formquestion='') { global $langs; - print '
'; + print ''; print ''; - print ''; + + print '
'; + // Ligne titre - print ''; + print ''; + + // Ligne formulaire + if ($formquestion) + { + print ''; + } + // Ligne message - print ''; + print '\n"; + print ''; print ''; print '
'.$title.'
'.img_picto('','recent').' '.$title.'
'; + print ''; + print ''; + foreach ($formquestion as $key => $input) + { + if ($input['type'] == 'text') print ''; + if ($input['type'] == 'radio') + { + $i=0; + foreach($input['values'] as $selkey => $selval) + { + print ''; + if ($i==0) print ''; + else print ''; + print ''; + $i++; + } + } + } + print '
'.$formquestion['text'].'
'.$input['label'].'
'.$input['label'].'  '.$selval.'
'; + print '
'.$question.''; + print '
'.$question.''; $this->selectyesno("confirm","no"); - print "
'; + print "
\n"; } diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 8c3d95905b8..34dcc6fc1c3 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -83,13 +83,11 @@ class DolibarrModules // Créé les répertoires if (is_array($this->dirs)) { - foreach ($this->dirs as $key => $value) + foreach ($this->dirs as $key => $dir) { - $dir = $value; if ($dir && ! file_exists($dir)) { - umask(0); - if (! @mkdir($dir, 0755)) + if (create_exdir($dir) < 0) { $this->error = $langs->trans("ErrorCanNotCreateDir",$dir); dolibarr_syslog("DolibarrModules::_init error"); @@ -106,7 +104,7 @@ class DolibarrModules $result=$this->db->query($sql); if (! $result) { - dolibarr_syslog("Error sql=".$sql." - ".$this->db->error()); + dolibarr_syslog("DolibarrModules.class::init Error sql=".$sql." - ".$this->db->error()); $err++; } } diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 3062eceaa0f..ace8d73734c 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -42,7 +42,7 @@ class pdf_einstein extends ModelePDFCommandes { var $emetteur; // Objet societe qui emet - + /** \brief Constructeur \param db Handler accès base de donnée @@ -51,6 +51,8 @@ class pdf_einstein extends ModelePDFCommandes { global $conf,$langs,$mysoc; + $langs->load("main"); + $langs->load("bills"); $this->db = $db; $this->name = "einstein"; $this->description = "Modèle de commandes complet (logo...)"; @@ -64,14 +66,15 @@ class pdf_einstein extends ModelePDFCommandes $this->marge_droite=10; $this->marge_haute=10; $this->marge_basse=10; - - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO + + $this->option_logo = 1; // Affiche logo $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER + $this->option_modereg = 1; // Affiche mode règlement + $this->option_condreg = 1; // Affiche conditions règlement $this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_multilang = 1; // Dispo en plusieurs langues - if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') + if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') $this->franchise=1; // Recupere emmetteur @@ -85,7 +88,7 @@ class pdf_einstein extends ModelePDFCommandes $this->posxqty=151; $this->posxdiscount=162; $this->postotalht=177; - + $this->tva=array(); $this->atleastoneratenotnull=0; $this->atleastonediscount=0; @@ -95,14 +98,14 @@ class pdf_einstein extends ModelePDFCommandes \brief Renvoi dernière erreur \return string Dernière erreur */ - function pdferror() + function pdferror() { return $this->error; } /** \brief Fonction générant la commande sur le disque - \param id Id de la commande à générer + \param com Objet commande à générer \return int 1=ok, 0=ko */ function write_pdf_file($com,$outputlangs='') @@ -115,19 +118,20 @@ class pdf_einstein extends ModelePDFCommandes $outputlangs->load("bills"); $outputlangs->load("products"); $outputlangs->load("orders"); - + $outputlangs->setPhpLang(); - - // Définition de l'objet $com (pour compatibilite ascendante) - if (! is_object($com)) - { - $id = $com; - $com = new Commande($this->db,"",$id); - $ret=$com->fetch($id); - } if ($conf->commande->dir_output) - { + { + // Définition de l'objet $com (pour compatibilite ascendante) + if (! is_object($com)) + { + $id = $com; + $com = new Commande($this->db,"",$id); + $ret=$com->fetch($id); + } + $deja_regle = ""; + // Définition de $dir et $file if ($com->specimen) { @@ -140,7 +144,7 @@ class pdf_einstein extends ModelePDFCommandes $dir = $conf->commande->dir_output . "/" . $comref; $file = $dir . "/" . $comref . ".pdf"; } - + if (! file_exists($dir)) { if (create_exdir($dir) < 0) @@ -149,9 +153,10 @@ class pdf_einstein extends ModelePDFCommandes return 0; } } - + if (file_exists($dir)) { + $nblignes = sizeof($com->lignes); // Initialisation document vierge $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); @@ -168,7 +173,6 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetAutoPageBreak(1,0); // Positionne $this->atleastonediscount si on a au moins une remise - $nblignes = sizeof($com->lignes); for ($i = 0 ; $i < $nblignes ; $i++) { if ($com->lignes[$i]->remise_percent) @@ -177,13 +181,37 @@ class pdf_einstein extends ModelePDFCommandes } } + // Tete de page $this->_pagehead($pdf, $com, 1, $outputlangs); $pagenb = 1; $tab_top = 90; $tab_top_newpage = 50; $tab_height = 110; - $tab_height_newpage = 170; + $tab_height_newpage = 180; + + // Affiche notes + if ($com->note_public) + { + $tab_top = 88; + + $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page + $pdf->SetXY ($this->posxdesc-1, $tab_top); + $pdf->MultiCell(190, 3, $com->note_public, 0, 'J'); + $nexY = $pdf->GetY(); + $height_note=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $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); + + $tab_height = $tab_height - $height_note; + $tab_top = $nexY+6; + } + else + { + $height_note=0; + } $iniY = $tab_top + 8; $curY = $tab_top + 8; @@ -205,23 +233,31 @@ class pdf_einstein extends ModelePDFCommandes if ($com->lignes[$i]->fk_product) { $prodser = new Product($this->db); - $prodser->fetch($com->lignes[$i]->fk_product); + + // On ajoute la ref if ($prodser->ref) - { - $libelleproduitservice=$outputlangs->trans("Product")." ".$prodser->ref." - ".$libelleproduitservice; + { + $prefix_prodserv = ""; + if($prodser->type == 0) + $prefix_prodserv = $outputlangs->trans("Product")." "; + if($prodser->type == 1) + $prefix_prodserv = $outputlangs->trans("Service")." "; + + $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice; } - // Ajoute description du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + // Ajoute description du produit + if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { - if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc) + if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc) { if ($libelleproduitservice) $libelleproduitservice.="\n"; $libelleproduitservice.=$com->lignes[$i]->product_desc; } - } + } } + if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end) { // Affichage durée si il y en a une @@ -274,8 +310,8 @@ class pdf_einstein extends ModelePDFCommandes $nexY+=2; // Passe espace entre les lignes - if ($nexY > 200 && $i < ($nblignes - 1)) - { + if ($nexY > ($tab_top+$tab_height) && $i < ($nblignes - 1)) + { if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs); @@ -284,149 +320,47 @@ class pdf_einstein extends ModelePDFCommandes { $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - - $this->_pagefoot($pdf,$outputlangs); - + + $this->_pagefoot($pdf,$outputlangs); + // Nouvelle page $pdf->AddPage(); $pagenb++; $this->_pagehead($pdf, $com, 0, $outputlangs); - + $nexY = $tab_top_newpage + 8; - $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','', 10); } } + // Affiche cadre tableau if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); $bottomlasttab=$tab_top + $tab_height + 1; } - else + else { $this->_tableau($pdf, $tab_top_newpage, $tab_height, $nexY, $outputlangs); $bottomlasttab=$tab_top_newpage + $tab_height + 1; } - $deja_regle = ""; - + // Affiche zone infos $posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs); - - if ($deja_regle) { - $this->_tableau_versements($pdf, $fac, $posy, $outputlangs); + // Affiche zone totaux + $posy=$this->_tableau_tot($pdf, $com, $deja_regle, $bottomlasttab, $outputlangs); + + // Affiche zone versements + if ($deja_regle) { + $posy=$this->_tableau_versements($pdf, $com, $posy, $outputlangs); } - /* - * Mode de règlement - */ - if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) - { - $pdf->SetXY ($this->marge_gauche, 228); - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); - $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorCreateBankAccount"),0,'L',0); - $pdf->SetTextColor(0,0,0); - } - - /* - * Propose mode règlement par CHQ - */ - /* - if (defined("FACTURE_CHQ_NUMBER")) - { - if (FACTURE_CHQ_NUMBER > 0) - { - $account = new Account($this->db); - $account->fetch(FACTURE_CHQ_NUMBER); - - $pdf->SetXY ($this->marge_gauche, 227); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, "Règlement par chèque à l'ordre de ".$account->proprio." envoyé à:",0,'L',0); - $pdf->SetXY ($this->marge_gauche, 231); - $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); - } - } - */ - - /* - * Propose mode règlement par RIB - */ - /* - if (defined("FACTURE_RIB_NUMBER")) - { - if (FACTURE_RIB_NUMBER > 0) - { - $account = new Account($this->db); - $account->fetch(FACTURE_RIB_NUMBER); - - $this->marges['g']=$this->marge_gauche; - - $cury=242; - $pdf->SetXY ($this->marges['g'], $cury); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, "Règlement par virement sur le compte bancaire suivant:", 0, 'L', 0); - $cury+=4; - $pdf->SetFont('Arial','B',6); - $pdf->line($this->marges['g']+1, $cury, $this->marges['g']+1, $cury+10 ); - $pdf->SetXY ($this->marges['g'], $cury); - $pdf->MultiCell(18, 3, "Code banque", 0, 'C', 0); - $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); - $pdf->SetXY ($this->marges['g']+18, $cury); - $pdf->MultiCell(18, 3, "Code guichet", 0, 'C', 0); - $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); - $pdf->SetXY ($this->marges['g']+36, $cury); - $pdf->MultiCell(24, 3, "Numéro compte", 0, 'C', 0); - $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); - $pdf->SetXY ($this->marges['g']+60, $cury); - $pdf->MultiCell(13, 3, "Clé RIB", 0, 'C', 0); - $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); - - $pdf->SetFont('Arial','',8); - $pdf->SetXY ($this->marges['g'], $cury+5); - $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+18, $cury+5); - $pdf->MultiCell(18, 3, $account->code_guichet, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+36, $cury+5); - $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+60, $cury+5); - $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); - - $pdf->SetXY ($this->marges['g'], $cury+12); - $pdf->MultiCell(90, 3, "Domiciliation : " . $account->domiciliation, 0, 'L', 0); - $pdf->SetXY ($this->marges['g'], $cury+22); - $pdf->MultiCell(90, 3, "Prefix IBAN : " . $account->iban_prefix, 0, 'L', 0); - $pdf->SetXY ($this->marges['g'], $cury+25); - $pdf->MultiCell(90, 3, "BIC : " . $account->bic, 0, 'L', 0); - - } - } - */ - - /* - * Conditions de règlements - */ - /* Pour l'instant les conditions de règlement ne sont pas gérées sur les propales */ - /* - $pdf->SetFont('Arial','B',10); - $pdf->SetXY($this->marge_gauche, 217); - $titre = "Conditions de réglement:"; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('Arial','',10); - $pdf->SetXY(54, 217); - $pdf->MultiCell(80, 5, $prop->cond_reglement_facture,0,'L'); - */ - - /* - * Pied de page - */ + // Pied de page $this->_pagefoot($pdf,$outputlangs); $pdf->AliasNbPages(); - + $pdf->Close(); $pdf->Output($file); @@ -436,22 +370,184 @@ class pdf_einstein extends ModelePDFCommandes } else { - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); $langs->setPhpLang(); // On restaure langue session return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); + $this->error=$outputlangs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); $langs->setPhpLang(); // On restaure langue session return 0; } - $this->error=$langs->trans("ErrorUnknown"); + $this->error=$outputlangs->trans("ErrorUnknown"); $langs->setPhpLang(); // On restaure langue session return 0; // Erreur par defaut } + /* + * \brief Affiche tableau des versement + * \param pdf objet PDF + * \param com objet commande + */ + function _tableau_versements(&$pdf, $com, $posy, $outputlangs) + { + + } + + + /* + * \brief Affiche infos divers + * \param pdf Objet PDF + * \param com Objet commande + * \param posy Position depart + * \param outputlangs Objet langs + * \return y Position pour suite + */ + function _tableau_info(&$pdf, $com, $posy, $outputlangs) + { + global $conf; + + $pdf->SetFont('Arial','', 9); + + /* + * Affiche la mention TVA non applicable selon option + */ + if ($this->franchise == 1) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->MultiCell(100, 3, $outputlangs->trans("VATIsNotUsedForInvoice"), 0, 'L', 0); + + $posy=$pdf->GetY()+4; + } + + /* + * Conditions de règlements + */ + if ($com->cond_reglement_code || $com->cond_reglement) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->trans("PaymentConditions").':'; + $pdf->MultiCell(80, 5, $titre, 0, 'L'); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY(50, $posy); + $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$com->cond_reglement_code)!=('PaymentCondition'.$com->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$com->cond_reglement_code):$com->cond_reglement; + $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + + $posy=$pdf->GetY()+3; + } + + /* + * Mode de règlement + */ + if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); + $pdf->SetTextColor(0,0,0); + + $posy=$pdf->GetY()+1; + } + + /* + * Propose mode règlement par CHQ + */ + if ($conf->global->FACTURE_CHQ_NUMBER) + { + if ($conf->global->FACTURE_CHQ_NUMBER > 0) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_CHQ_NUMBER); + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + if ($conf->global->FACTURE_CHQ_NUMBER == -1) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedToShort').' '.$this->emetteur->nom.' '.$outputlangs->trans('SendTo').':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 6, $this->emetteur->adresse_full, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + } + + /* + * Propose mode règlement par RIB + */ + if ($conf->global->FACTURE_RIB_NUMBER) + { + if ($conf->global->FACTURE_RIB_NUMBER) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_RIB_NUMBER); + + $this->marges['g']=$this->marge_gauche; + + $cury=$posy; + $pdf->SetXY ($this->marges['g'], $cury); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0); + $cury+=4; + $pdf->SetFont('Arial','B',6); + $pdf->line($this->marges['g']+1, $cury, $this->marges['g']+1, $cury+10 ); + $pdf->SetXY ($this->marges['g'], $cury); + $pdf->MultiCell(18, 3, $outputlangs->trans("BankCode"), 0, 'C', 0); + $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); + $pdf->SetXY ($this->marges['g']+18, $cury); + $pdf->MultiCell(18, 3, $outputlangs->trans("DeskCode"), 0, 'C', 0); + $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); + $pdf->SetXY ($this->marges['g']+36, $cury); + $pdf->MultiCell(24, 3, $outputlangs->trans("BankAccountNumber"), 0, 'C', 0); + $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); + $pdf->SetXY ($this->marges['g']+60, $cury); + $pdf->MultiCell(13, 3, $outputlangs->trans("BankAccountNumberKey"), 0, 'C', 0); + $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY ($this->marges['g'], $cury+5); + $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+18, $cury+5); + $pdf->MultiCell(18, 3, $account->code_guichet, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+36, $cury+5); + $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+60, $cury+5); + $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); + + $pdf->SetXY ($this->marges['g'], $cury+12); + $pdf->MultiCell(90, 3, $outputlangs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); + $pdf->SetXY ($this->marges['g'], $cury+22); + $pdf->MultiCell(90, 3, $outputlangs->trans("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0); + $pdf->SetXY ($this->marges['g'], $cury+25); + $pdf->MultiCell(90, 3, $outputlangs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + } + + return $posy; + } + + /* * \brief Affiche le total à payer * \param pdf Objet PDF @@ -461,21 +557,11 @@ class pdf_einstein extends ModelePDFCommandes */ function _tableau_tot(&$pdf, $com, $deja_regle, $posy, $outputlangs) { - $outputlangs->load("main"); - $outputlangs->load("bills"); - $tab2_top = $posy; $tab2_hl = 5; $tab2_height = $tab2_hl * 4; $pdf->SetFont('Arial','', 9); - // Affiche la mention TVA non applicable selon option - $pdf->SetXY ($this->marge_gauche, $tab2_top + 0); - if ($this->franchise==1) - { - $pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0); - } - // Tableau total $lltot = 200; $col1x = 120; $col2x = 182; $largcol2 = $lltot - $col2x; @@ -497,7 +583,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell($largcol2, $tab2_hl, "-".$com->remise_percent."%", 0, 'R', 1); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * 2); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, "Total HT après remise", 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("WithDiscountTotalHT"), 0, 'L', 1); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2); $pdf->MultiCell($largcol2, $tab2_hl, price($com->total_ht), 0, 'R', 0); @@ -516,14 +602,14 @@ class pdf_einstein extends ModelePDFCommandes if ($tvakey) // On affiche pas taux 0 { $this->atleastoneratenotnull++; - + $index++; $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl = ( (float)$tvakey < 0 ) ? " (".$outputlangs->trans("NonPercuRecuperable").")" : '' ; + $tvacompl = ( (float)$tvakey < 0 ) ? " (".$outputlangs->trans("NonPercuRecuperable").")" : '' ; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("TotalVAT").' '.abs($tvakey).'%'.$tvacompl, 0, 'L', 1); - + $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 * (float)$tvakey / 100 ), 0, 'R', 1); } } if (! $this->atleastoneratenotnull) @@ -531,13 +617,13 @@ class pdf_einstein extends ModelePDFCommandes $index++; $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("TotalVAT"), 0, 'L', 1); - + $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($com->total_tva), 0, 'R', 1); } - + $useborder=0; - + $index++; $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetTextColor(0,0,60); @@ -546,31 +632,34 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($com->total_ttc), $useborder, 'R', 1); - $pdf->SetFont('Arial','', 9); $pdf->SetTextColor(0,0,0); if ($deja_regle > 0) { $index++; - + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("AlreadyPayed"), 0, 'L', 0); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); + + $index++; $pdf->SetTextColor(0,0,60); - //$pdf->SetFont('Arial','B', 9); + $pdf->SetFillColor(224,224,224); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($com->total_ttc - $deja_regle), $useborder, 'R', 1); + + // Fin $pdf->SetFont('Arial','', 9); $pdf->SetTextColor(0,0,0); } - + $index++; return ($tab2_top + ($tab2_hl * $index)); } @@ -582,9 +671,7 @@ class pdf_einstein extends ModelePDFCommandes function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { global $conf; - $outputlangs->load("main"); - $outputlangs->load("bills"); - + // Montants exprimés en (en tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',8); @@ -596,9 +683,9 @@ class pdf_einstein extends ModelePDFCommandes // Rect prend une longueur en 3eme param $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); // line prend une position y en 3eme param - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); - $pdf->SetFont('Arial','',10); + $pdf->SetFont('Arial','',9); $pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->MultiCell(108,2, $outputlangs->trans("Designation"),'','L'); @@ -680,19 +767,25 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(100, 4, $outputlangs->trans("Order"), '' , 'R'); $pdf->SetFont('Arial','B',12); - + $posy+=6; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->trans("Ref")." : " . $com->ref, '', 'R'); - - $pdf->SetFont('Arial','',12); + + $pdf->SetFont('Arial','',10); $posy+=6; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->trans("OrderDate")." : " . dolibarr_print_date($com->date,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->trans("OrderDate")." : " . dolibarr_print_date($com->date,"%d %b %Y"), '', 'R'); +/* + $posy+=5; + $pdf->SetXY(100,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->trans("DateEcheance")." : " . dolibarr_print_date($fac->date_lim_reglement,"%d %b %Y"), '', 'R'); +*/ if ($showadress) { @@ -703,21 +796,21 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('Arial','',8); $pdf->SetXY($this->marge_gauche,$posy-5); $pdf->MultiCell(66,5, $outputlangs->trans("BillFrom").":"); - - + + $pdf->SetXY($this->marge_gauche,$posy); $pdf->SetFillColor(230,230,230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); - - + + $pdf->SetXY($this->marge_gauche+2,$posy+3); - + // Nom emetteur $pdf->SetTextColor(0,0,60); $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'); else $pdf->MultiCell(80, 4, $this->emetteur->nom, 0, 'L'); - + // Caractéristiques emetteur $carac_emetteur = ''; if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; @@ -738,31 +831,27 @@ class pdf_einstein extends ModelePDFCommandes // Web if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Web").": ".FAC_PDF_WWW; elseif ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->trans("Web").": ".$this->emetteur->url; - + $pdf->SetFont('Arial','',9); $pdf->SetXY($this->marge_gauche+2,$posy+8); $pdf->MultiCell(80,4, $carac_emetteur); - + // Client destinataire $posy=42; $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',8); $pdf->SetXY(102,$posy-5); $pdf->MultiCell(80,5, $outputlangs->trans("BillTo").":"); - // - $client = new Societe($this->db); - $client->fetch($com->socidp); - $com->client = $client; - // - + $com->fetch_client(); + // Cadre client destinataire $pdf->rect(100, $posy, 100, $hautcadre); - + // Nom client $pdf->SetXY(102,$posy+3); $pdf->SetFont('Arial','B',11); $pdf->MultiCell(106,4, $com->client->nom, 0, 'L'); - + // Caractéristiques client $carac_client=$com->client->adresse; $carac_client.="\n".$com->client->cp . " " . $com->client->ville."\n"; @@ -781,12 +870,9 @@ class pdf_einstein extends ModelePDFCommandes function _pagefoot(&$pdf,$outputlangs) { global $conf; - $outputlangs->load("main"); - $outputlangs->load("bills"); - $outputlangs->load("companies"); - + $html=new Form($this->db); - + // Premiere ligne d'info réglementaires $ligne1=""; if ($this->emetteur->forme_juridique_code) @@ -810,7 +896,7 @@ class pdf_einstein extends ModelePDFCommandes $ligne2=""; if ($this->emetteur->profid3) { - $ligne2.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3; + $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3; } if ($this->emetteur->profid4) { @@ -830,7 +916,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetY(-$posy); $pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); $posy--; - + if ($ligne1) { $pdf->SetXY($this->marge_gauche,-$posy); @@ -843,7 +929,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($this->marge_gauche,-$posy); $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); } - + $pdf->SetXY(-20,-$posy); $pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); } @@ -857,7 +943,7 @@ class pdf_einstein extends ModelePDFCommandes function _dol_htmlentities($stringtoencode,$isstringalreadyhtml) { global $conf; - + if ($isstringalreadyhtml) return $stringtoencode; if ($conf->fckeditor->enabled) return htmlentities($stringtoencode); return $stringtoencode; diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 72ca1095367..305e595ead0 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -73,6 +73,7 @@ class pdf_crabe extends ModelePDFFactures $this->option_condreg = 1; // Affiche conditions règlement $this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 1; // Affiche si il y a eu escompte if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') $this->franchise=1; @@ -109,9 +110,9 @@ class pdf_crabe extends ModelePDFFactures $outputlangs->load("companies"); $outputlangs->load("bills"); $outputlangs->load("products"); - + $outputlangs->setPhpLang(); - + if ($conf->facture->dir_output) { // Définition de l'objet $fac (pour compatibilite ascendante) @@ -121,6 +122,7 @@ class pdf_crabe extends ModelePDFFactures $fac = new Facture($this->db,"",$id); $ret=$fac->fetch($id); } + $deja_regle = $fac->getSommePaiement(); // Définition de $dir et $file if ($fac->specimen) @@ -172,9 +174,9 @@ class pdf_crabe extends ModelePDFFactures } } + // Tete de page $this->_pagehead($pdf, $fac, 1, $outputlangs); - // Affiches lignes $pagenb = 1; $tab_top = 90; $tab_top_newpage = 50; @@ -224,10 +226,12 @@ class pdf_crabe extends ModelePDFFactures if ($fac->lignes[$i]->produit_id) { $prodser = new Product($this->db); - $prodser->fetch($fac->lignes[$i]->produit_id); - if ($prodser->ref) { - $prefix_prodserv = ""; + + // On ajoute la ref + if ($prodser->ref) + { + $prefix_prodserv = ""; if($prodser->type == 0) $prefix_prodserv = $outputlangs->trans("Product")." "; if($prodser->type == 1) @@ -236,8 +240,8 @@ class pdf_crabe extends ModelePDFFactures $libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice; } - // Ajoute description du produit - if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) + // Ajoute description du produit + if ($conf->global->FORM_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { if ($fac->lignes[$i]->product_desc&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->desc) { @@ -308,8 +312,8 @@ class pdf_crabe extends ModelePDFFactures { $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs); } - - $this->_pagefoot($pdf,$outputlangs); + + $this->_pagefoot($pdf,$outputlangs); // Nouvelle page $pdf->AddPage(); @@ -322,6 +326,7 @@ class pdf_crabe extends ModelePDFFactures } } + // Affiche cadre tableau if ($pagenb == 1) { @@ -334,124 +339,18 @@ class pdf_crabe extends ModelePDFFactures $bottomlasttab=$tab_top_newpage + $tab_height + 1; } - $deja_regle = $fac->getSommePaiement(); + // Affiche zone infos + $posy=$this->_tableau_info($pdf, $fac, $bottomlasttab, $outputlangs); + // Affiche zone totaux $posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $bottomlasttab, $outputlangs); + // Affiche zone versements if ($deja_regle) { - $this->_tableau_versements($pdf, $fac, $posy, $outputlangs); + $posy=$this->_tableau_versements($pdf, $fac, $posy, $outputlangs); } - /* - * Mode de règlement - */ - if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) - { - $pdf->SetXY($this->marge_gauche, 228); - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); - $pdf->SetTextColor(0,0,0); - } - - /* - * Propose mode règlement par CHQ - */ - if ($conf->global->FACTURE_CHQ_NUMBER) - { - if ($conf->global->FACTURE_CHQ_NUMBER > 0) - { - $account = new Account($this->db); - $account->fetch($conf->global->FACTURE_CHQ_NUMBER); - - $pdf->SetXY($this->marge_gauche, 227); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); - $pdf->SetXY($this->marge_gauche, 231); - $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); - } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) - { - $pdf->SetXY($this->marge_gauche, 227); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedToShort').' '.$this->emetteur->nom.' '.$outputlangs->trans('SendTo').':',0,'L',0); - $pdf->SetXY($this->marge_gauche, 231); - $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $this->emetteur->adresse_full, 0, 'L', 0); - } - } - - /* - * Propose mode règlement par RIB - */ - if ($conf->global->FACTURE_RIB_NUMBER) - { - if ($conf->global->FACTURE_RIB_NUMBER) - { - $account = new Account($this->db); - $account->fetch($conf->global->FACTURE_RIB_NUMBER); - - $this->marges['g']=$this->marge_gauche; - - $cury=242; - $pdf->SetXY ($this->marges['g'], $cury); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0); - $cury+=4; - $pdf->SetFont('Arial','B',6); - $pdf->line($this->marges['g']+1, $cury, $this->marges['g']+1, $cury+10 ); - $pdf->SetXY ($this->marges['g'], $cury); - $pdf->MultiCell(18, 3, $outputlangs->trans("BankCode"), 0, 'C', 0); - $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); - $pdf->SetXY ($this->marges['g']+18, $cury); - $pdf->MultiCell(18, 3, $outputlangs->trans("DeskCode"), 0, 'C', 0); - $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); - $pdf->SetXY ($this->marges['g']+36, $cury); - $pdf->MultiCell(24, 3, $outputlangs->trans("BankAccountNumber"), 0, 'C', 0); - $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); - $pdf->SetXY ($this->marges['g']+60, $cury); - $pdf->MultiCell(13, 3, $outputlangs->trans("BankAccountNumberKey"), 0, 'C', 0); - $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); - - $pdf->SetFont('Arial','',8); - $pdf->SetXY ($this->marges['g'], $cury+5); - $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+18, $cury+5); - $pdf->MultiCell(18, 3, $account->code_guichet, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+36, $cury+5); - $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+60, $cury+5); - $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); - - $pdf->SetXY ($this->marges['g'], $cury+12); - $pdf->MultiCell(90, 3, $outputlangs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); - $pdf->SetXY ($this->marges['g'], $cury+22); - $pdf->MultiCell(90, 3, $outputlangs->trans("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0); - $pdf->SetXY ($this->marges['g'], $cury+25); - $pdf->MultiCell(90, 3, $outputlangs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); - - } - } - - /* - * Conditions de règlements - */ - if ($fac->cond_reglement_code || $fac->cond_reglement) - { - $pdf->SetFont('Arial','B',8); - $pdf->SetXY($this->marge_gauche, 217); - $titre = $outputlangs->trans("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('Arial','',8); - $pdf->SetXY(50, 217); - $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement; - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); - } - - /* - * Pied de page - */ + // Pied de page $this->_pagefoot($pdf,$outputlangs); $pdf->AliasNbPages(); @@ -474,7 +373,7 @@ class pdf_crabe extends ModelePDFFactures $this->error=$outputlangs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR"); $langs->setPhpLang(); // On restaure langue session return 0; - } + } $this->error=$outputlangs->trans("ErrorUnknown"); $langs->setPhpLang(); // On restaure langue session return 0; // Erreur par defaut @@ -487,7 +386,7 @@ class pdf_crabe extends ModelePDFFactures * \param fac objet facture */ function _tableau_versements(&$pdf, $fac, $posy, $outputlangs) - { + { $tab3_posx = 120; $tab3_top = $posy + 8; $tab3_width = 80; @@ -567,12 +466,166 @@ class pdf_crabe extends ModelePDFFactures } + + /* + * \brief Affiche infos divers + * \param pdf Objet PDF + * \param fac Objet facture + * \param posy Position depart + * \param outputlangs Objet langs + * \return y Position pour suite + */ + function _tableau_info(&$pdf, $fac, $posy, $outputlangs) + { + global $conf; + + $pdf->SetFont('Arial','', 9); + + /* + * Affiche la mention TVA non applicable selon option + */ + if ($this->franchise == 1) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->MultiCell(100, 3, $outputlangs->trans("VATIsNotUsedForInvoice"), 0, 'L', 0); + + $posy=$pdf->GetY()+4; + } + + /* + * Conditions de règlements + */ + if ($fac->cond_reglement_code || $fac->cond_reglement) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->trans("PaymentConditions").':'; + $pdf->MultiCell(80, 5, $titre, 0, 'L'); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY(50, $posy); + $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement; + $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + + $posy=$pdf->GetY()+3; + } + + /* + * Mode de règlement + */ + if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); + $pdf->SetTextColor(0,0,0); + + $posy=$pdf->GetY()+1; + } + + /* + * Propose mode règlement par CHQ + */ + if ($conf->global->FACTURE_CHQ_NUMBER) + { + if ($conf->global->FACTURE_CHQ_NUMBER > 0) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_CHQ_NUMBER); + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + if ($conf->global->FACTURE_CHQ_NUMBER == -1) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedToShort').' '.$this->emetteur->nom.' '.$outputlangs->trans('SendTo').':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 6, $this->emetteur->adresse_full, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + } + + /* + * Propose mode règlement par RIB + */ + if ($conf->global->FACTURE_RIB_NUMBER) + { + if ($conf->global->FACTURE_RIB_NUMBER) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_RIB_NUMBER); + + $this->marges['g']=$this->marge_gauche; + + $cury=$posy; + $pdf->SetXY ($this->marges['g'], $cury); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0); + $cury+=4; + $pdf->SetFont('Arial','B',6); + $pdf->line($this->marges['g']+1, $cury, $this->marges['g']+1, $cury+10 ); + $pdf->SetXY ($this->marges['g'], $cury); + $pdf->MultiCell(18, 3, $outputlangs->trans("BankCode"), 0, 'C', 0); + $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); + $pdf->SetXY ($this->marges['g']+18, $cury); + $pdf->MultiCell(18, 3, $outputlangs->trans("DeskCode"), 0, 'C', 0); + $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); + $pdf->SetXY ($this->marges['g']+36, $cury); + $pdf->MultiCell(24, 3, $outputlangs->trans("BankAccountNumber"), 0, 'C', 0); + $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); + $pdf->SetXY ($this->marges['g']+60, $cury); + $pdf->MultiCell(13, 3, $outputlangs->trans("BankAccountNumberKey"), 0, 'C', 0); + $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY ($this->marges['g'], $cury+5); + $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+18, $cury+5); + $pdf->MultiCell(18, 3, $account->code_guichet, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+36, $cury+5); + $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+60, $cury+5); + $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); + + $pdf->SetXY ($this->marges['g'], $cury+12); + $pdf->MultiCell(90, 3, $outputlangs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); + $pdf->SetXY ($this->marges['g'], $cury+22); + $pdf->MultiCell(90, 3, $outputlangs->trans("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0); + $pdf->SetXY ($this->marges['g'], $cury+25); + $pdf->MultiCell(90, 3, $outputlangs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + } + + return $posy; + } + + /* - * \brief Affiche le total à payer - * \param pdf Objet PDF - * \param fac Objet facture - * \param deja_regle Montant deja regle - * \return y Position pour suite + * \brief Affiche le total à payer + * \param pdf Objet PDF + * \param fac Objet facture + * \param deja_regle Montant deja regle + * \param posy Position depart + * \param outputlangs Objet langs + * \return y Position pour suite */ function _tableau_tot(&$pdf, $fac, $deja_regle, $posy, $outputlangs) { @@ -581,13 +634,6 @@ class pdf_crabe extends ModelePDFFactures $tab2_height = $tab2_hl * 4; $pdf->SetFont('Arial','', 9); - // Affiche la mention TVA non applicable selon option - $pdf->SetXY($this->marge_gauche, $tab2_top + 0); - if ($this->franchise==1) - { - $pdf->MultiCell(100, $tab2_hl, $outputlangs->trans("VATIsNotUsedForInvoice"), 0, 'L', 0); - } - // Tableau total $lltot = 200; $col1x = 120; $col2x = 182; $largcol2 = $lltot - $col2x; @@ -658,7 +704,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($fac->total_ttc), $useborder, 'R', 1); - $pdf->SetFont('Arial','', 9); $pdf->SetTextColor(0,0,0); if ($deja_regle > 0) @@ -671,23 +716,35 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); + $resteapayer = $fac->total_ttc - $deja_regle; + if ($fac->paye) $resteapayer=0; + + if ($fac->close_code == 'escompte') + { + $index++; + $pdf->SetFillColor(256,256,256); + + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("EscompteOffered"), $useborder, 'L', 1); + + $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($fac->total_ttc - $deja_regle), $useborder, 'R', 1); + } + $index++; $pdf->SetTextColor(0,0,60); - //$pdf->SetFont('Arial','B', 9); + $pdf->SetFillColor(224,224,224); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($fac->total_ttc - $deja_regle), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1); + + // Fin $pdf->SetFont('Arial','', 9); $pdf->SetTextColor(0,0,0); } -/* Ne semble pas requis par la réglementation - $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x+$largcol2, $tab2_hl, $outputlangs->trans('DispenseMontantLettres'), 0, 'L' ); -*/ $index++; return ($tab2_top + ($tab2_hl * $index)); } @@ -713,7 +770,7 @@ class pdf_crabe extends ModelePDFFactures // line prend une position y en 3eme param $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); - $pdf->SetFont('Arial','',10); + $pdf->SetFont('Arial','',9); $pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->MultiCell(108,2, $outputlangs->trans("Designation"),'','L'); @@ -795,27 +852,27 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(100, 4, $outputlangs->trans("Invoice"), '' , 'R'); $pdf->SetFont('Arial','B',12); - + $posy+=6; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->trans("Ref")." : " . $fac->ref, '', 'R'); - - $pdf->SetFont('Arial','',12); + + $pdf->SetFont('Arial','',10); $posy+=6; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->trans("DateInvoice")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->trans("DateInvoice")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); - $posy+=6; + $posy+=5; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->trans("DateEcheance")." : " . dolibarr_print_date($fac->date_lim_reglement,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->trans("DateEcheance")." : " . dolibarr_print_date($fac->date_lim_reglement,"%d %b %Y"), '', 'R'); if ($showadress) { - // Emetteur + // Emetteur $posy=42; $hautcadre=40; $pdf->SetTextColor(0,0,0); @@ -869,6 +926,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY(102,$posy-5); $pdf->MultiCell(80,5, $outputlangs->trans("BillTo").":"); $fac->fetch_client(); + // Cadre client destinataire $pdf->rect(100, $posy, 100, $hautcadre); @@ -968,7 +1026,7 @@ class pdf_crabe extends ModelePDFFactures function _dol_htmlentities($stringtoencode,$isstringalreadyhtml) { global $conf; - + if ($isstringalreadyhtml) return $stringtoencode; if ($conf->fckeditor->enabled) return htmlentities($stringtoencode); return $stringtoencode; diff --git a/htdocs/includes/modules/modExternalRss.class.php b/htdocs/includes/modules/modExternalRss.class.php index 1b0b0aa9ae4..278b9230de5 100644 --- a/htdocs/includes/modules/modExternalRss.class.php +++ b/htdocs/includes/modules/modExternalRss.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2006 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,91 +39,99 @@ include_once "DolibarrModules.class.php"; class modExternalRss extends DolibarrModules { - /** + /** * \brief Constructeur. Definit les noms, constantes et boites * \param DB handler d'accès base */ - function modExternalRss($DB) - { - $this->db = $DB ; - $this->id = 'externalrss'; // Same value xxx than in file modXxx.class.php file - $this->numero = 320; + function modExternalRss($DB) + { + global $conf; + + $this->db = $DB ; + $this->id = 'externalrss'; // Same value xxx than in file modXxx.class.php file + $this->numero = 320; + + $this->family = "technic"; + $this->name = "Syndication RSS"; + $this->description = "Ajout de files d'informations RSS dans les écrans Dolibarr"; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->const_name = 'MAIN_MODULE_EXTERNALRSS'; + $this->special = 1; + $this->picto='rss'; + + // Dir + $this->dirs = array(); + + // Config pages + $this->config_page_url = array("external_rss.php"); + + // Dépendances + $this->depends = array(); + $this->requiredby = array(); + $this->phpmin = array(4,2,0); + $this->phpmax = array(); + + // Constantes + $this->const = array(); + + // Répertoires + $this->dirs = array(); + $this->dirs[0] = $conf->externalrss->dir_temp; + + // Boxes + $this->boxes = array(); + // Les boites sont ajoutées lors de la configuration des flux + + // Permissions + $this->rights = array(); + $this->rights_class = 'externalrss'; + } - $this->family = "technic"; - $this->name = "Syndication RSS"; - $this->description = "Ajout de files d'informations RSS dans les écrans Dolibarr"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version - $this->const_name = 'MAIN_MODULE_EXTERNALRSS'; - $this->special = 1; - $this->picto='rss'; - - // Dir - $this->dirs = array(); - - // Config pages - $this->config_page_url = array("external_rss.php"); - - // Dépendances - $this->depends = array(); - $this->requiredby = array(); - $this->phpmin = array(4,2,0); - $this->phpmax = array(); - - // Constantes - $this->const = array(); - - // Boxes - $this->boxes = array(); - // Les boites sont ajoutées lors de la configuration des flux - - // Permissions - $this->rights = array(); - $this->rights_class = 'externalrss'; - } - - /** + /** * \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module. * Définit également les répertoires de données à créer pour ce module. */ - function init() - { - $sql = array(); - - // Recherche configuration de boites - $this->boxes=array(); - $sql="select name, value from ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE name like 'EXTERNAL_RSS_TITLE_%'"; - $result=$this->db->query($sql); - if ($result) + function init() { - while ($obj = $this->db->fetch_object($result)) - { - if (eregi('EXTERNAL_RSS_TITLE_([0-9]+)',$obj->name,$reg)) - { - // Definie la boite si on a trouvée une ancienne configuration - $this->boxes[$reg[1]][0] = "(ExternalRSSInformations)"; - $this->boxes[$reg[1]][1] = "box_external_rss.php"; - $this->boxes[$reg[1]][2] = $reg[1]." (".$obj->value.")"; + $sql = array(); + + // Recherche configuration de boites + $this->boxes=array(); + $sql="select name, value from ".MAIN_DB_PREFIX."const"; + $sql.= " WHERE name like 'EXTERNAL_RSS_TITLE_%'"; + $result=$this->db->query($sql); + if ($result) + { + while ($obj = $this->db->fetch_object($result)) + { + if (eregi('EXTERNAL_RSS_TITLE_([0-9]+)',$obj->name,$reg)) + { + // Definie la boite si on a trouvée une ancienne configuration + $this->boxes[$reg[1]][0] = "(ExternalRSSInformations)"; + $this->boxes[$reg[1]][1] = "box_external_rss.php"; + $this->boxes[$reg[1]][2] = $reg[1]." (".$obj->value.")"; + } } + $this->db->free($result); } - $this->db->free($result); + + $sql = array(); + + return $this->_init($sql); } - return $this->_init($sql); - } - - /** - * \brief Fonction appelée lors de la désactivation d'un module. - * Supprime de la base les constantes, boites et permissions du module. - */ - function remove() - { - $sql = array(); - - // Supprime anciennes delcarations de la boite RSS - $this->boxes[0][1] = "box_external_rss.php"; - - return $this->_remove($sql); - } + /** + * \brief Fonction appelée lors de la désactivation d'un module. + * Supprime de la base les constantes, boites et permissions du module. + */ + function remove() + { + $sql = array(); + + // Supprime anciennes delcarations de la boite RSS + $this->boxes[0][1] = "box_external_rss.php"; + + return $this->_remove($sql); + } } ?> diff --git a/htdocs/includes/modules/propale/modules_propale.php b/htdocs/includes/modules/propale/modules_propale.php index c20a08dc2eb..fe144fbe565 100644 --- a/htdocs/includes/modules/propale/modules_propale.php +++ b/htdocs/includes/modules/propale/modules_propale.php @@ -30,6 +30,7 @@ */ require_once(FPDF_PATH.'fpdf.php'); +require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilisé dans les classes qui héritent /** diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index ed3233743a7..3c50fbb11f2 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -40,7 +40,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php"); class pdf_propale_azur extends ModelePDFPropales { var $emetteur; // Objet societe qui emet - + /** \brief Constructeur @@ -79,7 +79,7 @@ class pdf_propale_azur extends ModelePDFPropales // Recupere emmetteur $this->emetteur=$mysoc; - if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si on trouve pas + if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; @@ -92,11 +92,11 @@ class pdf_propale_azur extends ModelePDFPropales $this->tva=array(); $this->atleastoneratenotnull=0; $this->atleastonediscount=0; - } + } /** \brief Fonction générant la propale sur le disque - \param propale Objet propal + \param propale Objet propal à générer (ou id si ancienne methode) \return int 1=ok, 0=ko */ function write_pdf_file($propale,$outputlangs='') @@ -121,6 +121,7 @@ class pdf_propale_azur extends ModelePDFPropales $propale = new Propal($this->db,"",$id); $ret=$propale->fetch($id); } + $deja_regle = ""; // Définition de $dir et $file if ($propale->specimen) @@ -172,9 +173,9 @@ class pdf_propale_azur extends ModelePDFPropales } } + // Tete de page $this->_pagehead($pdf, $propale, 1, $outputlangs); - // Affiches lignes $pagenb = 1; $tab_top = 90; $tab_top_newpage = 50; @@ -224,7 +225,7 @@ class pdf_propale_azur extends ModelePDFPropales { $prodser = new Product($this->db); $prodser->fetch($propale->lignes[$i]->fk_product); - + // On ajoute la ref if ($prodser->ref) { @@ -275,7 +276,7 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetXY ($this->posxup, $curY); $pdf->MultiCell(18, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0); - // Quantit + // Quantité $pdf->SetXY ($this->posxqty, $curY); $pdf->MultiCell(10, 4, $propale->lignes[$i]->qty, 0, 'R'); @@ -299,13 +300,17 @@ class pdf_propale_azur extends ModelePDFPropales $nexY+=2; // Passe espace entre les lignes - if ($nexY > 200 && $i < ($nblignes - 1)) + if ($nexY > ($tab_top+$tab_height) && $i < ($nblignes - 1)) { - //$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs); if ($pagenb == 1) - $this->_tableau($pdf, $tab_top, $nexY - $tab_top + 20, $nexY, $outputlangs); + { + $this->_tableau($pdf, $tab_top, $nexY - $tab_top + 20, $nexY, $outputlangs); + } else - $this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY, $outputlangs); + { + $this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY, $outputlangs); + } + $this->_pagefoot($pdf,$outputlangs); // Nouvelle page @@ -319,138 +324,31 @@ class pdf_propale_azur extends ModelePDFPropales } } + // Affiche cadre tableau if ($pagenb == 1) { - //$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs); - //$bottomlasttab=$tab_top + $tab_height + 1; - $this->_tableau($pdf, $tab_top, $nexY - $tab_top + 20, $nexY, $outputlangs); $bottomlasttab=$tab_top + $nexY - $tab_top + 20 + 1; } else { - //$this->_tableau($pdf, $tab_top_newpage, $tab_height, $nexY, $outputlangs); - //$bottomlasttab=$tab_top_newpage + $tab_height + 1; $this->_tableau($pdf, $tab_top_newpage, $nexY - $tab_top_newpage + 20, $nexY, $outputlangs); $bottomlasttab=$tab_top_newpage + $nexY - $tab_top_newpage + 20 + 1; } - $deja_regle = ""; + // Affiche zone infos + $posy=$this->_tableau_info($pdf, $propale, $bottomlasttab, $outputlangs); + // Affiche zone totaux $posy=$this->_tableau_tot($pdf, $propale, $deja_regle, $bottomlasttab, $outputlangs); + // Affiche zone versements if ($deja_regle) { - $this->_tableau_versements($pdf, $fac, $posy, $outputlangs); + $posy=$this->_tableau_versements($pdf, $propale, $posy, $outputlangs); } - /* - * Mode de règlement - */ - /* - if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) - { - $pdf->SetXY ($this->marge_gauche, 228); - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); - $pdf->SetTextColor(0,0,0); - } - */ - - /* - * Propose mode règlement par CHQ - */ - /* - if ($conf->global->FACTURE_CHQ_NUMBER) - { - if ($conf->global->FACTURE_CHQ_NUMBER > 0) - { - $account = new Account($this->db); - $account->fetch(FACTURE_CHQ_NUMBER); - - $pdf->SetXY ($this->marge_gauche, 227); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, "Règlement par chèque à l'ordre de ".$account->proprio." envoyé à:",0,'L',0); - $pdf->SetXY ($this->marge_gauche, 231); - $pdf->SetFont('Arial','',8); - $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); - } - } - */ - - /* - * Propose mode règlement par RIB - */ - /* - if ($conf->global->FACTURE_RIB_NUMBER) - { - if ($conf->global->FACTURE_RIB_NUMBER > 0) - { - $account = new Account($this->db); - $account->fetch(FACTURE_RIB_NUMBER); - - $this->marges['g']=$this->marge_gauche; - - $cury=242; - $pdf->SetXY ($this->marges['g'], $cury); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(90, 3, "Règlement par virement sur le compte bancaire suivant:", 0, 'L', 0); - $cury+=4; - $pdf->SetFont('Arial','B',6); - $pdf->line($this->marges['g']+1, $cury, $this->marges['g']+1, $cury+10 ); - $pdf->SetXY ($this->marges['g'], $cury); - $pdf->MultiCell(18, 3, "Code banque", 0, 'C', 0); - $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); - $pdf->SetXY ($this->marges['g']+18, $cury); - $pdf->MultiCell(18, 3, "Code guichet", 0, 'C', 0); - $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); - $pdf->SetXY ($this->marges['g']+36, $cury); - $pdf->MultiCell(24, 3, "Numéro compte", 0, 'C', 0); - $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); - $pdf->SetXY ($this->marges['g']+60, $cury); - $pdf->MultiCell(13, 3, "Clé RIB", 0, 'C', 0); - $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); - - $pdf->SetFont('Arial','',8); - $pdf->SetXY ($this->marges['g'], $cury+5); - $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+18, $cury+5); - $pdf->MultiCell(18, 3, $account->code_guichet, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+36, $cury+5); - $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); - $pdf->SetXY ($this->marges['g']+60, $cury+5); - $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); - - $pdf->SetXY ($this->marges['g'], $cury+12); - $pdf->MultiCell(90, 3, "Domiciliation : " . $account->domiciliation, 0, 'L', 0); - $pdf->SetXY ($this->marges['g'], $cury+22); - $pdf->MultiCell(90, 3, "Prefix IBAN : " . $account->iban_prefix, 0, 'L', 0); - $pdf->SetXY ($this->marges['g'], $cury+25); - $pdf->MultiCell(90, 3, "BIC : " . $account->bic, 0, 'L', 0); - - } - } - */ - - /* - * Conditions de règlements - */ - if ($propale->cond_reglement_code) - { - $pdf->SetFont('Arial','B',8); - $pdf->SetXY($this->marge_gauche, 217); - $titre = $outputlangs->trans("PaymentConditions").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('Arial','',8); - $pdf->SetXY(50, 217); - $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$propale->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$propale->cond_reglement_code):$propale->cond_reglement; - $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); - } - - /* - * Pied de page - */ + // Pied de page $this->_pagefoot($pdf, $outputlangs); $pdf->AliasNbPages(); @@ -481,25 +379,182 @@ class pdf_propale_azur extends ModelePDFPropales } /* - * \brief Affiche le total à payer - * \param pdf Objet PDF - * \param prop Objet propale - * \param deja_regle Montant deja regle - * \return y Position pour suite + * \brief Affiche tableau des versement + * \param pdf objet PDF + * \param propale objet propale + */ + function _tableau_versements(&$pdf, $propale, $posy, $outputlangs) + { + + } + + + /* + * \brief Affiche infos divers + * \param pdf Objet PDF + * \param propale Objet propale + * \param posy Position depart + * \param outputlangs Objet langs + * \return y Position pour suite + */ + function _tableau_info(&$pdf, $propale, $posy, $outputlangs) + { + global $conf; + + $pdf->SetFont('Arial','', 9); + + /* + * Affiche la mention TVA non applicable selon option + */ + if ($this->franchise == 1) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->MultiCell(100, 3, $outputlangs->trans("VATIsNotUsedForInvoice"), 0, 'L', 0); + + $posy=$pdf->GetY()+4; + } + + /* + * Conditions de règlements + */ + if ($propal->cond_reglement_code || $propal->cond_reglement) + { + $pdf->SetFont('Arial','B',8); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->trans("PaymentConditions").':'; + $pdf->MultiCell(80, 5, $titre, 0, 'L'); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY(50, $posy); + $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$propal->cond_reglement_code)!=('PaymentCondition'.$propal->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$propal->cond_reglement_code):$propal->cond_reglement; + $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); + + $posy=$pdf->GetY()+3; + } + + /* + * Mode de règlement + */ + if (! $conf->global->FACTURE_CHQ_NUMBER && ! $conf->global->FACTURE_RIB_NUMBER) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans("ErrorNoPaiementModeConfigured"),0,'L',0); + $pdf->SetTextColor(0,0,0); + + $posy=$pdf->GetY()+1; + } + + /* + * Propose mode règlement par CHQ + */ + if ($conf->global->FACTURE_CHQ_NUMBER) + { + if ($conf->global->FACTURE_CHQ_NUMBER > 0) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_CHQ_NUMBER); + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + if ($conf->global->FACTURE_CHQ_NUMBER == -1) + { + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByChequeOrderedToShort').' '.$this->emetteur->nom.' '.$outputlangs->trans('SendTo').':',0,'L',0); + $posy=$pdf->GetY()+1; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('Arial','',8); + $pdf->MultiCell(80, 6, $this->emetteur->adresse_full, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + } + + /* + * Propose mode règlement par RIB + */ + if ($conf->global->FACTURE_RIB_NUMBER) + { + if ($conf->global->FACTURE_RIB_NUMBER) + { + $account = new Account($this->db); + $account->fetch($conf->global->FACTURE_RIB_NUMBER); + + $this->marges['g']=$this->marge_gauche; + + $cury=$posy; + $pdf->SetXY ($this->marges['g'], $cury); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(90, 3, $outputlangs->trans('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0); + $cury+=4; + $pdf->SetFont('Arial','B',6); + $pdf->line($this->marges['g']+1, $cury, $this->marges['g']+1, $cury+10 ); + $pdf->SetXY ($this->marges['g'], $cury); + $pdf->MultiCell(18, 3, $outputlangs->trans("BankCode"), 0, 'C', 0); + $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); + $pdf->SetXY ($this->marges['g']+18, $cury); + $pdf->MultiCell(18, 3, $outputlangs->trans("DeskCode"), 0, 'C', 0); + $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); + $pdf->SetXY ($this->marges['g']+36, $cury); + $pdf->MultiCell(24, 3, $outputlangs->trans("BankAccountNumber"), 0, 'C', 0); + $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); + $pdf->SetXY ($this->marges['g']+60, $cury); + $pdf->MultiCell(13, 3, $outputlangs->trans("BankAccountNumberKey"), 0, 'C', 0); + $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); + + $pdf->SetFont('Arial','',8); + $pdf->SetXY ($this->marges['g'], $cury+5); + $pdf->MultiCell(18, 3, $account->code_banque, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+18, $cury+5); + $pdf->MultiCell(18, 3, $account->code_guichet, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+36, $cury+5); + $pdf->MultiCell(24, 3, $account->number, 0, 'C', 0); + $pdf->SetXY ($this->marges['g']+60, $cury+5); + $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); + + $pdf->SetXY ($this->marges['g'], $cury+12); + $pdf->MultiCell(90, 3, $outputlangs->trans("Residence").' : ' . $account->domiciliation, 0, 'L', 0); + $pdf->SetXY ($this->marges['g'], $cury+22); + $pdf->MultiCell(90, 3, $outputlangs->trans("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0); + $pdf->SetXY ($this->marges['g'], $cury+25); + $pdf->MultiCell(90, 3, $outputlangs->trans("BIC").' : ' . $account->bic, 0, 'L', 0); + + $posy=$pdf->GetY()+2; + } + } + + return $posy; + } + + + /* + * \brief Affiche le total à payer + * \param pdf Objet PDF + * \param prop Objet propale + * \param deja_regle Montant deja regle + * \param posy Position depart + * \param outputlangs Objet langs + * \return y Position pour suite */ function _tableau_tot(&$pdf, $propale, $deja_regle, $posy, $outputlangs) { $tab2_top = $posy; $tab2_hl = 5; $tab2_height = $tab2_hl * 4; - $pdf->SetFont('Arial','', 9); - - // Affiche la mention TVA non applicable selon option - $pdf->SetXY ($this->marge_gauche, $tab2_top + 0); - if ($this->franchise==1) - { - $pdf->MultiCell(100, $tab2_hl, "* TVA non applicable art-293B du CGI", 0, 'L', 0); - } + $pdf->SetFont('Arial','', 8); // Tableau total $lltot = 200; $col1x = 120; $col2x = 182; $largcol2 = $lltot - $col2x; @@ -571,7 +626,6 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($propale->total_ttc), $useborder, 'R', 1); - $pdf->SetFont('Arial','', 9); $pdf->SetTextColor(0,0,0); if ($deja_regle > 0) @@ -584,14 +638,31 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); + $resteapayer = $propal->total_ttc - $deja_regle; + if ($propal->paye) $resteapayer=0; + + if ($propal->close_code == 'escompte') + { + $index++; + $pdf->SetFillColor(256,256,256); + + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("EscompteOffered"), $useborder, 'L', 1); + + $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($propal->total_ttc - $deja_regle), $useborder, 'R', 1); + } + $index++; $pdf->SetTextColor(0,0,60); - //$pdf->SetFont('Arial','B', 9); + $pdf->SetFillColor(224,224,224); $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->trans("RemainderToPay"), $useborder, 'L', 1); $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($propale->total_ttc - $deja_regle), $useborder, 'R', 1); + + // Fin $pdf->SetFont('Arial','', 9); $pdf->SetTextColor(0,0,0); } @@ -607,7 +678,7 @@ class pdf_propale_azur extends ModelePDFPropales function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { global $conf; - + // Montants exprimés en (en tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',8); @@ -619,9 +690,9 @@ class pdf_propale_azur extends ModelePDFPropales // Rect prend une longueur en 3eme param $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); // line prend une position y en 3eme param - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); - $pdf->SetFont('Arial','',10); + $pdf->SetFont('Arial','',9); $pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->MultiCell(108,2, $outputlangs->trans("Designation"),'','L'); @@ -708,18 +779,18 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->trans("Ref")." : " . $propale->ref, '', 'R'); - - $pdf->SetFont('Arial','',12); + + $pdf->SetFont('Arial','',10); $posy+=6; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->trans("Date")." : " . dolibarr_print_date($propale->date,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->trans("Date")." : " . dolibarr_print_date($propale->date,"%d %b %Y"), '', 'R'); - $posy+=6; + $posy+=5; $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->trans("DateEndPropal")." : " . dolibarr_print_date($propale->fin_validite,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->trans("DateEndPropal")." : " . dolibarr_print_date($propale->fin_validite,"%d %b %Y"), '', 'R'); if ($showadress) { @@ -803,6 +874,7 @@ class pdf_propale_azur extends ModelePDFPropales */ function _pagefoot(&$pdf,$outputlangs) { + global $conf; $html=new Form($this->db); // Premiere ligne d'info réglementaires @@ -875,7 +947,7 @@ class pdf_propale_azur extends ModelePDFPropales function _dol_htmlentities($stringtoencode,$isstringalreadyhtml) { global $conf; - + if ($isstringalreadyhtml) return $stringtoencode; if ($conf->fckeditor->enabled) return htmlentities($stringtoencode); return $stringtoencode; diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 6b5fd9ec73f..6d255cd48f6 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -193,7 +193,7 @@ if ($_POST["action"] == "set") $dir[4] = "$main_data_dir/ficheinter"; $dir[5] = "$main_data_dir/produit"; $dir[6] = "$main_data_dir/rapport"; - $dir[7] = "$main_data_dir/rsscache"; + $dir[7] = "$main_data_dir/rss"; $dir[8] = "$main_data_dir/logo"; // Boucle sur chaque répertoire de dir[] pour les créer s'ils nexistent pas diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 22b2c6f296a..8bb4cb9f0a3 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -127,7 +127,7 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade') // Les autres path if (! defined('FPDF_FONTPATH')) { define('FPDF_FONTPATH', FPDF_PATH . 'font/'); } if (! defined('MAGPIE_DIR')) { define('MAGPIE_DIR', MAGPIERSS_PATH); } - if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', DOL_DATA_ROOT .'/rsscache'); } + if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', DOL_DATA_ROOT .'/rss/temp'); } /*************************************************************************************** diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ea49990b2bf..b72f781059b 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -82,9 +82,13 @@ OtherBills=Other invoices DraftBills=Draft invoices Unpayed=Unpayed ConfirmDeleteBill=Are you sure you want to delete this invoice ? -ConfirmValidateBill=Are you sure you want to validate this invoice with reference %s ? -ConfirmClassifyPayedBill=Are you sure you want to change invoice %s to status payed ? -ConfirmCancelBill=Are you sure you want to cancel invoice %s ? +ConfirmValidateBill=Are you sure you want to validate this invoice with reference %s ? +ConfirmClassifyPayedBill=Are you sure you want to change invoice %s to status payed ? +ConfirmCancelBill=Are you sure you want to cancel invoice %s ? +ConfirmClassifyPayedPartially=Are you sure you want to change invoice %s to status payed ? +ConfirmClassifyPayedPartiallyquestion=This invoice has not been payed completely. What are reasons for you to close this invoice ? +ConfirmClassifyPayedPartiallyReasonEscompte=Remainder to pay (%s %s) is a discount granted because payment was made before term +ConfirmClassifyPayedPartiallyReasonOther=Other ValidateBill=Validate invoice NumberOfBills=Nb of invoices NumberOfBillsByMonth=Nb of invoices by month @@ -94,6 +98,7 @@ File=File AlreadyPayed=Already payed RemainderToPay=Remainder to pay RemainderToTake=Remainder to take +EscompteOffered=Discount offered (payment before term) CreateDraft=Create draft SendBillRef=Send invoice %s SendReminderBillRef=Send invoice %s (reminder) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 9850cef25dd..4fe0a82631d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -329,6 +329,7 @@ Undo=Undo Redo=Redo ExpandAll=Expand all UndoExpandAll=Undo expand +Reason=Raison # Countries CountryFR=France CountryBE=Belgium diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 77619cbb1c7..7a3e5e7c6b5 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -82,9 +82,13 @@ OtherBills=Autres factures DraftBills=Factures brouillons Unpayed=Impayées ConfirmDeleteBill=Êtes-vous sûr de vouloir supprimer cette facture ? -ConfirmValidateBill=Êtes-vous sûr de vouloir valider cette facture sous la référence %s ? -ConfirmClassifyPayedBill=Êtes-vous sûr de vouloir classer la facture %s comme payée ? -ConfirmCancelBill=Êtes-vous sûr de vouloir annuler la facture %s ? +ConfirmValidateBill=Êtes-vous sûr de vouloir valider cette facture sous la référence %s ? +ConfirmClassifyPayedBill=Êtes-vous sûr de vouloir classer la facture %s comme payée ? +ConfirmCancelBill=Êtes-vous sûr de vouloir annuler la facture %s ? +ConfirmClassifyPayedPartially=Êtes-vous sûr de vouloir classer la facture %s comme payée ? +ConfirmClassifyPayedPartiallyQuestion=Cette facture n'a pas été payée complètement. Pour quelle raison voulez-vous la classer magré tout ? +ConfirmClassifyPayedPartiallyReasonEscompte=Le reste à payer (%s %s) est un escompte accordé pour motif de paiement avant échéance +ConfirmClassifyPayedPartiallyReasonOther=Autre ValidateBill=Valider facture NumberOfBills=Nb de factures NumberOfBillsByMonth=Nb de factures par mois @@ -94,6 +98,7 @@ File=Fichier AlreadyPayed=Déjà réglé RemainderToPay=Reste à payer RemainderToTake=Reste à encaisser +EscompteOffered=Escompte (paiement avant échéance) CreateDraft=Créer brouillon SendBillRef=Envoi facture %s SendReminderBillRef=Relance facture %s diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index ab9877ba4c8..0f265dd2df8 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -329,6 +329,7 @@ Undo=Annuler Redo=Refaire ExpandAll=Tout dérouler UndoExpandAll=Annuler déroulement +Reason=Raison # Countries CountryFR=France CountryBE=Belgique diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php index f9c2ef322bc..59dd9e6f16a 100644 --- a/htdocs/livraison/livraison.class.php +++ b/htdocs/livraison/livraison.class.php @@ -238,22 +238,6 @@ class Livraison extends CommonObject $this->modelpdf = $obj->model_pdf; $this->db->free(); - if ($this->user_author_id) - { - $sql = "SELECT name, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE rowid = ".$this->user_author_id; - - $resqluser = $this->db->query($sql); - - if ($resqluser) - { - $obju = $this->db->fetch_object($resqluser); - $this->user_author_name = $obju->name; - $this->user_author_firstname = $obju->firstname; - } - } - if ($this->statut == 0) $this->brouillon = 1; $file = $conf->livraison->dir_output . "/" .get_exdir($livraison->id) . "/" . $this->id.".pdf"; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 90c04dd2307..062a884853e 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -170,7 +170,7 @@ if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', DOL_DOCUMEN // Les autres path if (! defined('FPDF_FONTPATH')) { define('FPDF_FONTPATH', FPDF_PATH . 'font/'); } if (! defined('MAGPIE_DIR')) { define('MAGPIE_DIR', MAGPIERSS_PATH); } -if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', DOL_DATA_ROOT .'/rsscache'); } +if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', $conf->externalrss->dir_temp); } // \todo Ajouter la ligne // require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php"); diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 16e8f16c38c..33b61a9af25 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -814,22 +814,6 @@ class Propal extends CommonObject } } - if ($this->user_author_id) - { - $sql = "SELECT name, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE rowid = ".$this->user_author_id; - - $resqluser = $this->db->query($sql); - - if ($resqluser) - { - $obju = $this->db->fetch_object($resqluser); - $this->user_author_name = $obju->name; - $this->user_author_firstname = $obju->firstname; - } - } - if ($obj->fk_statut == 0) { $this->brouillon = 1; diff --git a/htdocs/theme/eldy/eldy.css.php b/htdocs/theme/eldy/eldy.css.php index 0b5e7eb804e..abe29a44f1c 100644 --- a/htdocs/theme/eldy/eldy.css.php +++ b/htdocs/theme/eldy/eldy.css.php @@ -55,15 +55,15 @@ a:visited { font: verdana, arial, helvetica, sans-serif; font-weight: bold; colo a:active { font: verdana, arial, helvetica, sans-serif; font-weight: bold; color: #000000; text-decoration: none; } a:hover { font: verdana, arial, helvetica, sans-serif; font-weight: bold; color: #000000; text-decoration: none; } input -{ - font: 12px helvetica, verdana, arial, sans-serif; +{ + font: 12px helvetica, verdana, arial, sans-serif; background: #FDFDFD; border: 1px solid #ACBCBB; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; } input.flat -{ +{ font: 12px helvetica, verdana, arial, sans-serif; background: #FDFDFD; border: 1px solid #ACBCBB; @@ -78,7 +78,7 @@ textarea { margin: 0px 0px 0px 0px; } textarea.flat -{ +{ font: 12px helvetica, verdana, arial, sans-serif; background: #FDFDFD; border: 1px solid #ACBCBB; @@ -113,7 +113,7 @@ div.vmenuplusfiche top: auto; left: auto; position: static; - float: left; + float: left; display: block; margin-right: 6px; margin-left: 1px; @@ -163,9 +163,9 @@ div.tmenu font-weight: bold; font-size: 12px; height: 19px; - background: #b3c5cc; + background: #b3c5cc; background-image : url(); - color: #000000; + color: #000000; text-decoration: none; } @@ -193,7 +193,7 @@ a.tmenu:visited font-weight: bold; } a.tmenu#sel -{ +{ color: #234046; padding: 0px 8px 0px 8px; margin: 0px 0px 2px 0px; @@ -282,7 +282,7 @@ div.blockvmenupair border-right: 1px solid #555555; border-bottom: 1px solid #555555; font: helvetica, verdana, arial, sans-serif; - color: #000000; + color: #000000; text-align:left; text-decoration: none; padding: 3px; @@ -298,7 +298,7 @@ div.blockvmenuimpair border-right: 1px solid #555555; border-bottom: 1px solid #555555; font: helvetica, verdana, arial, sans-serif; - color: #000000; + color: #000000; text-align:left; text-decoration: none; padding: 3px; @@ -315,7 +315,7 @@ div.help border-bottom: 1px solid #000000; background: #f0f0f0; font: helvetica, verdana, arial, sans-serif; - color: #000000; + color: #000000; text-align:left; text-decoration: none; padding: 3px; @@ -323,23 +323,23 @@ div.help } -td.barre { +td.barre { border-right: 1px solid #000000; border-bottom: 1px solid #000000; background: #b3c5cc; font: helvetica, verdana, arial, sans-serif; - color: #000000; + color: #000000; text-align:left; text-decoration: none; } -td.barre_select { - background: #b3c5cc; +td.barre_select { + background: #b3c5cc; color: #000000; } td.photo { - background: #F4F4F4; + background: #F4F4F4; color: #000000; border: 1px solid #b3c5cc; } @@ -361,7 +361,7 @@ div.formsearch background: #d0d4d7; top: 0px; left: 130px; - padding: 4px; + padding: 4px; vertical-align: middle; margin-bottom: 10px; } @@ -414,7 +414,7 @@ div.onglet_inf font-weight:bold; font-size: 12px; height: 19px; - color: #000000; + color: #000000; text-decoration: none; } @@ -517,52 +517,52 @@ a.tabimage { a.butAction:link { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; - background: white; - border: 1px solid #8CACBB; - color: #436976; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; - white-space: nowrap; } - -a.butAction:visited { font: 12px helvetica, verdana, arial, sans-serif; - font-weight: bold; - background: white; - border: 1px solid #8CACBB; - color: #436976; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; - white-space: nowrap; } - -a.butAction:active { font: 12px helvetica, verdana, arial, sans-serif; - font-weight: bold; - background: white; - border: 1px solid #8CACBB; + background: white; + border: 1px solid #8CACBB; color: #436976; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; + padding: 0em 0.7em; + margin: 0em 0.5em; + text-decoration: none; white-space: nowrap; } -a.butAction:hover { font: 12px helvetica, verdana, arial, sans-serif; +a.butAction:visited { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; - background: #dee7ec; - border: 1px solid #8CACBB; - color: #436976; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; + background: white; + border: 1px solid #8CACBB; + color: #436976; + padding: 0em 0.7em; + margin: 0em 0.5em; + text-decoration: none; + white-space: nowrap; } + +a.butAction:active { font: 12px helvetica, verdana, arial, sans-serif; + font-weight: bold; + background: white; + border: 1px solid #8CACBB; + color: #436976; + padding: 0em 0.7em; + margin: 0em 0.5em; + text-decoration: none; + white-space: nowrap; } + +a.butAction:hover { font: 12px helvetica, verdana, arial, sans-serif; + font-weight: bold; + background: #dee7ec; + border: 1px solid #8CACBB; + color: #436976; + padding: 0em 0.7em; + margin: 0em 0.5em; + text-decoration: none; white-space: nowrap; } a.butActionRefuse { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; - background: white; - border: 1px solid red; - color: #436976; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; + background: white; + border: 1px solid red; + color: #436976; + padding: 0em 0.7em; + margin: 0em 0.5em; + text-decoration: none; white-space: nowrap; } a.butActionRefuse:hover { font: 12px helvetica, verdana, arial, sans-serif; @@ -572,12 +572,12 @@ a.butActionRefuse:hover { font: 12px helvetica, verdana, arial, sans-serif; a.butActionDelete { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; - background: white; - border: 1px solid red; - color: #436976; - padding: 0em 0.7em; - margin: 0em 0.5em; - text-decoration: none; + background: white; + border: 1px solid red; + color: #436976; + padding: 0em 0.7em; + margin: 0em 0.5em; + text-decoration: none; white-space: nowrap; } a.butActionDelete:link { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } @@ -592,13 +592,13 @@ a.tabAction:link { font: 12px helvetica, verdana, arial, sans-serif; font-wei a.tabAction:visited { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: white; border: 1px solid #8CACBB; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.tabAction:active { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: white; border: 1px solid #8CACBB; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.tabAction:hover { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: #dee7ec; border: 1px solid #8CACBB; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } - + a.butDelete:link { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butDelete:active { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butDelete:visited { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: white; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } a.butDelete:hover { font: 12px helvetica, verdana, arial, sans-serif; font-weight: bold; background: #FFe7ec; border: 1px solid #997777; color: #436976; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; } - + /* ============================================================================== */ /* Tables */ /* ============================================================================== */ @@ -659,7 +659,7 @@ border-collapse: collapse; width: 100%; } -tr.liste_titre { +tr.liste_titre { background: #7699A9; background-image : url(); color: #334444; @@ -668,7 +668,7 @@ font-weight: bold; border-bottom: 1px solid #FDFFFF; white-space: nowrap; } -td.liste_titre { +td.liste_titre { background: #7699A9; background-image : url(); color: #334444; @@ -678,29 +678,29 @@ border-bottom: 1px solid #FDFFFF; white-space: nowrap; } td.liste_titre_sel -{ +{ background: #7699A9; background-image : url(); -color: #F5FFFF; +color: #F5FFFF; font: helvetica, verdana, arial, sans-serif; -font-weight: bold; +font-weight: bold; border-bottom: 1px solid #FDFFFF; white-space: nowrap; } -input.liste_titre { +input.liste_titre { background: #7699A9; background-image : url(); border: 0px; } -tr.liste_total td { +tr.liste_total td { border-top: 1px solid #888888; background: #F4F4F4; font-weight: bold; white-space: nowrap; } -th { +th { background: #7699A9; color: #334444; font: helvetica, verdana, arial, sans-serif; @@ -712,32 +712,32 @@ border-bottom: 1px solid #FFFFFF; white-space: nowrap; } -td.border { +td.border { border-top: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; } -.pair { -background: #e6ebed; +.pair { +background: #e6ebed; font: helvetica, verdana, arial, sans-serif; border: 0px; } /* -.pair:hover { +.pair:hover { background: #c0c4c7; border: 0px; } */ -.impair { +.impair { background: #d0d4d7; font: helvetica, verdana, arial, sans-serif; border: 0px; } /* -.impair:hover { +.impair:hover { background: #c0c4c7; border: 0px; } @@ -746,7 +746,7 @@ border: 0px; /* * Boxes */ -tr.box_titre { +tr.box_titre { background: #7699A9; background-image : url(); color: #334444; @@ -756,17 +756,17 @@ border-bottom: 1px solid #FDFFFF; white-space: nowrap; } -tr.box_impair { +tr.box_impair { background: #e6ebed; font: 12px arial, helvetica, verdana, sans-serif; } -tr.box_pair { +tr.box_pair { background: #d0d4d7; font: 12px arial, helvetica, verdana, sans-serif; } -tr.fiche { +tr.fiche { font: helvetica, verdana, arial, sans-serif; } @@ -789,7 +789,7 @@ div.warning { } div.error { - color: #550000; font-weight: bold; + color: #550000; font-weight: bold; padding: 0.2em 0.2em 0.2em 0.2em; margin: 0.5em 0em 0.5em 0em; border: 1px solid #8C9CAB; @@ -807,7 +807,7 @@ div.info { * Liens Payes/Non payes */ -a.normal:link { font-weight: normal } +a.normal:link { font-weight: normal } a.normal:visited { font-weight: normal } a.normal:active { font-weight: normal } a.normal:hover { font-weight: normal } @@ -823,36 +823,49 @@ a.impayee:hover { font-weight: bold; color: #550000; } /* * Lignes titre espace */ -div.titre { +div.titre { font: helvetica, verdana, arial, sans-serif; - font-weight: bold; - color: #336666; + font-weight: bold; + color: #336666; text-decoration: none } /* ============================================================================== */ - * Formulaire confirmation +/* Formulaire confirmation */ /* ============================================================================== */ -td.validtitle { - font-weight: bold; - background: #EECC55; - } -td.valid { - background: #EECC55; - } +table.valid { + border-top: solid 1px #E6E6E6; + border-left: solid 1px #E6E6E6; + border-right: solid 1px #444444; + border-bottom: solid 1px #555555; + padding-top: 0px; + padding-left: 0px; + padding-right: 0px; + padding-bottom: 0px; + margin: 0px 0px; + background: #D5BAA8; +} + +.validtitre { + background: #D5BAA8; + font-weight: bold; +} + +.valid { +} -td.small { +td.small { font-size: 10px; } -tr.nonpayed { +tr.nonpayed { font-weight: bold; } -div.version { +div.version { background: #F4F4F4; text-align: right; font-size: 9px; @@ -880,13 +893,13 @@ z-index: 100; /* ============================================================================== */ /* Calendar */ /* ============================================================================== */ -.bodyline { +.bodyline { -moz-border-radius:8px; - border: 1px #E4ECEC outset; + border: 1px #E4ECEC outset; padding:0px; margin-bottom:5px; } -table.dp { +table.dp { width: 180px; background-color: #FFFFFF; border-top: solid 2px #DDDDDD; @@ -896,10 +909,10 @@ table.dp { } .dp td, .tpHour td, .tpMinute td{padding:2px; font-size:10px;} /* Barre titre */ -.dpHead,.tpHead,.tpHour td:Hover .tpHead{ +.dpHead,.tpHead,.tpHour td:Hover .tpHead{ font-weight:bold; background-color:#b3c5cc; - color:white; + color:white; font-size:11px; cursor:auto; } @@ -908,9 +921,9 @@ table.dp { text-align:center; background-color:#617389; color:#FFFFFF; - font-weight:bold; + font-weight:bold; border: 1px outset black; - cursor:pointer; + cursor:pointer; } .dpButtons:Active,.tpButtons:Active{border: 1px outset black;} .dpDayNames td,.dpExplanation {background-color:#D9DBE1; font-weight:bold; text-align:center; font-size:11px;} @@ -934,7 +947,7 @@ table.dp { .tpMinute td:Hover {background-color:black; color:white; } .tpMinute td {background-color:#D9DBE1; text-align:center; cursor:pointer;} -/* Bouton X fermer */ +/* Bouton X fermer */ .dpInvisibleButtons { border-style:none; @@ -944,7 +957,7 @@ font-size:9px; border-width:0px; color:#0B63A2; vertical-align:middle; -cursor: pointer; +cursor: pointer; } diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index 0f82ef022f2..cac8d917171 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -27,6 +27,8 @@ alter table llx_contrat add column note_public text after note; alter table llx_facture add column note_public text after note; alter table llx_facture add column remise_absolue real DEFAULT 0 after remise_percent; +alter table llx_facture add column close_code varchar(12) after remise; +alter table llx_facture add column close_note varchar(128) after close_code; alter table llx_propal add column note_public text after note; alter table llx_propal add column remise_absolue real DEFAULT 0 after remise_percent; diff --git a/mysql/tables/llx_facture.sql b/mysql/tables/llx_facture.sql index ffa07ac489f..7a93f6b9e0a 100644 --- a/mysql/tables/llx_facture.sql +++ b/mysql/tables/llx_facture.sql @@ -35,6 +35,10 @@ create table llx_facture remise_percent real DEFAULT 0, -- remise relative remise_absolue real DEFAULT 0, -- remise absolue remise real DEFAULT 0, -- remise totale calculee + + close_code varchar(12) after remise; -- Code motif cloture sans paiement complet + close_note varchar(128) after close_code; -- Commentaire cloture sans paiement complet + tva real DEFAULT 0, -- montant tva apres remise totale total real DEFAULT 0, -- montant total ht apres remise totale total_ttc real DEFAULT 0, -- montant total ttc apres remise totale