Look: Ajout picto sur charges sociales
This commit is contained in:
parent
d2ac095945
commit
726b01933e
@ -138,7 +138,9 @@ class ChargeSociales {
|
||||
var $paye;
|
||||
var $periode;
|
||||
|
||||
function ChargeSociales($DB) {
|
||||
|
||||
function ChargeSociales($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
|
||||
return 1;
|
||||
@ -223,17 +225,61 @@ class ChargeSociales {
|
||||
$return = $this->db->query( $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut d'une charge (impayé, payée)
|
||||
* \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)
|
||||
{
|
||||
return $this->LibStatut($this->paye,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le staut de la charge sous forme de libellé
|
||||
* \return string libellé du statut
|
||||
*/
|
||||
function getLibStatut() {
|
||||
global $langs;
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \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($statut,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpayed");
|
||||
if ($statut == 1) return $langs->trans("Payed");
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpayed");
|
||||
if ($statut == 1) return $langs->trans("Payed");
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans("Unpayed"), 'statut1').' '.$langs->trans("Unpayed");
|
||||
if ($statut == 1) return img_picto($langs->trans("Payed"), 'statut6').' '.$langs->trans("Payed");
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans("Unpayed"), 'statut1');
|
||||
if ($statut == 1) return img_picto($langs->trans("Payed"), 'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0) return img_picto($langs->trans("Unpayed"), 'statut1').' '.$langs->trans("Unpayed");
|
||||
if ($statut == 1) return img_picto($langs->trans("Payed"), 'statut6').' '.$langs->trans("Payed");
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpayed").' '.img_picto($langs->trans("Unpayed"), 'statut1');
|
||||
if ($statut == 1) return $langs->trans("Payed").' '.img_picto($langs->trans("Payed"), 'statut6');
|
||||
}
|
||||
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
|
||||
if ($this->paye == 0) { return $langs->trans("Unpayed"); }
|
||||
else { return $langs->trans("Payed"); }
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -27,8 +27,9 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
require("./pre.inc.php");
|
||||
require(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
|
||||
|
||||
|
||||
$user->getrights('facture');
|
||||
$user->getrights('compta');
|
||||
@ -213,48 +214,46 @@ else {
|
||||
}
|
||||
|
||||
|
||||
$chargesociale_static=new ChargeSociales($db);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="60">';
|
||||
print '<a href="charges.php?id='.$obj->id.'">'.img_file().' '.$obj->id.'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="110">'.dolibarr_print_date($obj->de).'</td>';
|
||||
print '<td>';
|
||||
if ($obj->periode) {
|
||||
print '<a href="index.php?year='.strftime("%Y",$obj->periode).'">'.strftime("%Y",$obj->periode).'</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$obj->type_lib.'</td><td>'.dolibarr_trunc($obj->libelle,36).'</td>';
|
||||
print '<td align="right" width="100">'.price($obj->amount).'</td>';
|
||||
|
||||
if ($obj->paye)
|
||||
while ($i < $num)
|
||||
{
|
||||
print '<td align="center" class="normal"><a class="payee" href="index.php?filtre=paye:1">Payé</a></td>';
|
||||
} else {
|
||||
print '<td align="center"><a class="impayee" href="index.php?filtre=paye:0">Impayé</a></td>';
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="60">';
|
||||
print '<a href="charges.php?id='.$obj->id.'">'.img_file().' '.$obj->id.'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="110">'.dolibarr_print_date($obj->de).'</td>';
|
||||
print '<td>';
|
||||
if ($obj->periode) {
|
||||
print '<a href="index.php?year='.strftime("%Y",$obj->periode).'">'.strftime("%Y",$obj->periode).'</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$obj->type_lib.'</td><td>'.dolibarr_trunc($obj->libelle,36).'</td>';
|
||||
print '<td align="right" width="100">'.price($obj->amount).'</td>';
|
||||
|
||||
print '<td align="right" nowrap="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5).'</a></td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user