Skip to content
Snippets Groups Projects
Commit cb660cba authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW More filter on bank transaction list

parent d6d474f1
No related branches found
No related tags found
No related merge requests found
...@@ -42,11 +42,12 @@ $langs->load("margins"); ...@@ -42,11 +42,12 @@ $langs->load("margins");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque'); $result=restrictedArea($user,'banque');
$search_ref=GETPOST('search_ref','int');
$description=GETPOST("description",'alpha'); $description=GETPOST("description",'alpha');
$debit=GETPOST("debit",'alpha'); $debit=GETPOST("debit",'alpha');
$credit=GETPOST("credit",'alpha'); $credit=GETPOST("credit",'alpha');
$type=GETPOST("type",'alpha'); $type=GETPOST("type",'alpha');
$account=GETPOST("account",'alpha'); $account=GETPOST("account",'int');
$bid=GETPOST("bid","int"); $bid=GETPOST("bid","int");
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int')); $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int')); $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
...@@ -64,28 +65,12 @@ $pagenext = $page + 1; ...@@ -64,28 +65,12 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='b.dateo'; if (! $sortfield) $sortfield='b.dateo';
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (!empty($description)) $param.='&description='.$description;
if (!empty($type)) $param.='&type='.$type;
if (!empty($debit)) $param.='&debit='.$debit;
if (!empty($credit)) $param.='&credit='.$credit;
if (!empty($account)) $param.='&account='.$account;
if (!empty($bid)) $param.='&bid='.$bid;
if (dol_strlen($search_dt_start) > 0)
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
if (dol_strlen($search_dt_end) > 0)
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
/* /*
* Actions * Actions
*/ */
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{ {
$description=""; $description="";
$type=""; $type="";
...@@ -93,6 +78,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both ...@@ -93,6 +78,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$credit=""; $credit="";
$account=""; $account="";
$bid=""; $bid="";
$search_ref="";
$search_req_nb=''; $search_req_nb='';
$search_thirdparty=''; $search_thirdparty='';
$thirdparty=''; $thirdparty='';
...@@ -127,29 +113,15 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND ...@@ -127,29 +113,15 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql.= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
if ($search_req_nb) if ($search_ref) $sql.=natural_search("b.rowid", $search_ref);
{ if ($account > 0) $sql.=" AND b.fk_account = ".$account;
$sql.= " AND b.num_chq LIKE '%".$db->escape($search_req_nb)."%'"; if ($search_req_nb) $sql.= " AND b.num_chq LIKE '%".$db->escape($search_req_nb)."%'";
} if ($search_thirdparty) $sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'";
if ($search_thirdparty) if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
{ if (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' ";
$sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'";
}
if ($bid)
{
$sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
}
if (! empty($type))
{
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
}
// Search period criteria // Search period criteria
if (dol_strlen($search_dt_start)>0) { if (dol_strlen($search_dt_start)>0) $sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'"; if (dol_strlen($search_dt_end)>0) $sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
}
if (dol_strlen($search_dt_end)>0) {
$sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
}
// Search criteria amount // Search criteria amount
$debit = price2num(str_replace('-','',$debit)); $debit = price2num(str_replace('-','',$debit));
$credit = price2num(str_replace('-','',$credit)); $credit = price2num(str_replace('-','',$credit));
...@@ -165,7 +137,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) ...@@ -165,7 +137,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
} }
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
print $sql;
dol_syslog('compta/bank/search.php::', LOG_DEBUG); dol_syslog('compta/bank/search.php::', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
...@@ -174,6 +146,23 @@ if ($resql) ...@@ -174,6 +146,23 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$param='';
if (!empty($search_ref)) $param.='&search_ref='.$search_ref;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (!empty($description)) $param.='&description='.$description;
if (!empty($type)) $param.='&type='.$type;
if (!empty($debit)) $param.='&debit='.$debit;
if (!empty($credit)) $param.='&credit='.$credit;
if (!empty($account)) $param.='&account='.$account;
if (!empty($bid)) $param.='&bid='.$bid;
if (dol_strlen($search_dt_start) > 0)
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
if (dol_strlen($search_dt_end) > 0)
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
if (GETPOST("req_nb")) $param.='&amp;req_nb='.urlencode(GETPOST("req_nb"));
if (GETPOST("thirdparty")) $param.='&amp;thirdparty='.urlencode(GETPOST("thirdparty"));
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n"; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
...@@ -199,10 +188,11 @@ if ($resql) ...@@ -199,10 +188,11 @@ if ($resql)
$moreforfilter = ''; $moreforfilter = '';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('DateStart') . ' '; $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1); $moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('DateStart') . ' ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
$moreforfilter .= ' - '; $moreforfilter .= ' - ';
$moreforfilter .= $langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); $moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if ($moreforfilter) if ($moreforfilter)
...@@ -223,12 +213,14 @@ if ($resql) ...@@ -223,12 +213,14 @@ if ($resql)
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_ref" size="4" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
...@@ -246,7 +238,9 @@ if ($resql) ...@@ -246,7 +238,9 @@ if ($resql)
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">'; print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
print '</td>'; print '</td>';
print '<td></td>'; print '<td align="right">';
$form->select_comptes($account,'account',0,'',1);
print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco; print $searchpitco;
......
...@@ -179,8 +179,8 @@ print "</td>\n"; ...@@ -179,8 +179,8 @@ print "</td>\n";
print "<td>"; print "<td>";
$form->select_date((! empty($dateo)?$dateo:''),'','','','','add'); $form->select_date((! empty($dateo)?$dateo:''),'','','','','add');
print "</td>\n"; print "</td>\n";
print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>'; print '<td><input name="label" class="flat quatrevingtpercent" type="text" value="'.$label.'"></td>';
print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>'; print '<td><input name="amount" class="flat" type="text" size="6" value="'.$amount.'"></td>';
print "</table>"; print "</table>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment