Qual: Feature to make payment of salaries has been moved into a module

(module dedicated to manage salaries and salary payments).
Qual: Also module for employee to declare trip and expenses has been
moved into same place than module for employee to declare holidays
(into HRM top entry). It is not an accountancy module so no reason to
have it into entry "Accountancy".
This commit is contained in:
Laurent Destailleur 2014-03-17 14:30:55 +01:00
parent e6bf2cf5aa
commit 2889c3ac70
20 changed files with 712 additions and 385 deletions

View File

@ -248,6 +248,12 @@ source_file = htdocs/langs/en_US/propal.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.salaries]
file_filter = htdocs/langs/<lang>/salaries.lang
source_file = htdocs/langs/en_US/salaries.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.sendings] [dolibarr.sendings]
file_filter = htdocs/langs/<lang>/sendings.lang file_filter = htdocs/langs/<lang>/sendings.lang
source_file = htdocs/langs/en_US/sendings.lang source_file = htdocs/langs/en_US/sendings.lang

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* 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

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* 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
@ -21,7 +21,7 @@
/** /**
* \file htdocs/compta/charges/index.php * \file htdocs/compta/charges/index.php
* \ingroup compta * \ingroup compta
* \brief Page to list payments of social contributions, vat and salaries * \brief Page to list payments of special expenses
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -63,9 +63,9 @@ $socialcontrib=new ChargeSociales($db);
$payment_sc_static=new PaymentSocialContribution($db); $payment_sc_static=new PaymentSocialContribution($db);
$sal_static = new PaymentSalary($db); $sal_static = new PaymentSalary($db);
llxHeader('',$langs->trans("TaxAndDividendsArea")); llxHeader('',$langs->trans("SpecialExpensesArea"));
$title=$langs->trans("TaxAndDividendsArea"); $title=$langs->trans("SpecialExpensesArea");
if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments"); if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments");
$param=''; $param='';
@ -84,259 +84,267 @@ if (GETPOST("mode") != 'sconly')
} }
// Payment Salary // Payment Salary
if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') if ($conf->salaries->enabled)
{ {
$sal = new PaymentSalary($db); if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
{
$sal = new PaymentSalary($db);
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm"; $sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " WHERE s.entity = ".$conf->entity; $sql.= " WHERE s.entity = ".$conf->entity;
if ($year > 0)
{
// 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 periode n'etait pas obligatoire
$sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
$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_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
print "<td>".$obj->label."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>";
// Ref payment
$sal_static->id=$obj->rowid;
$sal_static->ref=$obj->rowid;
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
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">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($total)."</td>";
print "</tr>";
print "</table>";
$db->free($result);
print "<br>";
}
else
{
dol_print_error($db);
}
}
}
if ($conf->tax->enabled)
{
// Social contributions only
if (GETPOST("mode") != 'sconly')
{
print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " WHERE cs.fk_type = c.id";
$sql.= " AND cs.entity = ".$conf->entity;
if ($year > 0) if ($year > 0)
{ {
$sql .= " AND (";
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // 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 periode n'etait pas obligatoire // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ")";
} }
if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
//$sql.= $db->plimit($limit+1,$offset);
//print $sql;
$result = $db->query($sql); dol_syslog("compta/charges/index.php: select payment sql=".$sql);
if ($result) $resql=$db->query($sql);
if ($resql)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$total = 0 ; $total = 0;
print '<table class="noborder" width="100%">'; $totalnb = 0;
print '<tr class="liste_titre">'; $totalpaye = 0;
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder); $var=true;
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount; while ($i < $num)
{
$var=!$var; $obj = $db->fetch_object($resql);
print "<tr ".$bc[$var].">"; $var = !$var;
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n"; print "<tr ".$bc[$var].">";
// Date
print "<td>".$obj->label."</td>\n"; $date=$obj->periode;
if (empty($date)) $date=$obj->date_ech;
print '<td align="right">'.price($obj->amount)."</td>"; print '<td>'.dol_print_date($date,'day').'</td>';
// Label
// Ref payment print '<td>';
$sal_static->id=$obj->rowid; $socialcontrib->id=$obj->rowid;
$sal_static->ref=$obj->rowid; $socialcontrib->ref=$obj->libelle;
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n"; $socialcontrib->lib=$obj->libelle;
print $socialcontrib->getNomUrl(1,'20');
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n"; print '</td>';
print '<td align="right">'.price($obj->amount)."</td>"; // Type
print "</tr>\n"; print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
// Expected to pay
$i++; print '<td align="right">'.price($obj->total).'</td>';
} // Ref payment
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>'; $payment_sc_static->id=$obj->pid;
$payment_sc_static->ref=$obj->pid;
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
// Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
// Paid
print '<td align="right">'.price($obj->totalpaye).'</td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$i++;
}
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($totalpaye)."</td>";
print "</tr>"; print "</tr>";
}
print "</table>";
$db->free($result);
print "<br>";
}
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
print '</table>';
} }
// Social contributions only
if (GETPOST("mode") != 'sconly')
{
print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " WHERE cs.fk_type = c.id";
$sql.= " AND cs.entity = ".$conf->entity;
if ($year > 0)
{
$sql .= " AND (";
// 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 periode n'etait pas obligatoire
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ")";
}
if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
//$sql.= $db->plimit($limit+1,$offset);
//print $sql;
dol_syslog("compta/charges/index.php: select payment sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$var=true;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var = !$var;
print "<tr ".$bc[$var].">";
// Date
$date=$obj->periode;
if (empty($date)) $date=$obj->date_ech;
print '<td>'.dol_print_date($date,'day').'</td>';
// Label
print '<td>';
$socialcontrib->id=$obj->rowid;
$socialcontrib->ref=$obj->libelle;
$socialcontrib->lib=$obj->libelle;
print $socialcontrib->getNomUrl(1,'20');
print '</td>';
// Type
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
// Expected to pay
print '<td align="right">'.price($obj->total).'</td>';
// Ref payment
$payment_sc_static->id=$obj->pid;
$payment_sc_static->ref=$obj->pid;
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
// Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
// Paid
print '<td align="right">'.price($obj->totalpaye).'</td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$i++;
}
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($totalpaye)."</td>";
print "</tr>";
}
else
{
dol_print_error($db);
}
print '</table>';
// VAT // VAT
if ($conf->tax->enabled)
if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
{ {
print "<br>"; if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
$tva = new Tva($db);
print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
$sql.= " WHERE pv.entity = ".$conf->entity;
if ($year > 0)
{ {
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, print "<br>";
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
$result = $db->query($sql); $tva = new Tva($db);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount; print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$var=!$var; $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm";
print "<tr ".$bc[$var].">"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n"; $sql.= " WHERE pv.entity = ".$conf->entity;
if ($year > 0)
{
// 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 periode n'etait pas obligatoire
$sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
print "<td>".$obj->label."</td>\n"; $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_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
print '<td align="right">'.price($obj->amount)."</td>"; $total = $total + $obj->amount;
// Ref payment $var=!$var;
$tva_static->id=$obj->rowid; print "<tr ".$bc[$var].">";
$tva_static->ref=$obj->rowid; print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n"; print "<td>".$obj->label."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";
$i++; print '<td align="right">'.price($obj->amount)."</td>";
}
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($total)."</td>";
print "</tr>";
print "</table>"; // Ref payment
$db->free($result); $tva_static->id=$obj->rowid;
} $tva_static->ref=$obj->rowid;
else print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
{
dol_print_error($db); print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
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">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">'.price($total)."</td>";
print "</tr>";
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
} }
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -78,36 +78,6 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
} }
} }
/*
else if ($action == 'unblock' && $user->rights->deplacement->unvalidate)
{
$object->fetch($id);
if ($object->fk_statut == '1') // Not blocked...
{
$mesg='<div class="error">'.$langs->trans("Error").'</div>';
$action='';
$error++;
}
else
{
$result = $object->fetch($id);
$object->fk_statut = '1';
$result = $object->update($user);
if ($result > 0)
{
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
{
$mesg=$object->error;
}
}
}*/
else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
{ {
$result=$object->delete($id); $result=$object->delete($id);
@ -295,7 +265,7 @@ if ($action == 'create')
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
@ -307,7 +277,7 @@ if ($action == 'create')
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
@ -391,7 +361,7 @@ else if ($id)
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>'; print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td valign="top" colspan="3">'; print '<td valign="top" colspan="3">';
$doleditor = new DolEditor('note_public', $object->note_public, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
print $doleditor->Create(1); print $doleditor->Create(1);
print "</td></tr>"; print "</td></tr>";
@ -402,7 +372,7 @@ else if ($id)
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>'; print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td valign="top" colspan="3">'; print '<td valign="top" colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
print $doleditor->Create(1); print $doleditor->Create(1);
print "</td></tr>"; print "</td></tr>";

View File

@ -121,6 +121,7 @@ print '</tr>';
print '</table>'; print '</table>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';

181
htdocs/compta/hrm.php Normal file
View File

@ -0,0 +1,181 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/hrm.php
* \ingroup hrm
* \brief Home page for HRM area.
*/
require('../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$langs->load('users');
$langs->load('holidays');
$langs->load('tripss');
// Protection if external user
if ($user->societe_id > 0) accessforbidden();
/*
* Actions
*/
// None
/*
* View
*/
$holiday = new Holiday($db);
$holidaystatic=new Holiday($db);
llxHeader(array(),$langs->trans('HRMArea'));
print '<div class="fichecenter"><div class="fichethirdleft">';
if (! empty($conf->holiday->enabled))
{
$user_id = $user->id;
$nbaquis=$holiday->getCPforUser($user_id);
$nbdeduced=$holiday->getConfCP('nbHolidayDeducted');
$nb_holiday = $nbaquis / $nbdeduced;
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Holidays").'</td></tr>';
print "<tr ".$bc[0].">";
print '<td colspan="3">';
print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : '');
print '</td>';
print '</tr>';
print '</table><br>';
}
/*
* Search expenses
*/
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/deplacement/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td>".$langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=10;
$langs->load("boxes");
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND d.fk_soc = ".$socid;
$sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{
$var=false;
$num = $db->num_rows($result);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
print '<td align="right">'.$langs->trans("FeesKilometersOrAmout").'</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '<td width="16">&nbsp;</td>';
print '</tr>';
if ($num)
{
$total_ttc = $totalam = $total = 0;
$deplacementstatic=new Deplacement($db);
$userstatic=new User($db);
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
$deplacementstatic->ref=$obj->rowid;
$deplacementstatic->id=$obj->rowid;
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
print '<tr '.$bc[$var].'>';
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$obj->km.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut,3).'</td>';
print '</tr>';
$var=!$var;
$i++;
}
}
else
{
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
}
print '</table><br>';
}
else dol_print_error($db);
print '</div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -139,24 +139,6 @@ if (! empty($conf->don->enabled) && $user->rights->don->lire)
print "</table></form><br>"; print "</table></form><br>";
} }
/*
* Search expenses
*/
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/deplacement/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td>".$langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
/** /**
* Draft customers invoices * Draft customers invoices
*/ */

View File

@ -17,8 +17,8 @@
/** /**
* \file htdocs/compta/salaries/class/paymentsalary.class.php * \file htdocs/compta/salaries/class/paymentsalary.class.php
* \ingroup tax * \ingroup salaries
* \brief Class for tax module salary payment * \brief Class for salaries module payment
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
@ -76,7 +76,7 @@ class PaymentSalary extends CommonObject
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->fk_user=trim($this->fk_user); $this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
@ -85,10 +85,10 @@ class PaymentSalary extends CommonObject
$this->fk_bank=trim($this->fk_bank); $this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif); $this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary(";
$sql.= "tms,"; $sql.= "tms,";
@ -103,9 +103,9 @@ class PaymentSalary extends CommonObject
$sql.= "fk_bank,"; $sql.= "fk_bank,";
$sql.= "fk_user_creat,"; $sql.= "fk_user_creat,";
$sql.= "fk_user_modif"; $sql.= "fk_user_modif";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " '".$this->db->idate($this->tms).","; $sql.= " '".$this->db->idate($this->tms).",";
$sql.= " '".$this->fk_user."',"; $sql.= " '".$this->fk_user."',";
$sql.= " '".$this->db->idate($this->datep)."',"; $sql.= " '".$this->db->idate($this->datep)."',";
@ -118,7 +118,7 @@ class PaymentSalary extends CommonObject
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").","; $sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").",";
$sql.= " '".$this->fk_user_creat."',"; $sql.= " '".$this->fk_user_creat."',";
$sql.= " '".$this->fk_user_modif."'"; $sql.= " '".$this->fk_user_modif."'";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
@ -146,7 +146,7 @@ class PaymentSalary extends CommonObject
/** /**
* Update database * Update database
* *
* @param User $user User that modify * @param User $user User that modify
* @param int $notrigger 0=no, 1=yes (no update trigger) * @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -156,7 +156,7 @@ class PaymentSalary extends CommonObject
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->fk_user=trim($this->fk_user); $this->fk_user=trim($this->fk_user);
$this->amount=trim($this->amount); $this->amount=trim($this->amount);
@ -165,7 +165,7 @@ class PaymentSalary extends CommonObject
$this->fk_bank=trim($this->fk_bank); $this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat); $this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif); $this->fk_user_modif=trim($this->fk_user_modif);
// Check parameters // Check parameters
if (empty($this->fk_user) || $this->fk_user < 0) if (empty($this->fk_user) || $this->fk_user < 0)
{ {
@ -216,7 +216,7 @@ class PaymentSalary extends CommonObject
/** /**
* Load object in memory from database * Load object in memory from database
* *
* @param int $id id object * @param int $id id object
* @param User $user User that load * @param User $user User that load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -226,7 +226,7 @@ class PaymentSalary extends CommonObject
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " s.rowid,"; $sql.= " s.rowid,";
$sql.= " s.tms,"; $sql.= " s.tms,";
$sql.= " s.fk_user,"; $sql.= " s.fk_user,";
$sql.= " s.datep,"; $sql.= " s.datep,";
@ -288,7 +288,7 @@ class PaymentSalary extends CommonObject
/** /**
* Delete object in database * Delete object in database
* *
* @param User $user User that delete * @param User $user User that delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -360,7 +360,7 @@ class PaymentSalary extends CommonObject
// Clean parameters // Clean parameters
$this->amount=price2num(trim($this->amount)); $this->amount=price2num(trim($this->amount));
// Check parameters // Check parameters
if (! $this->label) if (! $this->label)
{ {
@ -369,7 +369,7 @@ class PaymentSalary extends CommonObject
} }
if ($this->fk_user < 0 || $this->fk_user == '') if ($this->fk_user < 0 || $this->fk_user == '')
{ {
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Person")); $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Employee"));
return -4; return -4;
} }
if ($this->amount < 0 || $this->amount == '') if ($this->amount < 0 || $this->amount == '')
@ -439,19 +439,19 @@ class PaymentSalary extends CommonObject
$acc = new Account($this->db); $acc = new Account($this->db);
$result=$acc->fetch($this->accountid); $result=$acc->fetch($this->accountid);
if ($result <= 0) dol_print_error($this->db); if ($result <= 0) dol_print_error($this->db);
// Insert payment into llx_bank // Insert payment into llx_bank
// Add link 'payment_salary' in bank_url between payment and bank transaction // Add link 'payment_salary' in bank_url between payment and bank transaction
$bank_line_id = $acc->addline( $bank_line_id = $acc->addline(
$this->datep, $this->datep,
$this->paymenttype, $this->paymenttype,
$this->label, $this->label,
-abs($this->amount), -abs($this->amount),
'', '',
'', '',
$user $user
); );
// Mise a jour fk_bank dans llx_paiement. // Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire // On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0) if ($bank_line_id > 0)
@ -463,26 +463,26 @@ class PaymentSalary extends CommonObject
$this->error=$acc->error; $this->error=$acc->error;
$ok=0; $ok=0;
} }
// Add link 'payment_salary' in bank_url between payment and bank transaction // Add link 'payment_salary' in bank_url between payment and bank transaction
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id='; $url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
if ($result <= 0) if ($result <= 0)
{ {
$this->error=$acc->error; $this->error=$acc->error;
$ok=0; $ok=0;
} }
// Add link 'user' in bank_url between operation and bank transaction // Add link 'user' in bank_url between operation and bank transaction
$linkaddedforthirdparty=array(); $linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value) foreach ($this->amounts as $key => $value)
{ {
$sal = new PaymentSalary($this->db); $sal = new PaymentSalary($this->db);
$sal->fetch($key); $sal->fetch($key);
$sal->fetch_user($this->fk_user); $sal->fetch_user($this->fk_user);
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
{ {
$result=$acc->add_url_line( $result=$acc->add_url_line(
@ -492,14 +492,14 @@ class PaymentSalary extends CommonObject
$sal->user->lastname, $sal->user->lastname,
'user' 'user'
); );
if ($result <= 0) dol_print_error($this->db); if ($result <= 0) dol_print_error($this->db);
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty $linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
} }
} }
} }
if ($ok) if ($ok)
{ {
$this->db->commit(); $this->db->commit();

View File

@ -18,7 +18,7 @@
/** /**
* \file htdocs/compta/salaries/fiche.php * \file htdocs/compta/salaries/fiche.php
* \ingroup tax * \ingroup tax
* \brief Page of salaries payments * \brief Page of salaries payments
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("compta"); $langs->load("compta");
$langs->load("banks"); $langs->load("banks");
$langs->load("bills"); $langs->load("bills");
$langs->load("users");
$langs->load("salaries");
$id=GETPOST("id",'int'); $id=GETPOST("id",'int');
$action=GETPOST('action'); $action=GETPOST('action');
@ -164,15 +166,15 @@ if ($action == 'create')
$pastmonth = 12; $pastmonth = 12;
$pastmonthyear--; $pastmonthyear--;
} }
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear); $datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear); $dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
if (empty($datesp) || empty($dateep)) // We define date_start and date_end if (empty($datesp) || empty($dateep)) // We define date_start and date_end
{ {
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false); $datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
} }
print "<form name='add' action=\"fiche.php\" method=\"post\">\n"; print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -189,15 +191,16 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
print $form->select_date($datev,"datev",'','','','add'); print $form->select_date($datev,"datev",'','','','add');
print '</td></tr>'; print '</td></tr>';
// Employee
print "<tr>"; print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1); print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
print "<tr>"; print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
print $form->select_date($datesp,"datesp",'','','','add'); print $form->select_date($datesp,"datesp",'','','','add');
@ -209,31 +212,31 @@ if ($action == 'create')
// Amount // Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
// Bank // Bank
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements($_POST["paiementtype"], "paiementtype"); $form->select_types_paiements($_POST["paiementtype"], "paiementtype");
print "</td>\n"; print "</td>\n";
print "</tr>"; print "</tr>";
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="1"'); $parameters=array('colspan' => ' colspan="1"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
print "<br>"; print "<br>";
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; '; print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>'; print '</form>';
} }
@ -261,7 +264,7 @@ if ($id)
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $salpayment->ref; print $salpayment->ref;
print '</td></tr>'; print '</td></tr>';
// Person // Person
print '<tr><td>'.$langs->trans("Person").'</td><td>'; print '<tr><td>'.$langs->trans("Person").'</td><td>';
$usersal=new User($db); $usersal=new User($db);
@ -280,7 +283,7 @@ if ($id)
print '<tr><td>'.$langs->trans("DateEndPeriod").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateEndPeriod").'</td><td colspan="3">';
print dol_print_date($salpayment->dateep,'day'); print dol_print_date($salpayment->dateep,'day');
print '</td></tr>'; print '</td></tr>';
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">'; print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">';
print dol_print_date($salpayment->datep,'day'); print dol_print_date($salpayment->datep,'day');

View File

@ -25,6 +25,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
$langs->load("compta"); $langs->load("compta");
$langs->load("salaries");
// Security check // Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = isset($_GET["socid"])?$_GET["socid"]:'';
@ -41,7 +42,7 @@ llxHeader();
$salstatic = new PaymentSalary($db); $salstatic = new PaymentSalary($db);
$userstatic = new User($db); $userstatic = new User($db);
print_fiche_titre($langs->trans("SalariesPayments")); print_fiche_titre($langs->trans("SalariesPayments"));

View File

@ -18,7 +18,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&amp;leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 100, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('boutique', '! empty($conf->boutique->enabled)', 11__+MAX_llx_menu__, __HANDLER__, 'top', 'shop', '', 0, '/boutique/index.php?mainmenu=shop&amp;leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 100, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('holiday', '$conf->holiday->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/holiday/index.php?mainmenu=holiday&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write', '', 0, 80, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm', '$conf->holiday->enabled || $conf->deplacement->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', 'HRM', -1, 'holiday', '$user->rights->holiday->write || $user->rights->deplacement->lire', '', 0, 80, __ENTITY__);
-- Home - Setup -- Home - Setup
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__);
@ -174,13 +174,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&amp;mainmenu=accountancy&amp;action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&amp;mainmenu=accountancy&amp;action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&amp;mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&amp;mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&amp;mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&amp;mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
-- Trips and expenses -- Special expenses
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 6__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '1', '', 0, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&amp;leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy', 'MenuTaxAndDividends', 0, 'compta', '$user->rights->tax->charges->lire', '', 0, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2201__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=accountancy', 'Salaries', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_salary&amp;action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/fiche.php?leftmenu=tax_salary&amp;action=create', 'NewPayment', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2203__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2203__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
@ -280,10 +276,15 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Members - Category member -- Members - Category member
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/fiche.php?action=create&amp;type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/fiche.php?action=create&amp;type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- HRM -- HRM - Holiday
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/index.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/index.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__);
-- HRM - Trips and expenses
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&amp;leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -134,9 +134,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
} }
// Financial // Financial
$tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled)), $tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled)),
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire)), 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire)),
'module'=>'comptabilite|accounting|facture|deplacement|don|tax'); 'module'=>'comptabilite|accounting|facture|don|tax');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode) if ($showmode)
{ {
@ -195,9 +195,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
} }
// HRM // HRM
$tmpentry=array('enabled'=>(! empty($conf->holiday->enabled)), $tmpentry=array('enabled'=>(! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled)),
'perms'=>(! empty($user->rights->holiday->write)), 'perms'=>(! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire)),
'module'=>'holiday'); 'module'=>'holiday|deplacement');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode) if ($showmode)
{ {
@ -209,9 +209,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
$idsel='hrm'; $idsel='hrm';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/holiday/index.php?mainmenu=hrm&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/holiday/index.php?mainmenu=holiday&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", ''); $menu->add('/compta/hrm.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
} }
@ -790,27 +790,23 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
//if ($leftmenu=="donations") $newmenu->add("/compta/dons/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); //if ($leftmenu=="donations") $newmenu->add("/compta/dons/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
} }
// Trips and expenses
if (! empty($conf->deplacement->enabled))
{
$langs->load("trips");
$newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses');
if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/fiche.php?action=create&amp;leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer);
if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire);
if (empty($leftmenu) || $leftmenu=="tripsandexpenses") $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire);
}
// Taxes and social contributions // Taxes and social contributions
if (! empty($conf->tax->enabled)) if (! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled))
{ {
$newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuTaxAndDividends"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax');
// Salaries
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_salary');
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
global $mysoc; global $mysoc;
// Social contributions
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire); $newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax');
// Salaries
if (! empty($conf->salaries->enabled))
{
$langs->load("salaries");
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary');
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/fiche.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->create);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
}
// Social contributions
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/sociales/charges.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire); if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/charges/index.php?leftmenu=tax_social&amp;mainmenu=accountancy&amp;mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
// VAT // VAT
@ -1089,17 +1085,26 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
*/ */
if ($mainmenu == 'hrm') if ($mainmenu == 'hrm')
{ {
// Holiday module
if (! empty($conf->holiday->enabled)) if (! empty($conf->holiday->enabled))
{ {
$langs->load("holiday"); $langs->load("holiday");
// HRM: Holiday module
$newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm'); $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm');
$newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); $newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write);
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log); $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log);
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report); $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report);
}
// Trips and expenses
if (! empty($conf->deplacement->enabled))
{
$langs->load("trips");
$newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses');
$newmenu->add("/compta/deplacement/fiche.php?action=create&amp;leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("New"), 1, $user->rights->deplacement->creer);
$newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("List"), 1, $user->rights->deplacement->lire);
$newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&amp;mainmenu=accountancy", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire);
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -89,24 +89,12 @@ class modDeplacement extends DolibarrModules
$this->rights[2][3] = 0; $this->rights[2][3] = 0;
$this->rights[2][4] = 'creer'; $this->rights[2][4] = 'creer';
$this->rights[3][0] = 173; $this->rights[3][0] = 173;
$this->rights[3][1] = 'Supprimer les deplacements'; $this->rights[3][1] = 'Supprimer les deplacements';
$this->rights[3][2] = 'd'; $this->rights[3][2] = 'd';
$this->rights[3][3] = 0; $this->rights[3][3] = 0;
$this->rights[3][4] = 'supprimer'; $this->rights[3][4] = 'supprimer';
/*
$this->rights[4][0] = 174;
$this->rights[4][1] = 'Bloquer les deplacements';
$this->rights[4][2] = 'a';
$this->rights[4][3] = 0;
$this->rights[4][4] = 'valider';
$this->rights[5][0] = 175;
$this->rights[5][1] = 'Debloquer les deplacements';
$this->rights[5][2] = 'a';
$this->rights[5][3] = 0;
$this->rights[5][4] = 'unvalidate';
*/
$this->rights[6][0] = 178; $this->rights[6][0] = 178;
$this->rights[6][1] = 'Exporter les deplacements'; $this->rights[6][1] = 'Exporter les deplacements';
$this->rights[6][2] = 'd'; $this->rights[6][2] = 'd';

View File

@ -0,0 +1,177 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \defgroup tax Module salaries
* \brief Module to include salaries management
* \file htdocs/core/modules/modSalaries.class.php
* \ingroup salaries
* \brief File to activate module salaries
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/**
* Class to manage salaries module
*/
class modSalaries extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $conf;
$this->db = $db;
$this->numero = 510;
$this->family = "hr";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Employees salaries management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->picto='bill';
// Data directories to create when module is enabled
$this->dirs = array("/salaries/temp");
// Config pages
$this->config_page_url = array();
// Dependances
$this->depends = array();
$this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array("salaries");
// Constantes
$this->const = array();
// Boites
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'salaries';
$r=0;
$r++;
$this->rights[$r][0] = 510;
$this->rights[$r][1] = 'Read salaries';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read';
$this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 511;
$this->rights[$r][1] = 'Create/modify salaries';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'create';
$this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 512;
$this->rights[$r][1] = 'Delete salaries';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'delete';
$this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 515;
$this->rights[$r][1] = 'Export salaries';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export';
$this->rights[$r][5] = '';
// Exports
//--------
$r=0;
/*
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Payment of salaries';
$this->export_permission[$r]=array(array("tax","charges","export"));
$this->export_fields_array[$r]=array('cc.libelle'=>"Type",'c.rowid'=>"IdSocialContribution",'c.libelle'=>"Label",'c.date_ech'=>'DateDue','c.periode'=>'Period','c.amount'=>"AmountExpected","c.paye"=>"Status",'p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero');
$this->export_TypeFields_array[$r]=array('cc.libelle'=>"List:c_chargesociales:libelle:id",'c.libelle'=>"Text",'c.date_ech'=>'Date','c.periode'=>'Period','c.amount'=>"Number","c.paye"=>"Boolean",'p.datep'=>'Date','p.amount'=>'Number','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('cc.libelle'=>"tax_type",'c.rowid'=>"tax",'c.libelle'=>'tax','c.date_ech'=>'tax','c.periode'=>'tax','c.amount'=>"tax","c.paye"=>"tax",'p.rowid'=>'payment','p.datep'=>'payment','p.amount'=>'payment','p.num_paiement'=>'payment');
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'c_chargesociales as cc, '.MAIN_DB_PREFIX.'chargesociales as c';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid';
$this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id';
$this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity;
*/
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
global $conf;
// Nettoyage avant activation
$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}
?>

