NEW Customer command list - Add date start & date end

This commit is contained in:
Alexandre SPANGARO 2019-11-07 13:57:04 +01:00
parent d972fa8bcb
commit 9ff10d430b

View File

@ -56,12 +56,10 @@ $confirm=GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'orderlist'; $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'orderlist';
$search_orderyear=GETPOST("search_orderyear", "int"); $search_dateorder_start= dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int'));
$search_ordermonth=GETPOST("search_ordermonth", "int"); $search_dateorder_end= dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int'));
$search_orderday=GETPOST("search_orderday", "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_deliveryyear=GETPOST("search_deliveryyear", "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_deliverymonth=GETPOST("search_deliverymonth", "int");
$search_deliveryday=GETPOST("search_deliveryday", "int");
$search_product_category=GETPOST('search_product_category', 'int'); $search_product_category=GETPOST('search_product_category', 'int');
$search_ref=GETPOST('search_ref', 'alpha')!=''?GETPOST('search_ref', 'alpha'):GETPOST('sref', 'alpha'); $search_ref=GETPOST('search_ref', 'alpha')!=''?GETPOST('search_ref', 'alpha'):GETPOST('sref', 'alpha');
$search_ref_customer=GETPOST('search_ref_customer', 'alpha'); $search_ref_customer=GETPOST('search_ref_customer', 'alpha');
@ -197,12 +195,10 @@ if (empty($reshook))
$search_total_ht=''; $search_total_ht='';
$search_total_vat=''; $search_total_vat='';
$search_total_ttc=''; $search_total_ttc='';
$search_orderyear=''; $search_dateorder_start='';
$search_ordermonth=''; $search_dateorder_end='';
$search_orderday=''; $search_datedelivery_start='';
$search_deliveryday=''; $search_datedelivery_end='';
$search_deliverymonth='';
$search_deliveryyear='';
$search_project_ref=''; $search_project_ref='';
$search_project=''; $search_project='';
$viewstatut=''; $viewstatut='';
@ -311,8 +307,10 @@ if ($viewstatut <> '')
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
} }
} }
$sql.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); if ($search_dateorder_start) $sql.= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'";
$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); if ($search_dateorder_end) $sql.= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'";
if ($search_datedelivery_start) $sql.= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
if ($search_datedelivery_end) $sql.= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
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);
@ -405,12 +403,10 @@ if ($resql)
if ($sall) $param.='&sall='.urlencode($sall); if ($sall) $param.='&sall='.urlencode($sall);
if ($socid > 0) $param.='&socid='.urlencode($socid); if ($socid > 0) $param.='&socid='.urlencode($socid);
if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut);
if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); if ($search_dateorder_start) $param.='&search_dateorder_start=' . urlencode($search_dateorder_start);
if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); if ($search_dateorder_end) $param.='&search_dateorder_end=' . urlencode($search_dateorder_end);
if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start);
if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end);
if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth);
if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_company) $param.='&search_company='.urlencode($search_company); if ($search_company) $param.='&search_company='.urlencode($search_company);
if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer);
@ -646,18 +642,28 @@ if ($resql)
// Date order // Date order
if (! empty($arrayfields['c.date_commande']['checked'])) if (! empty($arrayfields['c.date_commande']['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 width25 valignmiddle" type="text" maxlength="2" name="search_orderday" value="'.$search_orderday.'">'; print '<div class="nowrap">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_ordermonth" value="'.$search_ordermonth.'">'; print $langs->trans('From') . ' ';
$formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5); print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1);
print '</div>';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['c.date_delivery']['checked'])) if (! empty($arrayfields['c.date_delivery']['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 width25 valignmiddle" type="text" maxlength="2" name="search_deliveryday" value="'.$search_deliveryday.'">'; print '<div class="nowrap">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_deliverymonth" value="'.$search_deliverymonth.'">'; print $langs->trans('From') . ' ';
$formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5); print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
print '</div>';
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>';
} }
if (! empty($arrayfields['c.total_ht']['checked'])) if (! empty($arrayfields['c.total_ht']['checked']))
@ -1044,7 +1050,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Plannned date of delivery // Planned date of delivery
if (! empty($arrayfields['c.date_delivery']['checked'])) if (! empty($arrayfields['c.date_delivery']['checked']))
{ {
print '<td align="center">'; print '<td align="center">';
@ -1055,7 +1061,7 @@ if ($resql)
// Amount HT // Amount HT
if (! empty($arrayfields['c.total_ht']['checked'])) if (! empty($arrayfields['c.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']]='c.total_ht'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht';
$totalarray['val']['c.total_ht'] += $obj->total_ht; $totalarray['val']['c.total_ht'] += $obj->total_ht;
@ -1063,7 +1069,7 @@ if ($resql)
// Amount VAT // Amount VAT
if (! empty($arrayfields['c.total_vat']['checked'])) if (! empty($arrayfields['c.total_vat']['checked']))
{ {
print '<td class="right">'.price($obj->total_tva)."</td>\n"; print '<td class="nowrap right">'.price($obj->total_tva)."</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva';
$totalarray['val']['c.total_tva'] += $obj->total_tva; $totalarray['val']['c.total_tva'] += $obj->total_tva;
@ -1071,7 +1077,7 @@ if ($resql)
// Amount TTC // Amount TTC
if (! empty($arrayfields['c.total_ttc']['checked'])) if (! empty($arrayfields['c.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']]='c.total_ttc'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc';
$totalarray['val']['c.total_ttc'] += $obj->total_ttc; $totalarray['val']['c.total_ttc'] += $obj->total_ttc;