NEW Customer command list - Add date start & date end
This commit is contained in:
parent
d972fa8bcb
commit
9ff10d430b
@ -56,12 +56,10 @@ $confirm=GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'orderlist';
|
||||
|
||||
$search_orderyear=GETPOST("search_orderyear", "int");
|
||||
$search_ordermonth=GETPOST("search_ordermonth", "int");
|
||||
$search_orderday=GETPOST("search_orderday", "int");
|
||||
$search_deliveryyear=GETPOST("search_deliveryyear", "int");
|
||||
$search_deliverymonth=GETPOST("search_deliverymonth", "int");
|
||||
$search_deliveryday=GETPOST("search_deliveryday", "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_dateorder_end= dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', '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_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||
$search_product_category=GETPOST('search_product_category', 'int');
|
||||
$search_ref=GETPOST('search_ref', 'alpha')!=''?GETPOST('search_ref', 'alpha'):GETPOST('sref', 'alpha');
|
||||
$search_ref_customer=GETPOST('search_ref_customer', 'alpha');
|
||||
@ -197,12 +195,10 @@ if (empty($reshook))
|
||||
$search_total_ht='';
|
||||
$search_total_vat='';
|
||||
$search_total_ttc='';
|
||||
$search_orderyear='';
|
||||
$search_ordermonth='';
|
||||
$search_orderday='';
|
||||
$search_deliveryday='';
|
||||
$search_deliverymonth='';
|
||||
$search_deliveryyear='';
|
||||
$search_dateorder_start='';
|
||||
$search_dateorder_end='';
|
||||
$search_datedelivery_start='';
|
||||
$search_datedelivery_end='';
|
||||
$search_project_ref='';
|
||||
$search_project='';
|
||||
$viewstatut='';
|
||||
@ -311,22 +307,24 @@ 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.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear);
|
||||
$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear);
|
||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql.= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql.= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_dateorder_start) $sql.= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'";
|
||||
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_zip) $sql.= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql.= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -402,34 +400,32 @@ if ($resql)
|
||||
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($sall) $param.='&sall='.urlencode($sall);
|
||||
if ($socid > 0) $param.='&socid='.urlencode($socid);
|
||||
if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut);
|
||||
if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday);
|
||||
if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth);
|
||||
if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear);
|
||||
if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday);
|
||||
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_company) $param.='&search_company='.urlencode($search_company);
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_town != '') $param.='&search_town='.urlencode($search_town);
|
||||
if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_state != '') $param.='&search_state='.urlencode($search_state);
|
||||
if ($search_country != '') $param.='&search_country='.urlencode($search_country);
|
||||
if ($sall) $param.='&sall='.urlencode($sall);
|
||||
if ($socid > 0) $param.='&socid='.urlencode($socid);
|
||||
if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut);
|
||||
if ($search_dateorder_start) $param.='&search_dateorder_start=' . urlencode($search_dateorder_start);
|
||||
if ($search_dateorder_end) $param.='&search_dateorder_end=' . urlencode($search_dateorder_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_company) $param.='&search_company='.urlencode($search_company);
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_town != '') $param.='&search_town='.urlencode($search_town);
|
||||
if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_state != '') $param.='&search_state='.urlencode($search_state);
|
||||
if ($search_country != '') $param.='&search_country='.urlencode($search_country);
|
||||
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
if ($search_product_category != '') $param.='&search_product_category='.urlencode($search_product_category);
|
||||
if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus);
|
||||
if ($show_files) $param.='&show_files=' .urlencode($show_files);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($billed != '') $param.='&billed='.urlencode($billed);
|
||||
if ($show_files) $param.='&show_files=' .urlencode($show_files);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($billed != '') $param.='&billed='.urlencode($billed);
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@ -646,18 +642,28 @@ if ($resql)
|
||||
// Date order
|
||||
if (! empty($arrayfields['c.date_commande']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="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 '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_ordermonth" value="'.$search_ordermonth.'">';
|
||||
$formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
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>';
|
||||
}
|
||||
if (! empty($arrayfields['c.date_delivery']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="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 '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_deliverymonth" value="'.$search_deliverymonth.'">';
|
||||
$formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
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>';
|
||||
}
|
||||
if (! empty($arrayfields['c.total_ht']['checked']))
|
||||
@ -1044,7 +1050,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Plannned date of delivery
|
||||
// Planned date of delivery
|
||||
if (! empty($arrayfields['c.date_delivery']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
@ -1055,7 +1061,7 @@ if ($resql)
|
||||
// Amount HT
|
||||
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['pos'][$totalarray['nbfield']]='c.total_ht';
|
||||
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
||||
@ -1063,7 +1069,7 @@ if ($resql)
|
||||
// Amount VAT
|
||||
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['pos'][$totalarray['nbfield']]='c.total_tva';
|
||||
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
||||
@ -1071,7 +1077,7 @@ if ($resql)
|
||||
// Amount TTC
|
||||
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['pos'][$totalarray['nbfield']]='c.total_ttc';
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user