Fix: Social contributions payments appeared with empty label in list. Now it's link to social contribution card.

This commit is contained in:
Laurent Destailleur 2008-10-18 14:01:55 +00:00
parent c91202c316
commit a3384961e4
8 changed files with 104 additions and 91 deletions

View File

@ -31,11 +31,11 @@ if (! $res) include("../../../dolibarr/htdocs/main.inc.php"); // Used on dev env
$langs->load("admin");
function llxHeader($head = "", $title="", $help_url='')
function llxHeader($head = '', $title='', $help_url='')
{
global $conf, $user, $langs;
top_menu($head);
top_menu($head, $title, $target);
$menuarray=array();

View File

@ -107,7 +107,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"]=='yes' && $user->r
/*
* Affichage page
* View
*/
llxHeader();
@ -261,7 +261,7 @@ if ($account || $_GET["ref"])
/**
* Bandeau recherche
* Search form
*/
// Define transaction list navigation string
@ -473,8 +473,10 @@ if ($account || $_GET["ref"])
$isbanktransfert=false;
foreach($links as $key=>$val) { if ($val['type']=='banktransfert') $isbanktransfert=true; }
$issocialcontrib=false;
//foreach($links as $key=>$val) { if ($val['type']=='sc') $issocialcontrib=true; }
if (sizeof($links) == 0 || $isbanktransfert)
if (sizeof($links) == 0 || $isbanktransfert || $issocialcontrib)
{
if (eregi('^\((.*)\)$',$objp->label,$reg))
{
@ -524,9 +526,14 @@ if ($account || $_GET["ref"])
}
else if ($links[$key]['type']=='company') {
}
else if ($links[$key]['type']=='sc') {
else if ($links[$key]['type']=='sc') { // This is waitin for card to link to payment_sc
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
//print img_object($langs->trans('ShowPayment'),'payment').' ';
print $langs->trans("SocialContribution");
print '</a>';
}
else if ($links[$key]['type']=='payment_sc') {
else if ($links[$key]['type']=='payment_sc')
{
//print ' - ';
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/xxx.php?id='.$links[$key]['url_id'].'">';
//print img_object($langs->trans('ShowPayment'),'payment').' ';

View File

@ -15,21 +15,19 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/compta/charges/index.php
\ingroup compta
\brief Page liste des charges
\version $Revision$
*/
* \file htdocs/compta/charges/index.php
* \ingroup compta
* \brief Page liste des charges
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/tva/tva.class.php");
// Security check
if (!$user->admin && !$user->rights->tax->charges->lire)
accessforbidden();
@ -38,16 +36,20 @@ $filtre=$_GET["filtre"];
if (! $year) { $year=date("Y", time()); }
llxHeader();
/*
* View
*/
llxHeader('',$langs->trans("TaxAndDividendsArea"));
print_fiche_titre($langs->trans("TaxAndDividendsArea"),($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":""));
print "<br>";
/*
* Charges sociales
*/
// Social contributions
print_titre($langs->trans("SocialContributions"));
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
@ -106,58 +108,64 @@ else
}
print '</table>';
print "<br>";
$tva = new Tva($db);
// VAT
print_titre($langs->trans("VATPayments"));
$sql = "SELECT rowid, amount, label, ".$db->pdate("f.datev")." as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as f ";
if ($year > 0)
if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
{
// Si period renseigné on l'utilise comme critere de date, sinon on prend date échéance,
// ceci afin d'etre compatible avec les cas ou la période n'etait pas obligatoire
$sql .= " WHERE date_format(f.datev, '%Y') = ".$year;
}
$sql .= " ORDER BY dm DESC";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td nowrap>'.$langs->trans("Date").'</td>';
print "<td>".$langs->trans("Label")."</td>";
print '<td align="right">'.$langs->trans("Amount")."</td>";
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td align="left">'.dolibarr_print_date($obj->dm,'day')."</td>\n";
print "<td>".$obj->label."</td>\n";
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right"><b>'.price($total)."</b></td></tr>";
print "</table>";
$db->free($result);
}
else
{
dolibarr_print_error($db);
print "<br>";
$tva = new Tva($db);
print_titre($langs->trans("VATPayments"));
$sql = "SELECT rowid, amount, label, ".$db->pdate("f.datev")." as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as f ";
if ($year > 0)
{
// Si period renseigné on l'utilise comme critere de date, sinon on prend date échéance,
// ceci afin d'etre compatible avec les cas ou la période n'etait pas obligatoire
$sql .= " WHERE date_format(f.datev, '%Y') = ".$year;
}
$sql .= " ORDER BY dm DESC";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td nowrap>'.$langs->trans("Date").'</td>';
print "<td>".$langs->trans("Label")."</td>";
print '<td align="right">'.$langs->trans("Amount")."</td>";
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td align="left">'.dolibarr_print_date($obj->dm,'day')."</td>\n";
print "<td>".$obj->label."</td>\n";
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right"><b>'.price($total)."</b></td></tr>";
print "</table>";
$db->free($result);
}
else
{
dolibarr_print_error($db);
}
}

View File

@ -29,13 +29,13 @@
require("../../main.inc.php");
function llxHeader($head = "")
function llxHeader($head = '', $title='', $help_url='')
{
global $user, $conf, $langs;
$langs->load("compta");
$langs->load("propal");
top_menu($head);
top_menu($head, $title, $target);
$menu = new Menu();

View File

@ -219,10 +219,10 @@ $textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next(
print_fiche_titre($langs->trans("VAT"),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear");
echo '<table width="100%">';
echo '<table width="100%" class="nobordernopadding">';
echo '<tr><td>';
print_fiche_titre($langs->trans("VATSummary"));
echo '</td><td>';
echo '</td><td width="5">&nbsp;</td><td>';
print_fiche_titre($langs->trans("VATPayed"));
echo '</td></tr>';
@ -284,7 +284,7 @@ else
print '</table>';
echo '</td><td valign="top" width="50%">';
echo '</td><td>&nbsp;</td><td valign="top" width="50%">';
/*

View File

@ -397,7 +397,7 @@ class MenuLeft {
}
}
// Clients
// Customers
if ($conf->societe->enabled)
{
$newmenu->add(DOL_URL_ROOT."/compta/index.php?leftmenu=customers", $langs->trans("Customers"),0,$user->rights->societe->lire);
@ -409,7 +409,7 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"),1,$user->rights->societe->contact->lire);
}
// Factures
// Invoices
if ($conf->facture->enabled)
{
$langs->load("bills");
@ -434,14 +434,14 @@ class MenuLeft {
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),2,$user->rights->facture->lire);
}
// Propal
// Proposals
if ($conf->propal->enabled)
{
$langs->load("propal");
$newmenu->add(DOL_URL_ROOT."/compta/propal.php",$langs->trans("Prop"),0,$user->rights->propale->lire);
}
// Commandes
// Orders
if ($conf->commande->enabled )
{
$langs->load("orders");
@ -449,7 +449,7 @@ class MenuLeft {
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
}
// Dons
// Donations
if ($conf->don->enabled)
{
$langs->load("donations");
@ -468,11 +468,11 @@ class MenuLeft {
if ($leftmenu=="tripsandexpenses") $newmenu->add(DOL_URL_ROOT."/compta/deplacement/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire);
}
// Taxes et charges sociales
// Taxes and social contributions
if ($conf->tax->enabled)
{
$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire);
if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
if (eregi('^tax',$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
if (eregi('^tax',$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"), 2, $user->rights->tax->charges->lire);
// VAT

View File

@ -379,7 +379,7 @@ class MenuLeft {
}
}
// Clients
// Customers
if ($conf->societe->enabled)
{
$newmenu->add(DOL_URL_ROOT."/compta/index.php?leftmenu=customers", $langs->trans("Customers"),0,$user->rights->societe->lire);
@ -391,7 +391,7 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"),1,$user->rights->societe->contact->lire);
}
// Factures
// Invoices
if ($conf->facture->enabled)
{
$langs->load("bills");
@ -414,24 +414,22 @@ class MenuLeft {
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),2,$user->rights->facture->lire);
}
// Propal
// Proposals
if ($conf->propal->enabled)
{
$langs->load("propal");
$newmenu->add(DOL_URL_ROOT."/compta/propal.php",$langs->trans("Prop"),0,$user->rights->propale->lire);
}
// Commandes
/*
if ($conf->commande->enabled )
// Orders
if ($conf->commande->enabled)
{
$langs->load("orders");
if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&amp;status=3&amp;afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
}
*/
// Dons
// Donations
if ($conf->don->enabled)
{
$langs->load("donations");
@ -450,11 +448,11 @@ class MenuLeft {
if ($leftmenu=="tripsandexpenses") $newmenu->add(DOL_URL_ROOT."/compta/deplacement/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire);
}
// Taxes et charges sociales
// Taxes and social contributions
if ($conf->tax->enabled)
{
$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire);
if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
if (eregi('^tax',$leftmenu)) $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
if (eregi('^tax',$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
if (eregi('^tax',$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"), 2, $user->rights->tax->charges->lire);
// VAT

View File

@ -886,7 +886,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
* \param title titre page web
* \param target target du menu Accueil
*/
function top_menu($head, $title="", $target="")
function top_menu($head, $title='', $target='')
{
global $user, $conf, $langs, $db, $dolibarr_main_authentication;