View File

@ -233,7 +233,7 @@ else
{ {
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num); print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num);
print '<div class="tabBar">'; dol_fiche_head('');
} }
@ -248,7 +248,7 @@ if ($id > 0)
print '</br>'; print '</br>';
} }
else { else {
print '</div>'; dol_fiche_end();
} }
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";

View File

@ -465,8 +465,10 @@ Module400Name=Projects
Module400Desc=Project management inside other modules Module400Desc=Project management inside other modules
Module410Name=Webcalendar Module410Name=Webcalendar
Module410Desc=Webcalendar integration Module410Desc=Webcalendar integration
Module500Name=Taxes, social contributions and dividends Module500Name=Special expenses (tax, social contributions, dividends)
Module500Desc=Taxes and social contribution management Module500Desc=Management of special expenses like taxes, social contribution, dividends and salaries
Module510Name=Salaries
Module510Desc=Management of empoyees salaries and payments
Module600Name=Notifications Module600Name=Notifications
Module600Desc=Send notifications by email on some Dolibarr business events to third party contacts Module600Desc=Send notifications by email on some Dolibarr business events to third party contacts
Module700Name=Donations Module700Name=Donations

View File

@ -288,7 +288,7 @@ InvoiceNotChecked=No invoice selected
CloneInvoice=Clone invoice CloneInvoice=Clone invoice
ConfirmCloneInvoice=Are you sure you want to clone this invoice <b>%s</b> ? ConfirmCloneInvoice=Are you sure you want to clone this invoice <b>%s</b> ?
DisabledBecauseReplacedInvoice=Action disabled because invoice has been replaced DisabledBecauseReplacedInvoice=Action disabled because invoice has been replaced
DescTaxAndDividendsArea=This area presents a summary of all payments made for tax or social contributions. Only records with payment during the fixed year are included here. DescTaxAndDividendsArea=This area presents a summary of all payments made for special expenses. Only records with payment during the fixed year are included here.
NbOfPayments=Nb of payments NbOfPayments=Nb of payments
SplitDiscount=Split discount in two SplitDiscount=Split discount in two
ConfirmSplitDiscount=Are you sure you want to split this discount of <b>%s</b> %s into 2 lower discounts ? ConfirmSplitDiscount=Are you sure you want to split this discount of <b>%s</b> %s into 2 lower discounts ?

