Skip to content

Commit

Permalink
Merge pull request #12367 from aspangaro/11.0_a4
Browse files Browse the repository at this point in the history
NEW Salaries list - Add date start & date end
  • Loading branch information
eldy committed Jan 15, 2020
2 parents 132bb67 + c646484 commit e5e7f19
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions htdocs/salaries/list.php
Expand Up @@ -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');

Expand Down Expand Up @@ -79,12 +81,14 @@

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_amount = "";
$search_account = '';
$typeid = "";
$search_ref="";
$search_user="";
$search_label="";
$search_date_start='';
$search_date_end='';
$search_amount="";
$search_account='';
$typeid="";
}


Expand Down Expand Up @@ -112,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;
Expand Down Expand Up @@ -170,7 +176,7 @@

print '<tr class="liste_titre_filter">';
// Ref
print '<td class="liste_titre" align="left">';
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$db->escape($search_ref).'">';
print '</td>';
// Employee
Expand All @@ -180,9 +186,18 @@
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$db->escape($search_label).'"></td>';
// Date
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print '</div>';
print '</td>';
// Type
print '<td class="liste_titre" align="left">';
print '<td class="liste_titre left">';
$form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16);
print '</td>';
// Account
Expand Down

0 comments on commit e5e7f19

Please sign in to comment.