From 096643cd273748b755b2b87abdf992d736f5f5a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Mar 2006 00:39:12 +0000 Subject: [PATCH] Look: Ajout picto statut sur les factures clients --- htdocs/compta/facture.php | 55 +++++++---------------------- htdocs/compta/facture/impayees.php | 34 ++++++------------ htdocs/facture.class.php | 53 ++++++++++++++++++--------- htdocs/langs/fr_FR/bills.lang | 2 +- htdocs/theme/eldy/img/statut1.png | Bin 199 -> 201 bytes htdocs/theme/eldy/img/statut3.png | Bin 239 -> 242 bytes 6 files changed, 61 insertions(+), 83 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9920929cfa8..32d3023185a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1285,7 +1285,9 @@ else /* * Liste des paiements */ - print $langs->trans('Payments').' :
'; + $totalpaye = 0; + + print $langs->trans('Payments').' :
'; $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 ''; print ''; print ''; @@ -1369,7 +1371,8 @@ else print ''; // Statut - print ''; + print ''; + print ''; // 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','','&socidp='.$socidp,'align="right"',$sortfield); print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','','&socidp='.$socidp,'align="right"',$sortfield); print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','','&socidp='.$socidp,'align="right"',$sortfield); - print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye','','&socidp='.$socidp,'align="right"',$sortfield); + print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','','&socidp='.$socidp,'align="right"',$sortfield); print ''; // Lignes des champs de filtre @@ -2124,22 +2127,6 @@ else $var=!$var; print ''; - if ($objp->paye) - { - $class = 'normal'; - } - else - { - if ($objp->fk_statut == 0) - { - $class = 'normal'; - } - else - { - $class = 'impayee'; - } - } - print ''; // Affiche statut de la facture - if (! $objp->paye) - { - if ($objp->fk_statut == 0) - { - print ''; - } - elseif ($objp->fk_statut == 3) - { - print ''; - } - else - { - print ''; - } - } - else - { - print ''; - } - + print ''; + print ''; $total+=$objp->total; $total_ttc+=$objp->total_ttc; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 9ec3643f57c..5251ac35da3 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Éric Seigne - * Copyright (C) 2004-2005 Laurent Destailleur + * 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 @@ -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","","&socidp=$socidp",'align="right"',$sortfield); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socidp=$socidp",'align="right"',$sortfield); print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socidp=$socidp",'align="right"',$sortfield); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","","&socidp=$socidp",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socidp=$socidp",'align="right"',$sortfield); print "\n"; // Lignes des champs de filtre @@ -175,6 +175,10 @@ if ($user->rights->facture->lire) print "\n"; print ''; + + $facturestatic=new Facture($db); + + if ($num > 0) { $var=True; @@ -205,25 +209,9 @@ if ($user->rights->facture->lire) print ""; // Affiche statut de la facture - if (! $objp->paye) - { - if ($objp->fk_statut == 0) - { - print ''; - } - elseif ($objp->fk_statut == 3) - { - print ''; - } - else - { - print ''; - } - } - else - { - print ''; - } + print ''; print "\n"; $total+=$objp->total; diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 075add34491..cf04e77fcb5 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -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'); } } diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index c9ba651102c..392019760c3 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -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 diff --git a/htdocs/theme/eldy/img/statut1.png b/htdocs/theme/eldy/img/statut1.png index 440a33533c6f9dc9a3b941ffd981593a521d172c..3e4650f4f02c6f7db52a9f4a186d929c3eb7b384 100644 GIT binary patch delta 85 zcmX@kc#?5KFo!UMu-W2Q%oY=)b)0lPT^vI+&L`WHEO=|r%-PV|*x2Y8e!flP=yZMA o#DpXT!JaG$8L5Z_Lk}GWhR~xNJ*{8%s4@V7r>mdKI;Vst0Nc78VE_OC delta 83 zcmX@fc${%UFo%G+DVwk1s?`&tbsV%kT^vIyZYB5hZ~t@Nfhi#|At7PLh4+qA9yJ}3 nB-FSU6q~n>m!?a3_#%N>gTe~DWM4f9g-eU diff --git a/htdocs/theme/eldy/img/statut3.png b/htdocs/theme/eldy/img/statut3.png index 305325a1f9bb56e4a696132f4b42213ba45d9b84..3da79f63501834cc0c0e1ac963b6744d47c8929a 100644 GIT binary patch delta 167 zcmaFQ_=$0Xmf?Q}AY8C_`D6wL2F?PH$YKTt-s=nud`B1+8&fs|1=&kHeO=kFF$*&Y zn_4{%YML0WlO5*i;uxZFJ~?Jj;=y`0AqH+{X6ELGJqC`gW}p7>MDyKEPEa})B3)T$ zF}qXbD2wR=?PIGMXD7{(D$qQ(igA7t4{wXe;tT~h!x-j`T@MZSKD}VO$P{RCH;;_| TYM;YETNylE{an^LB{Ts5>l``Z delta 164 zcmV;V09*g^0q+5jDly;y1po!7HcG?*000SaNLh0L01ejw01m_fA%SGG00007bV*G` z2i5}-7b7e(uCdRNTP$c(NklQOHOw*hFE2~|Wp8`-m}@($(*HiIu-1|vKTW_TE^@Gr1%7kKa!crieVzQzq=A`an= S!)`
'.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('Amount').' 
'.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('Status').''.($fac->getLibStatut()).'
'.$langs->trans('Status').''.($fac->getLibStatut(4,$totalpaye)).'
'.img_object($langs->trans('ShowBill'),'bill').' '; print ''.$objp->facnumber.''.$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 ''.price($objp->am).''.$langs->trans('BillShortStatusDraft').''.$langs->trans('BillShortStatusCanceled').''.($objp->am?$langs->trans('BillShortStatusStarted'):$langs->trans('BillShortStatusNotPayed')).''.$langs->trans('BillShortStatusPayed').''; + print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); + print '
".price($objp->am)."'.$langs->trans("BillShortStatusDraft").''.$langs->trans("BillShortStatusCanceled").''.($objp->am?$langs->trans("BillShortStatusStarted"):$langs->trans("BillShortStatusNotPayed")).''.$langs->trans("BillShortStatusPayed").''; + print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); + print '