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;
|
||||
|
||||
if ($this->paye == 0) { return $langs->trans("Unpayed"); }
|
||||
else { return $langs->trans("Payed"); }
|
||||
}
|
||||
/**
|
||||
* \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";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -20,15 +20,16 @@
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
\file htdocs/compta/sociales/index.php
|
||||
\ingroup compta
|
||||
\brief Ecran des charges sociales
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
require("./pre.inc.php");
|
||||
require(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
|
||||
|
||||
|
||||
$user->getrights('facture');
|
||||
$user->getrights('compta');
|
||||
@ -47,7 +48,7 @@ if ($page < 0) $page = 0;
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
if (! $sortfield) $sortfield="c.id";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
@ -65,7 +66,7 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount) ";
|
||||
$sql .= " VALUES (".$_POST["type"].",'".addslashes($_POST["libelle"])."','".$_POST["date"]."','".$_POST["periode"]."','".$_POST["amount"]."');";
|
||||
|
||||
|
||||
if (! $db->query($sql) )
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
@ -140,17 +141,17 @@ if ($user->rights->compta->charges->creer) {
|
||||
print '<td> </td>';
|
||||
print '<td><input type="text" size="8" name="date"><br>YYYYMMDD</td>';
|
||||
print '<td><input type="text" size="8" name="periode"><br>YYYYMMDD</td>';
|
||||
|
||||
|
||||
print '<td align="left"><select name="type">';
|
||||
|
||||
|
||||
$sql = "SELECT c.id, c.libelle as type FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= " ORDER BY lower(c.libelle) ASC";
|
||||
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
@ -162,7 +163,7 @@ if ($user->rights->compta->charges->creer) {
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="text" size="34" name="libelle"></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="amount"></td>';
|
||||
|
||||
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -200,7 +201,7 @@ if ($filtre) {
|
||||
$sql .= " AND $filtre";
|
||||
}
|
||||
if ($_GET["sortfield"]) {
|
||||
$sql .= " ORDER BY ".$_GET["sortfield"];
|
||||
$sql .= " ORDER BY ".$_GET["sortfield"];
|
||||
}
|
||||
else {
|
||||
$sql .= " ORDER BY lower(s.date_ech)";
|
||||
@ -213,54 +214,52 @@ 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>';
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user