';
print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
@@ -211,20 +211,22 @@ if ($id > 0 || ! empty($ref))
if ($num > 0)
{
- $var=True;
- while ($i < $num && $i < $conf->liste_limit)
+ while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
-
+ $total_ht+=$objp->total_ht;
+ $total_qty+=$objp->qty;
+
+ $orderstatic->id=$objp->commandeid;
+ $orderstatic->ref=$objp->ref;
+ $orderstatic->ref_client=$objp->ref_client;
+ $societestatic->fetch($objp->socid);
+
print '
';
print '| ';
- $orderstatic->id=$objp->commandeid;
- $orderstatic->ref=$objp->ref;
- $orderstatic->ref_client=$objp->ref_client;
print $orderstatic->getNomUrl(1);
print " | \n";
- $societestatic->fetch($objp->socid);
print ''.$societestatic->getNomUrl(1).' | ';
print "".$objp->code_client." | \n";
print '';
@@ -234,15 +236,11 @@ if ($id > 0 || ! empty($ref))
print ' | '.$orderstatic->LibStatut($objp->statut,$objp->facture,5).' | ';
print "
\n";
$i++;
-
- if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
- $total_ht+=$objp->total_ht;
- $total_qty+=$objp->qty;
- }
}
}
print '
';
- print '| ' . $langs->trans('Total') . ' | ';
+ if ($num < $limit) print ''.$langs->trans("Total").' | ';
+ else print ''.$langs->trans("Totalforthispage").' | ';
print ' | ';
print ''.$total_qty.' | ';
print ''.price($total_ht).' | ';
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index 4526af86f96..7c80062da81 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -119,7 +119,7 @@ if ($id > 0 || ! empty($ref)) {
print '';
print '';
- show_stats_for_company($product, $socid);
+ $nboflines = show_stats_for_company($product, $socid);
print "
";
@@ -153,24 +153,21 @@ if ($id > 0 || ! empty($ref)) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
if ($socid)
$sql .= " AND c.fk_soc = " . $socid;
- $sql .= " ORDER BY $sortfield $sortorder ";
-
+ $sql.= $db->order($sortfield, $sortorder);
+
// Calcul total qty and amount for global if full scan list
$total_ht = 0;
$total_qty = 0;
- $totalrecords = 0;
- if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
- $result = $db->query($sql);
- if ($result) {
- $totalrecords = $db->num_rows($result);
- while ( $objp = $db->fetch_object($result) ) {
- $total_ht += $objp->total_ht;
- $total_qty += $objp->qty;
- }
- }
- }
- $sql .= $db->plimit($conf->liste_limit + 1, $offset);
+ // Count total nb of records
+ $totalofrecords = '';
+ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ {
+ $result = $db->query($sql);
+ $totalofrecords = $db->num_rows($result);
+ }
+
+ $sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result) {
@@ -182,7 +179,8 @@ if ($id > 0 || ! empty($ref)) {
$option .= '&search_month=' . $search_month;
if (! empty($search_year))
$option .= '&search_year=' . $search_year;
-
+ if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
+
print '
\n";
- if ($num > 0) {
- $var = True;
- while ( $i < $num && $i < $conf->liste_limit ) {
+ if ($num > 0)
+ {
+ while ($i < min($num, $limit))
+ {
$objp = $db->fetch_object($result);
- $var = ! $var;
- print '
';
- print '| ';
+ $total_ht+=$objp->total_ht;
+ $total_qty+=$objp->qty;
+
$supplierorderstatic->id = $objp->commandeid;
$supplierorderstatic->ref = $objp->ref;
$supplierorderstatic->statut = $objp->statut;
+ $societestatic->fetch($objp->socid);
+
+ print ' |
';
+ print '| ';
print $supplierorderstatic->getNomUrl(1);
print " | \n";
- $societestatic->fetch($objp->socid);
print '' . $societestatic->getNomUrl(1) . ' | ';
print "" . $objp->code_client . " | \n";
print '';
@@ -241,16 +243,12 @@ if ($id > 0 || ! empty($ref)) {
print ' | ' . price($objp->total_ht) . " | \n";
print '' . $supplierorderstatic->getLibStatut(4) . ' | ';
print "
\n";
- $i ++;
-
- if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
- $total_ht += $objp->total_ht;
- $total_qty += $objp->qty;
- }
+ $i++;
}
}
print '
';
- print '| ' . $langs->trans('Total') . ' | ';
+ if ($num < $limit) print ''.$langs->trans("Total").' | ';
+ else print ''.$langs->trans("Totalforthispage").' | ';
print ' | ';
print '' . $total_qty . ' | ';
print '' . price($total_ht) . ' | ';
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index ef3723e2e55..fc88010553b 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -46,11 +46,13 @@ $hookmanager->initHooks(array('productstatscontract'));
$mesg = '';
+// Load variable for pagination
+$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
@@ -102,7 +104,7 @@ if ($id > 0 || ! empty($ref))
print '';
print '';
- show_stats_for_company($product,$socid);
+ $nboflines = show_stats_for_company($product,$socid);
print "
";
@@ -133,7 +135,20 @@ if ($id > 0 || ! empty($ref))
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " GROUP BY c.rowid, c.ref, c.ref_customer, c.ref_supplier, c.date_contrat, c.statut, s.nom, s.rowid, s.code_client";
$sql.= $db->order($sortfield, $sortorder);
- $sql.= $db->plimit($conf->liste_limit +1, $offset);
+
+ //Calcul total qty and amount for global if full scan list
+ $total_ht=0;
+ $total_qty=0;
+
+ // Count total nb of records
+ $totalofrecords = '';
+ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ {
+ $result = $db->query($sql);
+ $totalofrecords = $db->num_rows($result);
+ }
+
+ $sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
@@ -145,7 +160,8 @@ if ($id > 0 || ! empty($ref))
$option .= '&search_month=' . $search_month;
if (! empty($search_year))
$option .= '&search_year=' . $search_year;
-
+ if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
+
print '
\n";
$i++;
-
- if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
- $total_ht+=$objp->total_ht;
- $total_qty+=$objp->qty;
- }
}
}
print '
';
- print '| ' . $langs->trans('Total') . ' | ';
+ if ($num < $limit) print ''.$langs->trans("Total").' | ';
+ else print ''.$langs->trans("Totalforthispage").' | ';
print ' | ';
print ''.$total_qty.' | ';
print ''.price($total_ht).' | ';
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 2e6b8d19677..a08486975ee 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -51,11 +51,13 @@ $hookmanager->initHooks(array('productstatssupplyinvoice'));
$mesg = '';
+// Load variable for pagination
+$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder = "DESC";
@@ -114,7 +116,7 @@ if ($id > 0 || ! empty($ref))
print '';
print '';
- show_stats_for_company($product, $socid);
+ $nboflines = show_stats_for_company($product, $socid);
print "
";
@@ -149,20 +151,17 @@ if ($id > 0 || ! empty($ref))
// Calcul total qty and amount for global if full scan list
$total_ht = 0;
$total_qty = 0;
- $totalrecords = 0;
- if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
+
+ // Count total nb of records
+ $totalofrecords = '';
+ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ {
$result = $db->query($sql);
- if ($result) {
- $totalrecords = $db->num_rows($result);
- while ( $objp = $db->fetch_object($result) ) {
- $total_ht += $objp->total_ht;
- $total_qty += $objp->qty;
- }
- }
+ $totalofrecords = $db->num_rows($result);
}
-
- $sql .= $db->plimit($conf->liste_limit + 1, $offset);
-
+
+ $sql.= $db->plimit($limit + 1, $offset);
+
$result = $db->query($sql);
if ($result)
{
@@ -174,7 +173,8 @@ if ($id > 0 || ! empty($ref))
$option .= '&search_month=' . $search_month;
if (! empty($search_year))
$option .= '&search_year=' . $search_year;
-
+ if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
+
print '