NEW: Can search on customer order amount into customer order list.
This commit is contained in:
parent
dd3f569ede
commit
9e4e9a5411
@ -400,7 +400,7 @@ if ($id > 0)
|
||||
// display amount and link to unpaid bill
|
||||
$outstandigBills = $object->get_OutstandingBill();
|
||||
if ($outstandigBills != 0)
|
||||
print " / <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills).'</a>';
|
||||
print " (".$langs->trans("CurrentOutstandingBill")." <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).'</a>)';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -182,9 +182,9 @@ if ($search_author)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
$sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||
@ -316,12 +316,12 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '<input class="flat" size="6" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formpropal->selectProposalStatus($viewstatut,1);
|
||||
|
||||
@ -51,6 +51,7 @@ $sall=GETPOST('sall');
|
||||
$socid=GETPOST('socid','int');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_total_ht=GETPOST('search_total_ht','alpha');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
||||
@ -79,6 +80,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_ref='';
|
||||
$search_ref_customer='';
|
||||
$search_company='';
|
||||
$search_total_ht='';
|
||||
$orderyear='';
|
||||
$ordermonth='';
|
||||
$deliverymonth='';
|
||||
@ -96,6 +98,7 @@ $parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -198,7 +201,10 @@ 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);
|
||||
}
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -252,7 +258,8 @@ if ($resql)
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
$i = 0;
|
||||
@ -316,7 +323,9 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
|
||||
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -328,7 +337,8 @@ if ($resql)
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
while ($i < min($num,$limit)) {
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -1962,11 +1962,11 @@ if ($action == 'create')
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '')
|
||||
{
|
||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit);
|
||||
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
||||
}
|
||||
print ')';
|
||||
print '</td>';
|
||||
|
||||
@ -187,13 +187,13 @@ if ($search_societe)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
|
||||
$sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
}
|
||||
if ($search_montant_ttc)
|
||||
if ($search_montant_ttc != '')
|
||||
{
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\'';
|
||||
$sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
}
|
||||
if ($search_status != '')
|
||||
{
|
||||
@ -263,8 +263,8 @@ if ($resql)
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
$i = 0;
|
||||
@ -323,9 +323,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"> </td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
||||
@ -4961,7 +4961,7 @@ function natural_search($fields, $value, $numeric=0)
|
||||
|
||||
if ($numeric)
|
||||
{
|
||||
$value=preg_replace('/([<>=]+)\s([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
||||
$value=preg_replace('/([<>=]+)\s([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
||||
}
|
||||
$crits = explode(' ', $value);
|
||||
$res = '';
|
||||
|
||||
@ -100,7 +100,7 @@ $offset = $conf->liste_limit * $page ;
|
||||
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
* Mode list
|
||||
*/
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,";
|
||||
@ -130,13 +130,13 @@ if ($search_user)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'";
|
||||
}
|
||||
if ($search_ht)
|
||||
if ($search_ht != '')
|
||||
{
|
||||
$sql .= " AND cf.total_ht = '".$db->escape(price2num($search_ht))."'";
|
||||
$sql .= natural_search("cf.total_ht",$search_ht, 1);
|
||||
}
|
||||
if ($search_ttc)
|
||||
if ($search_ttc != '')
|
||||
{
|
||||
$sql .= " AND cf.total_ttc = '".$db->escape(price2num($search_ttc))."'";
|
||||
$sql .= natural_search("cf.total_ttc", $search_ttc, 1);
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
@ -214,8 +214,8 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre"><input type="text" size="6" class="flat" name="search_user" value="'.$search_user.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" size="4" class="flat" name="search_ht" value="'.$search_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" size="4" class="flat" name="search_ttc" value="'.$search_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" size="6" class="flat" name="search_ht" value="'.$search_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" size="6" class="flat" name="search_ttc" value="'.$search_ttc.'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
|
||||
@ -153,7 +153,7 @@ if ($search_ref)
|
||||
if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref);
|
||||
else $sql .= natural_search('fac.ref', $search_ref);
|
||||
}
|
||||
if (search_ref_supplier)
|
||||
if ($search_ref_supplier)
|
||||
{
|
||||
$sql .= natural_search('fac.ref_supplier', $search_ref_supplier);
|
||||
}
|
||||
@ -178,14 +178,14 @@ if ($search_company)
|
||||
$sql .= natural_search('s.nom', $search_company);
|
||||
}
|
||||
|
||||
if ($search_amount_no_tax)
|
||||
if ($search_amount_no_tax != '')
|
||||
{
|
||||
$sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'";
|
||||
$sql .= natural_search('fac.total_ht', $search_amount_no_tax, 1);
|
||||
}
|
||||
|
||||
if ($search_amount_all_tax)
|
||||
if ($search_amount_all_tax != '')
|
||||
{
|
||||
$sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'";
|
||||
$sql .= natural_search('fac.total_ttc', $search_amount_all_tax, 1);
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -270,9 +270,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="8" name="search_amount_no_tax" value="'.$search_amount_no_tax.'">';
|
||||
print '<input class="flat" type="text" size="6" name="search_amount_no_tax" value="'.$search_amount_no_tax.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="8" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
|
||||
print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
$liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
|
||||
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user