Merge pull request #12364 from aspangaro/11.0_a1
NEW Propal list - Add date start & date end
This commit is contained in:
commit
132bb67d14
@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||||
@ -75,15 +76,12 @@ $search_zip = GETPOST('search_zip', 'alpha');
|
|||||||
$search_state = trim(GETPOST("search_state"));
|
$search_state = trim(GETPOST("search_state"));
|
||||||
$search_country = GETPOST("search_country", 'int');
|
$search_country = GETPOST("search_country", 'int');
|
||||||
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
$search_type_thirdparty = GETPOST("search_type_thirdparty", '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_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
|
||||||
$search_dayfin = GETPOST("search_dayfin", "int");
|
$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
|
||||||
$search_month_end = GETPOST("search_month_end", "int");
|
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
|
||||||
$search_yearfin = GETPOST("search_yearfin", "int");
|
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||||
$search_daydelivery = GETPOST("search_daydelivery", "int");
|
|
||||||
$search_monthdelivery = GETPOST("search_monthdelivery", "int");
|
|
||||||
$search_yeardelivery = GETPOST("search_yeardelivery", "int");
|
|
||||||
$search_availability = GETPOST('search_availability', 'int');
|
$search_availability = GETPOST('search_availability', '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');
|
||||||
@ -219,15 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_type = '';
|
$search_type = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_type_thirdparty = '';
|
$search_type_thirdparty = '';
|
||||||
$search_year = '';
|
$search_date_start='';
|
||||||
$search_month = '';
|
$search_date_end='';
|
||||||
$search_day = '';
|
$search_dateend_start='';
|
||||||
$search_yearfin = '';
|
$search_dateend_end='';
|
||||||
$search_month_end = '';
|
$search_datedelivery_start='';
|
||||||
$search_dayfin = '';
|
$search_datedelivery_end='';
|
||||||
$search_yeardelivery = '';
|
|
||||||
$search_monthdelivery = '';
|
|
||||||
$search_daydelivery = '';
|
|
||||||
$search_availability = '';
|
$search_availability = '';
|
||||||
$viewstatut = '';
|
$viewstatut = '';
|
||||||
$object_statut = '';
|
$object_statut = '';
|
||||||
@ -313,6 +308,7 @@ if (!$user->rights->societe->client->voir && !$socid) //restriction
|
|||||||
{
|
{
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||||
@ -341,10 +337,13 @@ if ($viewstatut != '' && $viewstatut != '-1')
|
|||||||
{
|
{
|
||||||
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
||||||
}
|
}
|
||||||
$sql .= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year);
|
if ($search_date_start) $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin);
|
if ($search_date_end) $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery);
|
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'";
|
||||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'";
|
||||||
|
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
|
||||||
|
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
|
||||||
|
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
|
||||||
if ($search_user > 0)
|
if ($search_user > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
|
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
|
||||||
@ -415,9 +414,12 @@ if ($resql)
|
|||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||||
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start);
|
||||||
|
if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end);
|
||||||
|
if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start);
|
||||||
|
if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end);
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
||||||
if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject);
|
if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject);
|
||||||
@ -594,34 +596,43 @@ if ($resql)
|
|||||||
// Date
|
// Date
|
||||||
if (!empty($arrayfields['p.date']['checked']))
|
if (!empty($arrayfields['p.date']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
//print $langs->trans('Month').': ';
|
print '<div class="nowrap">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
print $langs->trans('From') . ' ';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||||
//print ' '.$langs->trans('Year').': ';
|
print '</div>';
|
||||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
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 end
|
// Date end
|
||||||
if (!empty($arrayfields['p.fin_validite']['checked']))
|
if (!empty($arrayfields['p.fin_validite']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
//print $langs->trans('Month').': ';
|
print '<div class="nowrap">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="'.dol_escape_htmltag($search_dayfin).'">';
|
print $langs->trans('From') . ' ';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
|
print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1);
|
||||||
//print ' '.$langs->trans('Year').': ';
|
print '</div>';
|
||||||
$formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5);
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date delivery
|
// Date delivery
|
||||||
if (!empty($arrayfields['p.date_livraison']['checked']))
|
if (!empty($arrayfields['p.date_livraison']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
//print $langs->trans('Month').': ';
|
print '<div class="nowrap">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="'.dol_escape_htmltag($search_daydelivery).'">';
|
print $langs->trans('From') . ' ';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="'.dol_escape_htmltag($search_monthdelivery).'">';
|
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
||||||
//print ' '.$langs->trans('Year').': ';
|
print '</div>';
|
||||||
$formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5);
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Availability
|
// Availability
|
||||||
@ -945,7 +956,7 @@ if ($resql)
|
|||||||
// Amount HT
|
// Amount HT
|
||||||
if (!empty($arrayfields['p.total_ht']['checked']))
|
if (!empty($arrayfields['p.total_ht']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
|
||||||
$totalarray['val']['p.total_ht'] += $obj->total_ht;
|
$totalarray['val']['p.total_ht'] += $obj->total_ht;
|
||||||
@ -953,7 +964,7 @@ if ($resql)
|
|||||||
// Amount VAT
|
// Amount VAT
|
||||||
if (!empty($arrayfields['p.total_vat']['checked']))
|
if (!empty($arrayfields['p.total_vat']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_vat)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_vat)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_vat';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_vat';
|
||||||
$totalarray['val']['p.total_vat'] += $obj->total_vat;
|
$totalarray['val']['p.total_vat'] += $obj->total_vat;
|
||||||
@ -961,7 +972,7 @@ if ($resql)
|
|||||||
// Amount TTC
|
// Amount TTC
|
||||||
if (!empty($arrayfields['p.total_ttc']['checked']))
|
if (!empty($arrayfields['p.total_ttc']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
|
||||||
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
||||||
@ -982,7 +993,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
|
||||||
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
||||||
@ -1003,7 +1014,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
|
||||||
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user