Fix filter on date
This commit is contained in:
parent
32ec57403b
commit
aaba18bd51
@ -129,6 +129,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_montant_ht='';
|
||||
$search_montant_ttc='';
|
||||
$search_status='';
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
@ -36,6 +38,10 @@ $langs->load("compta");
|
||||
$facid =GETPOST('facid','int');
|
||||
$socid =GETPOST('socid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$day = GETPOST('day','int');
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture',$facid,'');
|
||||
|
||||
@ -66,6 +72,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_amount="";
|
||||
$search_paymenttype="";
|
||||
$search_company="";
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@ -81,6 +90,7 @@ $extrafields = new ExtraFields($db);
|
||||
llxHeader('', $langs->trans('ListPayment'));
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
|
||||
if (GETPOST("orphelins"))
|
||||
{
|
||||
@ -141,6 +151,19 @@ else
|
||||
else $sql.= " AND f.fk_user_author = ".$userid;
|
||||
}
|
||||
// Search criteria
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.datep, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_ref > 0) $sql .=" AND p.rowid=".$search_ref;
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
|
||||
@ -194,7 +217,11 @@ if ($resql)
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
|
||||
print '</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user