diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index e8d225d5af6..0ed06cceb40 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -79,6 +79,8 @@ HolidaysCancelation=Leave request cancelation EmployeeLastname=Employee last name EmployeeFirstname=Employee first name TypeWasDisabledOrRemoved=Leave type (id %s) was disabled or removed +LastHolidays=Latest %s leave requests +AllHolidays=All leave requests ## Configuration du Module ## LastUpdateCP=Latest automatic update of leaves allocation diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index 7e0c80d3380..2a3372ed847 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -13,3 +13,5 @@ TJM=Average daily rate CurrentSalary=Current salary THMDescription=This value may be used to calculate cost of time consumed on a project entered by users if module project is used TJMDescription=This value is currently as information only and is not used for any calculation +LastSalaries=Latest %s salary payments +AllSalaries=All salary payments \ No newline at end of file diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 501ccb6ff10..da4b3efa8f8 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -12,6 +12,8 @@ ListOfFees=List of fees TypeFees=Types of fees ShowTrip=Show expense report NewTrip=New expense report +LastExpenseReports=Latest %s expense reports +AllExpenseReports=All expense reports CompanyVisited=Company/organisation visited FeesKilometersOrAmout=Amount or kilometers DeleteTrip=Delete expense report diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index b71a5ccdf18..420b6d233f2 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -30,12 +30,19 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; +if (! empty($conf->holiday->enabled)) require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +if (! empty($conf->salaries->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; $langs->load("companies"); $langs->load("commercial"); $langs->load("banks"); $langs->load("bills"); +$langs->load("trips"); +$langs->load("holiday"); +$langs->load("salaries"); $id = GETPOST('id','int'); $bankid = GETPOST('bankid','int'); @@ -198,7 +205,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); - print '
'; + print '
'; print '
'; @@ -281,8 +288,188 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco { print '
'.$langs->trans("RIBControlError").'
'; } + + print '
'; + + // Nbre max d'elements des petites listes + $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; + + /* + * Last salaries + */ + if (! empty($conf->salaries->enabled) && + ($user->rights->salaries->read || ($user->rights->salaries->read && $object->id == $user->id)) + ) + { + $salary = new PaymentSalary($db); - print "
"; + $sql = "SELECT ps.rowid, ps.datesp, ps.dateep, ps.amount"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as ps"; + $sql.= " WHERE ps.fk_user = ".$object->id; + $sql.= " AND ps.entity = ".$conf->entity; + $sql.= " ORDER BY ps.datesp DESC"; + + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + + if ($num > 0) + { + print ''; + + print ''; + print ''; + print ''; + } + + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + + print ''; + print '\n"; + print '\n"; + print ''; + $i++; + } + $db->free($resql); + + if ($num > 0) print "
'; + print '
'.$langs->trans("LastSalaries",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSalaries").' '.$num.'
'; + $salary->id = $objp->rowid; + $salary->ref = $objp->rowid; + + print $salary->getNomUrl(1); + print ''.dol_print_date($db->jdate($objp->datesp),'day')."'.dol_print_date($db->jdate($objp->dateep),'day')."'.price($objp->amount).'
"; + } + else + { + dol_print_error($db); + } + } + + /* + * Last holidays + */ + if (! empty($conf->holiday->enabled) && + ($user->rights->holiday->read_all || ($user->rights->holiday->read && $object->id == $user->id)) + ) + { + $holiday = new Holiday($db); + + $sql = "SELECT h.rowid, h.statut, h.fk_type, h.date_debut, h.date_fin, h.halfday"; + $sql.= " FROM ".MAIN_DB_PREFIX."holiday as h"; + $sql.= " WHERE h.fk_user = ".$object->id; + $sql.= " AND h.entity = ".$conf->entity; + $sql.= " ORDER BY h.date_debut DESC"; + + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + + if ($num > 0) + { + print ''; + + print ''; + print ''; + print ''; + } + + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + + print ''; + print '\n"; + print ''; + print ''; + $i++; + } + $db->free($resql); + + if ($num > 0) print "
'; + print '
'.$langs->trans("LastHolidays",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllHolidays").' '.$num.'
'; + $holiday->id = $objp->rowid; + $holiday->ref = $objp->rowid; + $holiday->fk_type = $objp->fk_type; + $nbopenedday=num_open_day($db->jdate($objp->date_debut), $db->jdate($objp->date_fin), 0, 1, $objp->halfday); + + print $holiday->getNomUrl(1); + print ''.dol_print_date($db->jdate($objp->date_debut),'day')."'.$nbopenedday.' '.$langs->trans('DurationDays').''.$holiday->LibStatut($objp->statut,5).'
"; + } + else + { + dol_print_error($db); + } + } + + /* + * Last expense report + */ + if (! empty($conf->expensereport->enabled) && + ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id)) + ) + { + $exp = new ExpenseReport($db); + + $sql = "SELECT e.rowid, e.ref, e.fk_statut, e.date_debut, e.total_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e"; + $sql.= " WHERE e.fk_user_author = ".$object->id; + $sql.= " AND e.entity = ".$conf->entity; + $sql.= " ORDER BY e.date_debut DESC"; + + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $num = $db->num_rows($resql); + + if ($num > 0) + { + print ''; + + print ''; + print ''; + print ''; + } + + $i = 0; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + + print ''; + print '\n"; + print ''; + print ''; + $i++; + } + $db->free($resql); + + if ($num > 0) print "
'; + print '
'.$langs->trans("LastExpenseReports",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllExpenseReports").' '.$num.'
'; + $exp->id = $objp->rowid; + $exp->ref = $objp->ref; + $exp->fk_type = $objp->fk_type; + + print $exp->getNomUrl(1); + print ''.dol_print_date($db->jdate($objp->date_debut),'day')."'.price($objp->total_ttc).''.$exp->LibStatut($objp->fk_statut,5).'
"; + } + else + { + dol_print_error($db); + } + } + + print '
'; + print '
'; dol_fiche_end();