Fix: Partial payment on social contributions not shown on main page.
New: Can filter on social contribution type in list.
This commit is contained in:
parent
05a48da313
commit
8476a218e5
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -59,9 +59,10 @@ print "<td align=\"right\">".$langs->trans("Amount")."</td>";
|
|||||||
print "<td align=\"right\">".$langs->trans("AlreadyPayed")."</td>";
|
print "<td align=\"right\">".$langs->trans("AlreadyPayed")."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT c.libelle as lib, s.fk_type as type,";
|
$sql = "SELECT c.id, c.libelle as lib, s.fk_type as type,";
|
||||||
$sql.=" count(s.rowid) as nb, sum(s.amount) as total, sum(IF(paye=1,s.amount,0)) as totalpaye";
|
$sql.=" count(s.rowid) as nb, sum(s.amount) as total, sum(pc.amount) as totalpaye";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = s.rowid";
|
||||||
$sql.= " WHERE s.fk_type = c.id";
|
$sql.= " WHERE s.fk_type = c.id";
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
{
|
{
|
||||||
@ -72,8 +73,10 @@ if ($year > 0)
|
|||||||
$sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = $year)";
|
$sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = $year)";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY c.libelle ASC";
|
$sql.= " GROUP BY c.id, c.libelle, s.fk_type";
|
||||||
|
$sql.= " ORDER BY c.libelle ASC";
|
||||||
|
|
||||||
|
dol_syslog("compta/charges/index.php: select payment sql=".$sql);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,6 +45,9 @@ $offset = $conf->liste_limit * $page ;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -67,11 +70,6 @@ if ($action == 'note')
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Recherche
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($mode == 'search') {
|
if ($mode == 'search') {
|
||||||
if ($mode-search == 'soc') {
|
if ($mode-search == 'soc') {
|
||||||
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
|
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,11 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/sociales/index.php
|
* \file htdocs/compta/sociales/index.php
|
||||||
\ingroup tax
|
* \ingroup tax
|
||||||
\brief Ecran des charges sociales
|
* \brief Ecran des charges sociales
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
|
require(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
|
||||||
@ -50,7 +50,20 @@ $limit = $conf->liste_limit;
|
|||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
//if (! $year) { $year=date("Y", time()); }
|
//if (! $year) { $year=date("Y", time()); }
|
||||||
|
|
||||||
|
if (empty($_REQUEST['typeid']))
|
||||||
|
{
|
||||||
|
$newfiltre=eregi_replace('filtre=','',$filtre);
|
||||||
|
$filterarray=split('-',$newfiltre);
|
||||||
|
foreach($filterarray as $val)
|
||||||
|
{
|
||||||
|
$part=split(':',$val);
|
||||||
|
if ($part[0] == 's.fk_type') $typeid=$part[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$typeid=$_REQUEST['typeid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -59,6 +72,8 @@ $offset = $limit * $page ;
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
$html = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT s.rowid as id, s.fk_type as type, ";
|
$sql = "SELECT s.rowid as id, s.fk_type as type, ";
|
||||||
$sql.= " s.amount,".$db->pdate("s.date_ech")." as de, s.libelle, s.paye,".$db->pdate("s.periode")." as periode,";
|
$sql.= " s.amount,".$db->pdate("s.date_ech")." as de, s.libelle, s.paye,".$db->pdate("s.periode")." as periode,";
|
||||||
@ -68,15 +83,18 @@ $sql.= " WHERE s.fk_type = c.id";
|
|||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND (";
|
$sql .= " AND (";
|
||||||
// Si period renseign<EFBFBD> on l'utilise comme critere de date, sinon on prend date <20>ch<63>ance,
|
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||||
// ceci afin d'etre compatible avec les cas ou la p<EFBFBD>riode n'etait pas obligatoire
|
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||||
$sql .= " (s.periode is not null and date_format(s.periode, '%Y') = $year) ";
|
$sql .= " (s.periode is not null and date_format(s.periode, '%Y') = $year) ";
|
||||||
$sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = $year)";
|
$sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = $year)";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
}
|
}
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
$filtre=ereg_replace(":","=",$filtre);
|
$filtre=ereg_replace(":","=",$filtre);
|
||||||
$sql .= " AND $filtre";
|
$sql .= " AND ".$filtre;
|
||||||
|
}
|
||||||
|
if ($typeid) {
|
||||||
|
$sql .= " AND s.fk_type=".$typeid;
|
||||||
}
|
}
|
||||||
if ($_GET["sortfield"]) {
|
if ($_GET["sortfield"]) {
|
||||||
$sql .= " ORDER BY ".$_GET["sortfield"];
|
$sql .= " ORDER BY ".$_GET["sortfield"];
|
||||||
@ -103,7 +121,8 @@ if ($resql)
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($year) $param.='&year='.$year;
|
if ($year) $param.='&year='.$year;
|
||||||
|
if ($typeid) $param.='&typeid='.$typeid;
|
||||||
|
|
||||||
if ($year)
|
if ($year)
|
||||||
{
|
{
|
||||||
@ -113,13 +132,14 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print_barre_liste($langs->trans("SocialContributions"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
|
print_barre_liste($langs->trans("SocialContributions"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
|
||||||
}
|
}
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
if ($mesg)
|
if ($mesg)
|
||||||
{
|
{
|
||||||
print $mesg."<br>";
|
print $mesg."<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
@ -129,9 +149,22 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("Type"),"index.php","type","",$param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Type"),"index.php","type","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"),"index.php","s.libelle","",$param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"),"index.php","s.libelle","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"),"index.php","s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Amount"),"index.php","s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),"index.php","s.paye","",$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),"index.php","s.paye","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
$html->select_type_socialcontrib($typeid,'typeid',1,16,0);
|
||||||
|
print '</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'">';
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
@ -168,13 +201,16 @@ if ($resql)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ if ($result)
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$total = 0 ;
|
$total = 0 ;
|
||||||
print '<br>';
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td nowrap align="left">'.$langs->trans("Ref").'</td>';
|
print '<td nowrap align="left">'.$langs->trans("Ref").'</td>';
|
||||||
|
|||||||
@ -323,8 +323,11 @@ class Form
|
|||||||
* \brief Return list of social contributions
|
* \brief Return list of social contributions
|
||||||
* \param selected Preselected type
|
* \param selected Preselected type
|
||||||
* \param htmlname Name of field in form
|
* \param htmlname Name of field in form
|
||||||
|
* \param useempty Set to 1 if we want an empty value
|
||||||
|
* \param maxlen Max length of text in combo box
|
||||||
|
* \param help Add or not the admin help picto
|
||||||
*/
|
*/
|
||||||
function select_type_socialcontrib($selected='',$htmlname='actioncode')
|
function select_type_socialcontrib($selected='',$htmlname='actioncode', $useempty=0, $maxlen=40, $help=1)
|
||||||
{
|
{
|
||||||
global $db,$langs,$user;
|
global $db,$langs,$user;
|
||||||
|
|
||||||
@ -341,16 +344,18 @@ class Form
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
if ($useempty) print '<option value="0"> </option>';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
print '<option value="'.$obj->id.'"';
|
print '<option value="'.$obj->id.'"';
|
||||||
if ($obj->id == $selected) print ' selected="true"';
|
if ($obj->id == $selected) print ' selected="true"';
|
||||||
print '>'.$obj->type;
|
print '>'.dol_trunc($obj->type,$maxlen);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</select>';
|
print '</select>';
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user