NEW Invoice list - Add date start & date end

This commit is contained in:
Alexandre SPANGARO 2019-11-07 06:35:58 +01:00
parent d972fa8bcb
commit e60b7a67fa

View File

@ -13,6 +13,7 @@
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat> * Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* 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
@ -98,12 +99,10 @@ $search_country=GETPOST("search_country", 'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int');
$search_user = GETPOST('search_user', 'int'); $search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int'); $search_sale = GETPOST('search_sale', 'int');
$search_day = GETPOST('search_day', 'int'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_month = GETPOST('search_month', 'int'); $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_year = GETPOST('search_year', 'int'); $search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int'));
$search_day_lim = GETPOST('search_day_lim', 'int'); $search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int'));
$search_month_lim = GETPOST('search_month_lim', 'int');
$search_year_lim = GETPOST('search_year_lim', 'int');
$search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int'));
$search_btn=GETPOST('button_search', 'alpha'); $search_btn=GETPOST('button_search', 'alpha');
$search_remove_btn=GETPOST('button_removefilter', 'alpha'); $search_remove_btn=GETPOST('button_removefilter', 'alpha');
@ -248,14 +247,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_type=''; $search_type='';
$search_country=''; $search_country='';
$search_type_thirdparty=''; $search_type_thirdparty='';
$search_day=''; $search_date_start='';
$search_year=''; $search_date_end='';
$search_month=''; $search_datelimit_start='';
$search_datelimit_end='';
$option=''; $option='';
$filter=''; $filter='';
$search_day_lim='';
$search_year_lim='';
$search_month_lim='';
$toselect=''; $toselect='';
$search_array_options=array(); $search_array_options=array();
$search_categ_cus=0; $search_categ_cus=0;
@ -482,8 +479,10 @@ if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape(
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source);
if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source);
$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); if ($search_date_start) $sql.= " AND f.datef >= '" . $db->idate($search_date_start) . "'";
$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); if ($search_date_end) $sql.= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
if ($search_datelimit_start) $sql.= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'";
if ($search_datelimit_end) $sql.= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'";
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale;
if ($search_user > 0) if ($search_user > 0)
@ -752,20 +751,29 @@ if ($resql)
// Date invoice // Date invoice
if (! empty($arrayfields['f.date']['checked'])) if (! empty($arrayfields['f.date']['checked']))
{ {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">'; print '<div class="nowrap">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">'; print $langs->trans('From') . ' ';
$formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print '</div>';
print '</td>'; print '</td>';
} }
// Date due // Date due
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{ {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">'; print '<div class="nowrap">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">'; print $langs->trans('From') . ' ';
$formother->select_year($search_year_lim?$search_year_lim:-1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1);
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Alert"); print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1);
print '</div>';
print '</td>'; print '</td>';
} }
// Project ref // Project ref
@ -778,7 +786,7 @@ if ($resql)
{ {
print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.'"></td>'; print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.'"></td>';
} }
// Thirpdarty // Thirdparty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_societe" value="'.$search_societe.'"></td>'; print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_societe" value="'.$search_societe.'"></td>';