From 5122b32cccbc3ff9cdbb7de94e9659e408043420 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 14:59:39 +0100 Subject: [PATCH] Salaries list --- htdocs/compta/salaries/index.php | 36 ++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index b2fc3e1b4a3..8382029aa56 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -33,6 +33,9 @@ $socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'salaries', '', '', ''); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -61,6 +64,14 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; +} + /* * View */ @@ -78,8 +89,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst $sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.rowid = s.fk_user"; $sql.= " AND s.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND s.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; -if (GETPOST("search_amount")) $sql.=" AND s.amount = ".price2num(GETPOST("search_amount")); + +// Search criteria +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; @@ -118,19 +132,23 @@ if ($result) print "\n"; print ''; + // Ref + print ''; + print ''; + print ''; print ' '; - print ' '; - print ''; + // Label + print ''; print ' '; // Type print ''; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + // Amount + print ''; + print ''; + print ''; + print "\n"; while ($i < min($num,$limit)) {