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

Merge pull request #1533 from FHenry/develop

Add filter date and total line on bank writing list page
parents 41e30062 0d169758
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,7 @@ For users:
- New: Can filter on status for supplier order.
- Fix: Project Task numbering customs rule works.
- Fix: Add actions events not implemented.
- New: Add filter date in bank writing list page
TODO
- New: Predefined product and free product use same form.
......
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copytight (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copytight (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
*
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
......@@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->load("banks");
$langs->load("categories");
......@@ -43,14 +45,20 @@ $credit=GETPOST("credit");
$type=GETPOST("type");
$account=GETPOST("account");
$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_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
$param='';
if ($description) $param.='&description='.$description;
if ($type) $param.='&type='.$type;
if ($debit) $param.='&debit='.$debit;
if ($credit) $param.='&credit='.$credit;
if ($account) $param.='&account='.$account;
if ($bid) $param.='&bid='.$bid;
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');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
......@@ -74,6 +82,7 @@ $bankaccountstatic=new Account($db);
llxHeader();
$form = new Form($db);
$formother = new FormOther($db);
if ($vline) $viewline = $vline;
else $viewline = 50;
......@@ -108,6 +117,13 @@ if (! empty($type))
{
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
}
//Search period criteria
if (dol_strlen($search_dt_start)>0) {
$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) . "'";
}
// Search criteria amount
$si=0;
$debit = price2num(str_replace('-','',$debit));
......@@ -128,6 +144,7 @@ $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1,$offset);
//print $sql;
dol_syslog('compta/bank/search.php:: sql='.$sql);
$resql = $db->query($sql);
if ($resql)
{
......@@ -147,6 +164,19 @@ if ($resql)
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
}
print '<form method="post" action="search.php" name="search_form">';
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('DateOperationShort') . ': ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('PeriodEndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
if ($moreforfilter) {
print '<div class="liste_titre">';
print $moreforfilter;
print '</div>';
}
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
......@@ -161,7 +191,6 @@ if ($resql)
print '<td class="liste_titre" align="left"> &nbsp; '.$langs->trans("Account").'</td>';
print "</tr>\n";
print '<form method="post" action="search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
......@@ -189,6 +218,8 @@ if ($resql)
print '</tr>';
// Loop on each record
$total_debit=0;
$total_credit=0;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
......@@ -259,10 +290,12 @@ if ($resql)
if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
$total_debit+=$objp->amount;
}
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</td>\n";
$total_credit+=$objp->amount;
}
// Bank account
......@@ -275,6 +308,15 @@ if ($resql)
}
$i++;
}
if ($num>0) {
print '<tr class="liste_total">';
print '<td>' . $langs->trans('Total') . '</td>';
print '<td colspan="6"></td>';
print '<td align="right">' . price($total_debit * - 1) . '</td>';
print '<td align="right">' . price($total_credit) . '</td>';
print '<td></td>';
print '</tr>';
}
print "</table>";
......@@ -285,7 +327,7 @@ else
dol_print_error($db);
}
// Si acc�s issu d'une recherche et rien de trouv�
// If no data to display after a search
if ($_POST["action"] == "search" && ! $num)
{
print $langs->trans("NoRecordFound");
......
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