From 5cf111120431d22f10a57b755c7bddc671171185 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 08:44:09 +0100 Subject: [PATCH] NEW Salaries list - Add date start & date end --- htdocs/salaries/list.php | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 51fd846218032..ec85967891181 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -40,6 +40,8 @@ $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'int'); @@ -80,7 +82,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers { $search_ref=""; + $search_user=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount=""; $search_account=''; $typeid=""; @@ -111,11 +116,13 @@ $sql.= " AND s.entity = ".$conf->entity; // Search criteria -if ($search_ref) $sql.=" AND s.rowid=".$search_ref; -if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); -if ($search_label) $sql.=natural_search(array('s.label'), $search_label); -if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); -if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); +if ($search_label) $sql.=natural_search(array('s.label'), $search_label); +if ($search_date_start) $sql.= " AND s.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND s.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); +if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -171,7 +178,7 @@ print ''; // Ref - print ''; + print ''; print ''; print ''; // Employee @@ -181,9 +188,18 @@ // Label print ''; // Date - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; + print ''; // Type - print ''; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); print ''; // Account @@ -239,7 +255,7 @@ // Label payment print "".dol_trunc($obj->label, 40)."\n"; // Date payment - print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; // Account @@ -269,7 +285,7 @@ print ''; } // Amount - print ''.price($obj->amount).''; + print ''.price($obj->amount).''; print ''; print "\n"; @@ -281,7 +297,7 @@ $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''.$langs->trans("Total").''; - print ''.price($total).""; + print ''.price($total).""; print ""; print "";