Look: Ajout picto statut sur les factures clients

This commit is contained in:
Laurent Destailleur 2006-03-19 00:39:12 +00:00
parent a728ad06fc
commit 096643cd27
6 changed files with 61 additions and 83 deletions

View File

@ -1285,7 +1285,9 @@ else
/*
* Liste des paiements
*/
print $langs->trans('Payments').' :<br>';
$totalpaye = 0;
print $langs->trans('Payments').' :<br>';
$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';
@ -1297,7 +1299,7 @@ else
if ($result)
{
$num = $db->num_rows($result);
$i = 0; $totalpaye = 0;
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Type').'</td>';
print '<td align="right">'.$langs->trans('Amount').'</td><td>&nbsp;</td></tr>';
@ -1369,7 +1371,8 @@ else
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Statut
print '<tr><td>'.$langs->trans('Status').'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>';
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td align="left" colspan="3">'.($fac->getLibStatut(4,$totalpaye)).'</td></tr>';
// Projet
if ($conf->projet->enabled)
@ -1681,7 +1684,7 @@ else
else
{
// Générer
if ($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer)
if ($fac->statut == 1 && $user->rights->facture->creer)
{
if ($fac->paye == 0)
{
@ -1998,7 +2001,7 @@ else
$month=$_GET['month'];
$year=$_GET['year'];
$fac=new Facture($db);
$facturestatic=new Facture($db);
if ($page == -1) $page = 0 ;
@ -2091,7 +2094,7 @@ else
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','','&amp;socidp='.$socidp,'align="right"',$sortfield);
print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','','&amp;socidp='.$socidp,'align="right"',$sortfield);
print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','','&amp;socidp='.$socidp,'align="right"',$sortfield);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye','','&amp;socidp='.$socidp,'align="right"',$sortfield);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','','&amp;socidp='.$socidp,'align="right"',$sortfield);
print '</tr>';
// Lignes des champs de filtre
@ -2124,22 +2127,6 @@ else
$var=!$var;
print '<tr '.$bc[$var].'>';
if ($objp->paye)
{
$class = 'normal';
}
else
{
if ($objp->fk_statut == 0)
{
$class = 'normal';
}
else
{
$class = 'impayee';
}
}
print '<td nowrap="nowrap"><a href="facture.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').'</a> ';
print '<a href="facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a>'.$objp->increment;
if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans('Late'));
@ -2166,26 +2153,10 @@ else
print '<td align="right">'.price($objp->am).'</td>';
// Affiche statut de la facture
if (! $objp->paye)
{
if ($objp->fk_statut == 0)
{
print '<td align="center">'.$langs->trans('BillShortStatusDraft').'</td>';
}
elseif ($objp->fk_statut == 3)
{
print '<td align="center">'.$langs->trans('BillShortStatusCanceled').'</td>';
}
else
{
print '<td align="center"><a class="'.$class.'" href="facture.php?filtre=paye:0,fk_statut:1">'.($objp->am?$langs->trans('BillShortStatusStarted'):$langs->trans('BillShortStatusNotPayed')).'</a></td>';
}
}
else
{
print '<td align="center">'.$langs->trans('BillShortStatusPayed').'</td>';
}
print '<td align="right" nowrap="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
print '</td>';
print '</tr>';
$total+=$objp->total;
$total_ttc+=$objp->total_ttc;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -22,9 +22,9 @@
*/
/**
\file htdocs/compta/facture.php
\file htdocs/compta/facture/imapyees.php
\ingroup facture
\brief Page de création d'une facture
\brief Page de liste des factures imapyées
\version $Revision$
*/
@ -153,7 +153,7 @@ if ($user->rights->facture->lire)
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&amp;socidp=$socidp",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&amp;socidp=$socidp",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&amp;socidp=$socidp",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","","&amp;socidp=$socidp",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&amp;socidp=$socidp",'align="right"',$sortfield);
print "</tr>\n";
// Lignes des champs de filtre
@ -175,6 +175,10 @@ if ($user->rights->facture->lire)
print "</tr>\n";
print '</form>';
$facturestatic=new Facture($db);
if ($num > 0)
{
$var=True;
@ -205,25 +209,9 @@ if ($user->rights->facture->lire)
print "<td align=\"right\">".price($objp->am)."</td>";
// Affiche statut de la facture
if (! $objp->paye)
{
if ($objp->fk_statut == 0)
{
print '<td align="center">'.$langs->trans("BillShortStatusDraft").'</td>';
}
elseif ($objp->fk_statut == 3)
{
print '<td align="center">'.$langs->trans("BillShortStatusCanceled").'</td>';
}
else
{
print '<td align="center"><a class="'.$class.'" href="'.$_SERVER["PHP_SELF"].'?filtre=paye:0,fk_statut:1">'.($objp->am?$langs->trans("BillShortStatusStarted"):$langs->trans("BillShortStatusNotPayed")).'</a></td>';
}
}
else
{
print '<td align="center">'.$langs->trans("BillShortStatusPayed").'</td>';
}
print '<td align="right" nowrap="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
print '</td>';
print "</tr>\n";
$total+=$objp->total;

View File

@ -1367,19 +1367,19 @@ class Facture
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
* \return string Libelle
*/
function getLibStatut($mode=0)
function getLibStatut($mode=0,$alreadypayed=-1)
{
return $this->LibStatut($this->paye,$this->statut,$mode);
return $this->LibStatut($this->paye,$this->statut,$mode,$alreadypayed);
}
/**
* \brief Renvoi le libellé d'un statut donné
* \param paye Etat paye
* \param statut Id statut
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
* \return string Libellé du statut
* \brief Renvoi le libellé d'un statut donné
* \param paye Etat paye
* \param statut Id statut
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
* \return string Libellé du statut
*/
function LibStatut($paye,$statut,$mode=0)
function LibStatut($paye,$statut,$mode=0,$alreadypayed=-1)
{
global $langs;
$langs->load('bills');
@ -1391,7 +1391,8 @@ class Facture
{
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if ($statut == 3) return $langs->trans('Bill'.$prefix.'StatusCanceled');
return $langs->trans('Bill'.$prefix.'StatusValidated');
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed');
return $langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
@ -1405,7 +1406,8 @@ class Facture
{
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if ($statut == 3) return $langs->trans('Bill'.$prefix.'StatusCanceled');
return $langs->trans('Bill'.$prefix.'StatusValidated');
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed');
return $langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
@ -1419,7 +1421,8 @@ class Facture
{
if ($statut == 0) return img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
if ($statut == 3) return img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
return img_picto($langs->trans('Bill'.$prefix.'StatusValidated'),'statut4').' '.$langs->trans('Bill'.$prefix.'StatusValidated');
if ($alreadypayed <= 0) return img_picto($langs->trans('Bill'.$prefix.'StatusNotPayed'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPayed');
return img_picto($langs->trans('Bill'.$prefix.'StatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
@ -1433,7 +1436,8 @@ class Facture
{
if ($statut == 0) return img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0');
if ($statut == 3) return img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5');
return img_picto($langs->trans('Bill'.$prefix.'StatusValidated'),'statut4');
if ($alreadypayed <= 0) return img_picto($langs->trans('Bill'.$prefix.'StatusNotPayed'),'statut1');
return img_picto($langs->trans('Bill'.$prefix.'StatusStarted'),'statut3');
}
else
{
@ -1442,16 +1446,31 @@ class Facture
}
if ($mode == 4)
{
$prefix='Short';
if (! $paye)
{
if ($statut == 0) return img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0');
if ($statut == 3) return img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5');
return img_picto($langs->trans('Bill'.$prefix.'StatusValidated'),'statut4');
if ($statut == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');
if ($statut == 3) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('BillStatusCanceled');
if ($alreadypayed <= 0) return img_picto($langs->trans('BillStatusNotPayed'),'statut1').' '.$langs->trans('BillStatusNotPayed');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted');
}
else
{
return img_picto($langs->trans('Bill'.$prefix.'StatusPayed'),'statut6');
return img_picto($langs->trans('BillStatusPayed'),'statut6').' '.$langs->trans('BillStatusPayed');
}
}
if ($mode == 5)
{
$prefix='Short';
if (! $paye)
{
if ($statut == 0) return $langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('Bill'.$prefix.'StatusDraft'),'statut0');
if ($statut == 3) return $langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('Bill'.$prefix.'StatusCanceled'),'statut5');
if ($alreadypayed <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPayed').' '.img_picto($langs->trans('Bill'.$prefix.'StatusValidated'),'statut1');
return $langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('Bill'.$prefix.'StatusStarted'),'statut3');
}
else
{
return $langs->trans('Bill'.$prefix.'StatusPayed').' '.img_picto($langs->trans('Bill'.$prefix.'StatusPayed'),'statut6');
}
}

View File

@ -45,7 +45,7 @@ BillStatusDraft=Brouillon (
BillStatusPayed=Payée
BillStatusCanceled=Abandonnée
BillStatusValidated=Validée (à payer)
BillStatusStarted=Commencée
BillStatusStarted=Paiement commencé
BillStatusNotPayed=Impayée
BillShortStatusDraft=Brouillon
BillShortStatusPayed=Payée

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 242 B