diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index d633ac15be6ea5f1a40eb68cf63e3e901c8eae01..4a98d1b47ae9f23065aa3b6690ca8557c75bb100 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -372,7 +372,7 @@ if ($_GET["propalid"]) print '<tr><td height=\"10\">'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($propal->total_ttc).'</td>'; print '<td>'.$conf->monnaie.'</td></tr>'; - print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.$propal->get_libstatut().'</td></tr>'; + print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.$propal->getLibStatut().'</td></tr>'; print "</table><br>"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index cdb4d5a30ac90111e0f23d3c2c24deb5dd6a7420..7ddceeea1b7211a98b48b7e0a0f18729be792f5a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -994,7 +994,7 @@ else print '<tr><td height=\"10\">'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($fac->total_ttc).'</td>'; print '<td>'.$conf->monnaie.'</td></tr>'; - print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->get_libstatut()).'</td></tr>'; + print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>'; if ($fac->note) { diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 26ea81db8ba0d1cee1e92919c3d8a3eecb50b851..5400f24909268e75a0d6e857b4e9101e8a691085 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -361,7 +361,7 @@ class Contrat * \brief Retourne le libell� du statut du contrat * \return string Libell� */ - function get_libstatut() + function getLibStatut() { return $this->LibStatut($this->statut); } diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 7d564443b856913fa02c746c425a56e33dbb1d1e..b9f0dc389d4b9770e25a6084c39ab2af6fd5a30e 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1062,29 +1062,20 @@ class Facture } } - /** - * \todo RODO - * - */ - function pdf() - { - - } - /** * \brief Retourne le libell� du statut d'une facture (brouillon, valid�e, abandonn�e, pay�e) * \return string Libell� */ - function get_libstatut() + function getLibStatut() { return $this->LibStatut($this->paye,$this->statut); } /** - * \brief Renvoi le libell� d'un statut donn� + * \brief Renvoi le libell� long d'un statut donn� * \param paye etat paye * \param statut id statut - * \return string Libell� + * \return string Libell� long du statut */ function LibStatut($paye,$statut) { @@ -1102,6 +1093,30 @@ class Facture } } + /** + * \brief Renvoi le libell� court d'un statut donn� + * \param paye etat paye + * \param statut id statut + * \param amount amount already payed + * \return string Libell� court du statut + */ + function PayedLibStatut($paye,$statut,$amount=0) + { + global $langs; + $langs->load("bills"); + if (! $paye) + { + if ($statut == 0) return $langs->trans("BillShortStatusDraft"); + if ($statut == 3) return $langs->trans("BillStatusCanceled"); + if ($amount) return $langs->trans("BillStatusStarted"); + return $langs->trans("BillStatusNotPayed"); + } + else + { + return $langs->trans("BillStatusPayed"); + } + } + /** * \brief Mets � jour les commentaires diff --git a/htdocs/facturefourn.class.php b/htdocs/facturefourn.class.php index 3c73fa4c8114b33b7f527d162b52aa6883c3c440..80c0baeebe017426f073aac4b3667903748a88d3 100644 --- a/htdocs/facturefourn.class.php +++ b/htdocs/facturefourn.class.php @@ -22,15 +22,17 @@ * */ -/*! \file htdocs/facturefourn.class.php +/** + \file htdocs/facturefourn.class.php \ingroup facture \brief Fichier de la classe des factures fournisseurs \version $Revision$ */ -/*! \class FactureFourn - \brief Classe permettant la gestion des factures fournisseurs +/** + \class FactureFourn + \brief Classe permettant la gestion des factures fournisseurs */ class FactureFourn @@ -39,6 +41,8 @@ class FactureFourn var $db; var $socid; var $number; + var $statut; + var $paye; var $author; var $libelle; var $date; @@ -422,19 +426,21 @@ class FactureFourn } } + /** - * \todo RODO - * + * \brief Retourne le libell� du statut d'une facture (brouillon, valid�e, abandonn�e, pay�e) + * \return string Libell� */ - function pdf() + function getLibStatut() { - + return $this->LibStatut($this->paye,$this->statut); } /** - * \brief Renvoi un libell� du statut - * \param paye etat paye - * \param statut id statut + * \brief Renvoi le libell� long d'un statut donn� + * \param paye etat paye + * \param statut id statut + * \return string Libell� long du statut */ function LibStatut($paye,$statut) { @@ -451,6 +457,30 @@ class FactureFourn return $langs->trans("BillStatusPayed"); } } + + /** + * \brief Renvoi le libell� court d'un statut donn� + * \param paye etat paye + * \param statut id statut + * \param amount amount already payed + * \return string Libell� court du statut + */ + function PayedLibStatut($paye,$statut,$amount=0) + { + global $langs; + $langs->load("bills"); + if (! $paye) + { + if ($statut == 0) return $langs->trans("BillShortStatusDraft"); + if ($statut == 3) return $langs->trans("BillStatusCanceled"); + if ($amount) return $langs->trans("BillStatusStarted"); + return $langs->trans("BillStatusNotPayed"); + } + else + { + return $langs->trans("BillStatusPayed"); + } + } } ?> diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index a2d0f77a94f3595aa361742f26d795fb1281bb0d..dbbfd83c9158e34b91d78122b22f3f8f0df53b27 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -21,7 +21,8 @@ * */ -/** \file htdocs/fourn/facture/index.php +/** + \file htdocs/fourn/facture/index.php \ingroup fournisseur,facture \brief Lsite des factures fournisseurs \version $Revision$ @@ -53,14 +54,16 @@ if ($_GET["action"] == 'delete') } $page=$_GET["page"]; -$sortorder=$_GET["sortorder"]; -$sortfield=$_GET["sortfield"]; - +$sortorder = $_GET["sortorder"]; +$sortfield = $_GET["sortfield"]; + if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="fac.datef"; /* @@ -91,20 +94,7 @@ if ($_POST["mode"] == 'search') * */ -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; - -if ($sortorder == "") -{ - $sortorder="DESC"; -} -if ($sortfield == "") -{ - $sortfield="fac.datef"; -} - - -$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid, fac.facnumber"; +$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid, fac.facnumber"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac "; $sql .= " WHERE fac.fk_soc = s.idp"; @@ -153,7 +143,7 @@ $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; if ($socid) { @@ -195,22 +185,23 @@ if ($result) print "</tr>\n"; print '</form>'; - $var=True; + $fac = new FactureFourn($db); + + $var=true; while ($i < min($num,$limit)) { $obj = $db->fetch_object(); $var=!$var; print "<tr $bc[$var]>"; - print "<td><a href=\"fiche.php?facid=$obj->facid\">".img_object($langs->trans("ShowBill"),"bill")."</a>\n"; - print " <a href=\"fiche.php?facid=$obj->facid\">$obj->facnumber</a></td>\n"; - print "<td>".strftime("%d %b %Y",$obj->datef)."</td>\n"; + print "<td nowrap><a href=\"fiche.php?facid=$obj->facid\">".img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber."</a></td>\n"; + print "<td nowrap>".strftime("%d %b %Y",$obj->datef)."</td>\n"; print '<td>'.stripslashes("$obj->libelle").'</td>'; print '<td>'; - print '<a href="../fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>'; - print ' <a href="../fiche.php?socid='.$obj->socid.'">'.$obj->nom.'</a</td>'; + print '<a href="../fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.$obj->nom.'</a</td>'; print '<td align="right">'.price($obj->total_ht).'</td>'; print '<td align="right">'.price($obj->total_ttc).'</td>'; + // Affiche statut de la facture if ($obj->paye) { @@ -227,28 +218,33 @@ if ($result) $class = "impayee"; } } - if (! $obj->paye) + + print '<td align="center">'; + if (! $obj->paye) + { + if ($obj->fk_statut == 0) { - if ($obj->fk_statut == 0) - { - print '<td align="center">brouillon</td>'; - } - elseif ($obj->fk_statut == 3) - { - print '<td align="center">annul�e</td>'; - } - else - { - print '<td align="center"><a class="'.$class.'" href=""index.php?filtre=paye:0,fk_statut:1">'.($obj->am?"commenc�":"impay�e").'</a></td>'; - } + print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); + } + elseif ($obj->fk_statut == 3) + { + print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); } else { - print '<td align="center">pay�e</td>'; + // \todo le montant deja pay� obj->am n'est pas d�finie + print '<a class="'.$class.'" href=""index.php?filtre=paye:0,fk_statut:1">'.($fac->PayedLibStatut($obj->paye,$obj->fk_statut,$obj->am)).'</a>'; } + } + else + { + print $fac->PayedLibStatut($obj->paye,$obj->fk_statut); + } + print '</td>'; - print "</tr>\n"; - $i++; + print "</tr>\n"; + $i++; + } print "</table>"; $db->free(); diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index cca7be2c41f935038767b98506a5384e2a640ce4..22d900466ad7c518e732be947a84ad56c01ea2f3 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -845,7 +845,7 @@ class Propal * \brief Retourne le libell� du statut d'une propale (brouillon, valid�e, ...) * \return string Libell� */ - function get_libstatut() + function getLibStatut() { return $this->LibStatut($this->statut); }