dolibarr/htdocs/compta/salaries/index.php
Laurent Destailleur 2889c3ac70 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".
2014-03-17 14:30:55 +01:00

109 lines
3.2 KiB
PHP

<?php
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.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/salaries/index.php
* \ingroup tax
* \brief List of salaries payments
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
$langs->load("compta");
$langs->load("salaries");
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
/*
* View
*/
llxHeader();
$salstatic = new PaymentSalary($db);
$userstatic = new User($db);
print_fiche_titre($langs->trans("SalariesPayments"));
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " ORDER BY dm DESC";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
print "<td>".$langs->trans("Person")."</td>";
print "<td>".$langs->trans("Label")."</td>";
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var].">";
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
$salstatic->id=$obj->rowid;
$salstatic->ref=$obj->rowid;
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
$db->close();
llxFooter();
?>