Add filter date and total line on bank writing list page
This commit is contained in:
parent
38a0596594
commit
57e4453ea2
@ -45,6 +45,7 @@ For users:
|
|||||||
- New: Can filter on status for supplier order.
|
- New: Can filter on status for supplier order.
|
||||||
- Fix: Project Task numbering customs rule works.
|
- Fix: Project Task numbering customs rule works.
|
||||||
- Fix: Add actions events not implemented.
|
- Fix: Add actions events not implemented.
|
||||||
|
- New: Add filter date in bank writing list page
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- New: Predefined product and free product use same form.
|
- New: Predefined product and free product use same form.
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copytight (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copytight (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* 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.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.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.'/compta/bank/class/bankcateg.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
@ -43,14 +45,18 @@ $credit=GETPOST("credit");
|
|||||||
$type=GETPOST("type");
|
$type=GETPOST("type");
|
||||||
$account=GETPOST("account");
|
$account=GETPOST("account");
|
||||||
$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_end=dol_mktime ( 0, 0, 0, GETPOST ( 'search_end_dtmonth', 'int' ), GETPOST ( 'search_end_dtday', 'int' ), GETPOST ( 'search_end_dtyear', 'int' ) );
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($description) $param.='&description='.$description;
|
if (!empty($description)) $param.='&description='.$description;
|
||||||
if ($type) $param.='&type='.$type;
|
if (!empty($type)) $param.='&type='.$type;
|
||||||
if ($debit) $param.='&debit='.$debit;
|
if (!empty($debit)) $param.='&debit='.$debit;
|
||||||
if ($credit) $param.='&credit='.$credit;
|
if (!empty($credit)) $param.='&credit='.$credit;
|
||||||
if ($account) $param.='&account='.$account;
|
if (!empty($account)) $param.='&account='.$account;
|
||||||
if ($bid) $param.='&bid='.$bid;
|
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');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
@ -74,6 +80,7 @@ $bankaccountstatic=new Account($db);
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther ( $db );
|
||||||
|
|
||||||
if ($vline) $viewline = $vline;
|
if ($vline) $viewline = $vline;
|
||||||
else $viewline = 50;
|
else $viewline = 50;
|
||||||
@ -108,6 +115,13 @@ if (! empty($type))
|
|||||||
{
|
{
|
||||||
$sql.= " AND b.fk_type = '".$db->escape($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
|
// Search criteria amount
|
||||||
$si=0;
|
$si=0;
|
||||||
$debit = price2num(str_replace('-','',$debit));
|
$debit = price2num(str_replace('-','',$debit));
|
||||||
@ -128,6 +142,7 @@ $sql.= $db->order($sortfield,$sortorder);
|
|||||||
$sql.= $db->plimit($limit+1,$offset);
|
$sql.= $db->plimit($limit+1,$offset);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
|
dol_syslog('compta/bank/search.php:: sql='.$sql);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -147,6 +162,19 @@ if ($resql)
|
|||||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
|
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 '<table class="liste" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
||||||
@ -161,7 +189,6 @@ if ($resql)
|
|||||||
print '<td class="liste_titre" align="left"> '.$langs->trans("Account").'</td>';
|
print '<td class="liste_titre" align="left"> '.$langs->trans("Account").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<form method="post" action="search.php">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
@ -189,6 +216,8 @@ if ($resql)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Loop on each record
|
// Loop on each record
|
||||||
|
$total_debit=0;
|
||||||
|
$total_credit=0;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -259,10 +288,12 @@ if ($resql)
|
|||||||
if ($objp->amount < 0)
|
if ($objp->amount < 0)
|
||||||
{
|
{
|
||||||
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
||||||
|
$total_debit+=$objp->amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
||||||
|
$total_credit+=$objp->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
@ -275,6 +306,15 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
$i++;
|
$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>";
|
print "</table>";
|
||||||
|
|
||||||
@ -285,7 +325,7 @@ else
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si acc<63>s issu d'une recherche et rien de trouv<75>
|
// If no data to display after a search
|
||||||
if ($_POST["action"] == "search" && ! $num)
|
if ($_POST["action"] == "search" && ! $num)
|
||||||
{
|
{
|
||||||
print $langs->trans("NoRecordFound");
|
print $langs->trans("NoRecordFound");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user