Fix totalnboflines not correctly managed
This commit is contained in:
parent
6f474c403c
commit
ed3f0ce86b
@ -108,6 +108,12 @@ if ($typeid) {
|
||||
$sql .= " AND s.fk_typepayment=".$typeid;
|
||||
}
|
||||
//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev, s.fk_typepayment, s.num_payment, pst.code";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
|
||||
@ -119,6 +119,12 @@ if ($typeid) {
|
||||
$sql .= " AND cs.fk_type=".$typeid;
|
||||
}
|
||||
$sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
|
||||
@ -115,6 +115,12 @@ if ($filtre) {
|
||||
if ($typeid) {
|
||||
$sql .= " AND t.fk_typepayment=".$typeid;
|
||||
}
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
|
||||
@ -136,17 +136,21 @@ if ($search_contract) {
|
||||
if (!empty($search_ref_supplier)) {
|
||||
$sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
}
|
||||
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
}
|
||||
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
|
||||
|
||||
@ -147,6 +147,12 @@ $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
|
||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
||||
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." '".$db->idate($filter_date1)."'";
|
||||
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql .= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
|
||||
@ -123,6 +123,12 @@ if ($socid)
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
@ -68,6 +68,12 @@ if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label
|
||||
if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$search_status;
|
||||
if ($sall) $sql.= natural_search(array('e.label','e.description','e.lieu','e.address','e.town'), $sall);
|
||||
$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
@ -81,7 +87,7 @@ if ($result)
|
||||
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
llxHeader("",$langs->trans("ListOfWarehouses"),$help_url);
|
||||
|
||||
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num);
|
||||
print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $totalnboflines);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -168,20 +174,23 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="2" align="right">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).'</td>';
|
||||
print '<td align="right">';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency);
|
||||
else
|
||||
if ($totalnboflines <= $limit)
|
||||
{
|
||||
$htmltext=$langs->trans("OptionMULTIPRICESIsOn");
|
||||
print $form->textwithtooltip($langs->trans("Variable"),$htmltext);
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="2" align="right">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).'</td>';
|
||||
print '<td align="right">';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency);
|
||||
else
|
||||
{
|
||||
$htmltext=$langs->trans("OptionMULTIPRICESIsOn");
|
||||
print $form->textwithtooltip($langs->trans("Variable"),$htmltext);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user