Fix: Trad and sort on status
This commit is contained in:
parent
4accdad6a3
commit
8912de7bbc
@ -42,6 +42,8 @@ if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/proj
|
|||||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
|
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
|
||||||
|
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
|
//print 'ee'.$langs->trans('BillsCustomer');exit;
|
||||||
|
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
@ -72,6 +74,8 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
|||||||
$object->callHooks('objectcard');
|
$object->callHooks('objectcard');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Actions */
|
/* Actions */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -3295,7 +3299,7 @@ else
|
|||||||
* Mode Liste *
|
* Mode Liste *
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
$now=gmmktime();
|
$now=dol_now();
|
||||||
|
|
||||||
$page =$_GET['page'];
|
$page =$_GET['page'];
|
||||||
$sortorder=$_GET['sortorder'];
|
$sortorder=$_GET['sortorder'];
|
||||||
@ -3317,10 +3321,12 @@ else
|
|||||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||||
$sql.= ' s.nom, s.rowid as socid';
|
$sql.= ' s.nom, s.rowid as socid';
|
||||||
|
if (! $sall) $sql.= ' ,SUM(pf.amount) as am'; // To be able to sort on status
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
|
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
|
||||||
|
if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||||
$sql.= ' WHERE f.fk_soc = s.rowid';
|
$sql.= ' WHERE f.fk_soc = s.rowid';
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
@ -3355,7 +3361,7 @@ else
|
|||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||||
else
|
else
|
||||||
$sql.= " AND date_format(f.datef, '%m') = '$month'";
|
$sql.= " AND date_format(f.datef, '%m') = '".$month."'";
|
||||||
}
|
}
|
||||||
else if ($year > 0)
|
else if ($year > 0)
|
||||||
{
|
{
|
||||||
@ -3369,12 +3375,19 @@ else
|
|||||||
{
|
{
|
||||||
$sql.= ' AND (s.nom LIKE \'%'.addslashes($sall).'%\' OR f.facnumber LIKE \'%'.addslashes($sall).'%\' OR f.note LIKE \'%'.addslashes($sall).'%\' OR fd.description LIKE \'%'.addslashes($sall).'%\')';
|
$sql.= ' AND (s.nom LIKE \'%'.addslashes($sall).'%\' OR f.facnumber LIKE \'%'.addslashes($sall).'%\' OR f.note LIKE \'%'.addslashes($sall).'%\' OR fd.description LIKE \'%'.addslashes($sall).'%\')';
|
||||||
}
|
}
|
||||||
|
if (! $sall)
|
||||||
|
{
|
||||||
|
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||||
|
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||||
|
$sql.= ' f.paye, f.fk_statut,';
|
||||||
|
$sql.= ' s.nom, s.rowid';
|
||||||
|
}
|
||||||
$sql.= ' ORDER BY ';
|
$sql.= ' ORDER BY ';
|
||||||
$listfield=explode(',',$sortfield);
|
$listfield=explode(',',$sortfield);
|
||||||
foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.',';
|
foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.',';
|
||||||
$sql.= ' f.rowid DESC ';
|
$sql.= ' f.rowid DESC ';
|
||||||
$sql.= $db->plimit($limit+1,$offset);
|
$sql.= $db->plimit($limit+1,$offset);
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -3391,7 +3404,7 @@ else
|
|||||||
if ($month) $param.='&month='.$month;
|
if ($month) $param.='&month='.$month;
|
||||||
if ($year) $param.='&year=' .$year;
|
if ($year) $param.='&year=' .$year;
|
||||||
|
|
||||||
print_barre_liste($langs->trans('BillsCustomer').' '.($socid?' '.$soc->nom:''),$page,'facture.php',$param,$sortfield,$sortorder,'',$num);
|
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,'facture.php',$param,$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user