* Copyright (C) 2011 François Legastelois * * 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, see . */ /** * \file month_report.php * \ingroup holiday * \brief Monthly report of paid holiday. */ require('../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.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.'/holiday/common.inc.php'; // Protection if external user if ($user->societe_id > 0) accessforbidden(); // Si l'utilisateur n'a pas le droit de lire cette page if(!$user->rights->holiday->month_report) accessforbidden(); /* * View */ $html = new Form($db); $htmlother = new FormOther($db); llxHeader(array(),$langs->trans('CPTitreMenu')); $cp = new Holiday($db); $month = GETPOST('month_start'); $year = GETPOST('year_start'); if(empty($month)) { $month = date('m'); } if(empty($year)) { $year = date('Y'); } $sql = "SELECT cp.fk_user, cp.date_debut, cp.date_fin"; $sql.= " FROM llx_holiday cp"; $sql.= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid"; $sql.= " WHERE cp.rowid > '0'"; $sql.= " AND cp.statut = 3"; $sql.= " AND (date_format(cp.date_debut, '%Y-%m') = '$year-$month' OR date_format(cp.date_fin, '%Y-%m') = '$year-$month')"; $sql.= " ORDER BY u.name,cp.date_debut"; $result = $db->query($sql); $num = $db->num_rows($result); print_fiche_titre($langs->trans('MenuReportMonth')); print '
'; print '
'."\n"; print 'Choix mois :  '; $htmlother->select_year($year,'year_start',1,10,3); print ''; print '
'; print '
'; $var=true; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if($num == '0') { print ''; print ''; print ''; } else { while($holiday = $db->fetch_array($result)){ $user = new User($db); $user->fetch($holiday['fk_user']); $var=!$var; if(substr($holiday['date_debut'],5,2)==$month-1){ $holiday['date_debut'] = date('Y-'.$month.'-01'); } if(substr($holiday['date_fin'],5,2)==$month+1){ $holiday['date_fin'] = date('Y-'.$month.'-t'); } print ''; print ''; print ''; print ''; print ''; print ''; } } print '
'.$langs->trans('Employee').''.$langs->trans('DateDebCP').''.$langs->trans('DateFinCP').''.$langs->trans('nbJours').'
'.$langs->trans('NoCPforMonth').'
'.$user->nom.' '.$user->prenom.''.$holiday['date_debut'].''.$holiday['date_fin'].''.$cp->getOpenDays(strtotime($holiday['date_debut']),strtotime($holiday['date_fin'])).'
'; print '
'; // Fin de page $db->close(); llxFooter(); ?>