View File

@ -48,9 +48,11 @@ LT2SupplierES=IRPF purchases
VATCollected=VAT collected VATCollected=VAT collected
ToPay=To pay ToPay=To pay
ToGet=To get back ToGet=To get back
SpecialExpensesArea=Area for all special paiements
TaxAndDividendsArea=Tax, social contributions and dividends area TaxAndDividendsArea=Tax, social contributions and dividends area
SocialContribution=Social contribution SocialContribution=Social contribution
SocialContributions=Social contributions SocialContributions=Social contributions
MenuSpecialExpenses=Special expenses
MenuTaxAndDividends=Taxes and dividends MenuTaxAndDividends=Taxes and dividends
MenuSalaries=Salaries MenuSalaries=Salaries
MenuSocialContributions=Social contributions MenuSocialContributions=Social contributions
@ -74,17 +76,13 @@ DatePayment=Payment date
DateStartPeriod=Date start period DateStartPeriod=Date start period
DateEndPeriod=Date end period DateEndPeriod=Date end period
NewVATPayment=New VAT payment NewVATPayment=New VAT payment
NewSalaryPayment=New salary payment
newLT2PaymentES=New IRPF payment newLT2PaymentES=New IRPF payment
LT2PaymentES=IRPF Payment LT2PaymentES=IRPF Payment
LT2PaymentsES=IRPF Payments LT2PaymentsES=IRPF Payments
VATPayment=VAT Payment VATPayment=VAT Payment
VATPayments=VAT Payments VATPayments=VAT Payments
SalaryPayment=Salary payment
SalariesPayments=Salaries payments
SocialContributionsPayments=Social contributions payments SocialContributionsPayments=Social contributions payments
ShowVatPayment=Show VAT payment ShowVatPayment=Show VAT payment
ShowSalaryPayment=Show salary payment
TotalToPay=Total to pay TotalToPay=Total to pay
TotalVATReceived=Total VAT received TotalVATReceived=Total VAT received
CustomerAccountancyCode=Customer accountancy code CustomerAccountancyCode=Customer accountancy code

