Look: Ajout picto sur charges sociales
This commit is contained in:
parent
d2ac095945
commit
726b01933e
@ -138,7 +138,9 @@ class ChargeSociales {
|
|||||||
var $paye;
|
var $paye;
|
||||||
var $periode;
|
var $periode;
|
||||||
|
|
||||||
function ChargeSociales($DB) {
|
|
||||||
|
function ChargeSociales($DB)
|
||||||
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -223,17 +225,61 @@ class ChargeSociales {
|
|||||||
$return = $this->db->query( $sql);
|
$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é
|
* \brief Renvoi le libellé d'un statut donné
|
||||||
* \return string libellé du statut
|
* \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
|
||||||
function getLibStatut() {
|
* \return string Libellé du statut
|
||||||
global $langs;
|
*/
|
||||||
|
function LibStatut($statut,$mode=0)
|
||||||
if ($this->paye == 0) { return $langs->trans("Unpayed"); }
|
{
|
||||||
else { return $langs->trans("Payed"); }
|
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$
|
* $Source$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/sociales/index.php
|
\file htdocs/compta/sociales/index.php
|
||||||
\ingroup compta
|
\ingroup compta
|
||||||
\brief Ecran des charges sociales
|
\brief Ecran des charges sociales
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
|
||||||
|
|
||||||
|
|
||||||
$user->getrights('facture');
|
$user->getrights('facture');
|
||||||
$user->getrights('compta');
|
$user->getrights('compta');
|
||||||
@ -47,7 +48,7 @@ if ($page < 0) $page = 0;
|
|||||||
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
if (! $sortfield) $sortfield="c.id";
|
if (! $sortfield) $sortfield="c.id";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
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 = "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"]."');";
|
$sql .= " VALUES (".$_POST["type"].",'".addslashes($_POST["libelle"])."','".$_POST["date"]."','".$_POST["periode"]."','".$_POST["amount"]."');";
|
||||||
|
|
||||||
if (! $db->query($sql) )
|
if (! $db->query($sql) )
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
@ -140,17 +141,17 @@ if ($user->rights->compta->charges->creer) {
|
|||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td><input type="text" size="8" name="date"><br>YYYYMMDD</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><input type="text" size="8" name="periode"><br>YYYYMMDD</td>';
|
||||||
|
|
||||||
print '<td align="left"><select name="type">';
|
print '<td align="left"><select name="type">';
|
||||||
|
|
||||||
$sql = "SELECT c.id, c.libelle as type FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql = "SELECT c.id, c.libelle as type FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql .= " ORDER BY lower(c.libelle) ASC";
|
$sql .= " ORDER BY lower(c.libelle) ASC";
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object();
|
||||||
@ -162,7 +163,7 @@ if ($user->rights->compta->charges->creer) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="left"><input type="text" size="34" name="libelle"></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="right"><input type="text" size="6" name="amount"></td>';
|
||||||
|
|
||||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ if ($filtre) {
|
|||||||
$sql .= " AND $filtre";
|
$sql .= " AND $filtre";
|
||||||
}
|
}
|
||||||
if ($_GET["sortfield"]) {
|
if ($_GET["sortfield"]) {
|
||||||
$sql .= " ORDER BY ".$_GET["sortfield"];
|
$sql .= " ORDER BY ".$_GET["sortfield"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql .= " ORDER BY lower(s.date_ech)";
|
$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();
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
while ($i < $num)
|
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)
|
|
||||||
{
|
{
|
||||||
print '<td align="center" class="normal"><a class="payee" href="index.php?filtre=paye:1">Payé</a></td>';
|
$obj = $db->fetch_object($resql);
|
||||||
} else {
|
|
||||||
print '<td align="center"><a class="impayee" href="index.php?filtre=paye:0">Impayé</a></td>';
|
$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>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user