Trad: Traduction de status de factures

This commit is contained in:
Laurent Destailleur 2005-03-15 17:12:46 +00:00
parent 5b87725257
commit 3ecd4b1ddb
7 changed files with 108 additions and 67 deletions

View File

@ -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 '<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 '<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>"; print "</table><br>";

View File

@ -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 '<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 '<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) if ($fac->note)
{ {

View File

@ -361,7 +361,7 @@ class Contrat
* \brief Retourne le libellé du statut du contrat * \brief Retourne le libellé du statut du contrat
* \return string Libellé * \return string Libellé
*/ */
function get_libstatut() function getLibStatut()
{ {
return $this->LibStatut($this->statut); return $this->LibStatut($this->statut);
} }

View File

@ -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) * \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
* \return string Libellé * \return string Libellé
*/ */
function get_libstatut() function getLibStatut()
{ {
return $this->LibStatut($this->paye,$this->statut); 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 paye etat paye
* \param statut id statut * \param statut id statut
* \return string Libellé * \return string Libellé long du statut
*/ */
function LibStatut($paye,$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 * \brief Mets à jour les commentaires

View File

@ -22,15 +22,17 @@
* *
*/ */
/*! \file htdocs/facturefourn.class.php /**
\file htdocs/facturefourn.class.php
\ingroup facture \ingroup facture
\brief Fichier de la classe des factures fournisseurs \brief Fichier de la classe des factures fournisseurs
\version $Revision$ \version $Revision$
*/ */
/*! \class FactureFourn /**
\brief Classe permettant la gestion des factures fournisseurs \class FactureFourn
\brief Classe permettant la gestion des factures fournisseurs
*/ */
class FactureFourn class FactureFourn
@ -39,6 +41,8 @@ class FactureFourn
var $db; var $db;
var $socid; var $socid;
var $number; var $number;
var $statut;
var $paye;
var $author; var $author;
var $libelle; var $libelle;
var $date; var $date;
@ -422,19 +426,21 @@ class FactureFourn
} }
} }
/**
* \todo RODO
*
*/
function pdf()
{
/**
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
* \return string Libellé
*/
function getLibStatut()
{
return $this->LibStatut($this->paye,$this->statut);
} }
/** /**
* \brief Renvoi un libellé du statut * \brief Renvoi le libellé long d'un statut donné
* \param paye etat paye * \param paye etat paye
* \param statut id statut * \param statut id statut
* \return string Libellé long du statut
*/ */
function LibStatut($paye,$statut) function LibStatut($paye,$statut)
{ {
@ -452,5 +458,29 @@ class FactureFourn
} }
} }
/**
* \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");
}
}
} }
?> ?>

View File

@ -21,7 +21,8 @@
* *
*/ */
/** \file htdocs/fourn/facture/index.php /**
\file htdocs/fourn/facture/index.php
\ingroup fournisseur,facture \ingroup fournisseur,facture
\brief Lsite des factures fournisseurs \brief Lsite des factures fournisseurs
\version $Revision$ \version $Revision$
@ -53,14 +54,16 @@ if ($_GET["action"] == 'delete')
} }
$page=$_GET["page"]; $page=$_GET["page"];
$sortorder=$_GET["sortorder"]; $sortorder = $_GET["sortorder"];
$sortfield=$_GET["sortfield"]; $sortfield = $_GET["sortfield"];
if ($page == -1) { $page = 0 ; } if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $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"]; $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";
$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 .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac ";
$sql .= " WHERE fac.fk_soc = s.idp"; $sql .= " WHERE fac.fk_soc = s.idp";
@ -153,7 +143,7 @@ $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows(); $num = $db->num_rows($result);
$i = 0; $i = 0;
if ($socid) { if ($socid) {
@ -195,22 +185,23 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
print '</form>'; print '</form>';
$var=True; $fac = new FactureFourn($db);
$var=true;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td><a href=\"fiche.php?facid=$obj->facid\">".img_object($langs->trans("ShowBill"),"bill")."</a>\n"; print "<td nowrap><a href=\"fiche.php?facid=$obj->facid\">".img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber."</a></td>\n";
print " <a href=\"fiche.php?facid=$obj->facid\">$obj->facnumber</a></td>\n"; print "<td nowrap>".strftime("%d %b %Y",$obj->datef)."</td>\n";
print "<td>".strftime("%d %b %Y",$obj->datef)."</td>\n";
print '<td>'.stripslashes("$obj->libelle").'</td>'; print '<td>'.stripslashes("$obj->libelle").'</td>';
print '<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.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.$obj->nom.'</a</td>';
print '&nbsp;<a href="../fiche.php?socid='.$obj->socid.'">'.$obj->nom.'</a</td>';
print '<td align="right">'.price($obj->total_ht).'</td>'; print '<td align="right">'.price($obj->total_ht).'</td>';
print '<td align="right">'.price($obj->total_ttc).'</td>'; print '<td align="right">'.price($obj->total_ttc).'</td>';
// Affiche statut de la facture // Affiche statut de la facture
if ($obj->paye) if ($obj->paye)
{ {
@ -227,28 +218,33 @@ if ($result)
$class = "impayee"; $class = "impayee";
} }
} }
if (! $obj->paye)
print '<td align="center">';
if (! $obj->paye)
{
if ($obj->fk_statut == 0)
{ {
if ($obj->fk_statut == 0) print $fac->PayedLibStatut($obj->paye,$obj->fk_statut);
{ }
print '<td align="center">brouillon</td>'; elseif ($obj->fk_statut == 3)
} {
elseif ($obj->fk_statut == 3) print $fac->PayedLibStatut($obj->paye,$obj->fk_statut);
{
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>';
}
} }
else 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>"; print "</table>";
$db->free(); $db->free();

View File

@ -845,7 +845,7 @@ class Propal
* \brief Retourne le libellé du statut d'une propale (brouillon, validée, ...) * \brief Retourne le libellé du statut d'une propale (brouillon, validée, ...)
* \return string Libellé * \return string Libellé
*/ */
function get_libstatut() function getLibStatut()
{ {
return $this->LibStatut($this->statut); return $this->LibStatut($this->statut);
} }