* Copyright (C) 2011 Dimitri Mouillard * * 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 2 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file define_congespayes.php * \ingroup congespayes * \brief File that defines the balance of paid leave of users. * \version $Id: define_congespayes.php,v 1.00 2011/09/15 11:00:00 dmouillard Exp $ * \author dmouillard@teclib.com * \remarks File that defines the balance of paid leave of users. */ require('../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); // If the user does not have perm to read the page if(!$user->rights->holiday->define_holiday) accessforbidden(); /* * View */ llxHeader(array(),$langs->trans('CPTitreMenu')); print_fiche_titre($langs->trans('MenuConfCP')); $congespayes = new Holiday($db); $listUsers = $congespayes->fetchUsers(false, true); // Si il y a une action de mise à jour if (isset($_POST['action']) && $_POST['action'] == 'update') { $fk_type = $_POST['fk_type']; foreach ($_POST['nb_conges'] as $user_id => $compteur) { if (!empty($compteur)) { $userValue = str_replace(',', '.', $compteur); $userValue = number_format($userValue, 2, '.', ''); } else { $userValue = '0.00'; } $congespayes->updateSoldeCP($user_id,$userValue,$fk_type); } print '
'; print $langs->trans('UpdateConfCPOK'); print '
'; } $var = true; $i = 0; foreach($congespayes->getTypes() as $type) { if($type['affect']==1) { print '
'; print '

'.$type['label'].'

'; print '
' . "\n"; print ''; print ''; print ''; print ""; print ''; print ''; print ''; foreach ($listUsers as $users) { $var = !$var; print ''; print ''; print '' . "\n"; print ''; $i++; } echo ""; print ''; echo ""; print '
' . $langs->trans('Employee') . '' . $langs->trans('Counter') . '
' . $users['name'] . ' ' . $users['firstname'] . ''; print ''; print ' jours
'; print '
'; print '
'; } } // Fin de page $db->close(); llxFooter();