View File

@ -0,0 +1,8 @@
# Dolibarr language file - Source file is en_US - users
Salary=Salary
Salaries=Salaries
Employee=Employee
NewSalaryPayment=New salary payment
SalaryPayment=Salary payment
SalariesPayments=Salaries payments
ShowSalaryPayment=Show salary payment

View File

@ -74,17 +74,13 @@ DatePayment=Date de règlement
DateStartPeriod=Date de début période DateStartPeriod=Date de début période
DateEndPeriod=Date de fin période DateEndPeriod=Date de fin période
NewVATPayment=Nouveau règlement de TVA NewVATPayment=Nouveau règlement de TVA
NewSalaryPayment=Nouveau règlement de salaire
newLT2PaymentES=Nouveau règlement de IRPF newLT2PaymentES=Nouveau règlement de IRPF
LT2PaymentES=Règlement IRPF LT2PaymentES=Règlement IRPF
LT2PaymentsES=Règlements IRPF LT2PaymentsES=Règlements IRPF
VATPayment=Règlement TVA VATPayment=Règlement TVA
VATPayments=Règlements TVA VATPayments=Règlements TVA
SalaryPayment=Règlement salaire
SalariesPayments=Règlements des salaires
SocialContributionsPayments=Règlements charges sociales SocialContributionsPayments=Règlements charges sociales
ShowVatPayment=Afficher paiement TVA ShowVatPayment=Afficher paiement TVA
ShowSalaryPayment=Afficher paiement salaire
TotalToPay=Total à payer TotalToPay=Total à payer
TotalVATReceived=Total TVA perçue TotalVATReceived=Total TVA perçue
CustomerAccountancyCode=Compte comptable client CustomerAccountancyCode=Compte comptable client