diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 58ec2ac4079..77941d940df 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -48,11 +48,13 @@ $hookmanager->initHooks(array('productstatsorder')); $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"; @@ -111,7 +113,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - show_stats_for_company($product,$socid); + $nboflines = show_stats_for_company($product, $socid); print "
"; @@ -141,24 +143,21 @@ if ($id > 0 || ! empty($ref)) $sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')'; if (!$user->rights->societe->client->voir && !$socid) $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)) { + + // 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) @@ -171,6 +170,7 @@ 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 (! empty($sortfield)) @@ -182,7 +182,7 @@ if ($id > 0 || ! empty($ref)) $option .= '&page=' . $page; } - print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,''); + print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - '; @@ -210,18 +210,22 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { - 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 ''; @@ -231,15 +235,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 61f44371f0c..da5c8f24911 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -118,7 +118,7 @@ if ($id > 0 || ! empty($ref)) { print '
'; print ''; - show_stats_for_company($product, $socid); + $nboflines = show_stats_for_company($product, $socid); print "
"; @@ -152,24 +152,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)) { + + // 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) { @@ -181,6 +178,7 @@ 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 (! empty($sortfield)) @@ -192,7 +190,7 @@ if ($id > 0 || ! empty($ref)) { $option .= '&page=' . $page; } - print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); print '
'; print '
'; print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - '; @@ -218,19 +216,24 @@ if ($id > 0 || ! empty($ref)) { print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; - if ($num > 0) { - - while ( $i < $num && $i < $conf->liste_limit ) { + if ($num > 0) + { + while ($i < min($num, $limit)) + { $objp = $db->fetch_object($result); - 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 ''; @@ -239,16 +242,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 6459856c0af..c01cbd40530 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -45,11 +45,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"; @@ -101,7 +103,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - show_stats_for_company($product,$socid); + $nboflines = show_stats_for_company($product,$socid); print "
"; @@ -132,7 +134,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) @@ -144,6 +159,7 @@ 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 (! empty($sortfield)) @@ -155,7 +171,7 @@ if ($id > 0 || ! empty($ref)) $option .= '&page=' . $page; } - print_barre_liste($langs->trans("Contrats"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); + print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); $i = 0; print '
'; @@ -176,7 +192,7 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { - while ($i < $num && $i < $conf->liste_limit) + while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index a1eb69c0611..d0c75ac90b4 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -49,15 +49,18 @@ $hookmanager->initHooks(array('productstatsinvoice')); $showmessage=GETPOST('showmessage'); +// 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"; if (! $sortfield) $sortfield="f.datef"; + $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); @@ -128,7 +131,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - $nboflines = show_stats_for_company($product,$socid); + $nboflines = show_stats_for_company($product, $socid); print "
"; @@ -163,25 +166,19 @@ if ($id > 0 || ! empty($ref)) if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= $db->order($sortfield, $sortorder); - //Calcul total qty and amount for global if full scan list + // Calcul total qty and amount for global if full scan list $total_ht=0; $total_qty=0; - $totalrecords=0; + + // 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) @@ -193,7 +190,8 @@ if ($id > 0 || ! empty($ref)) if (! empty($search_month)) $option .= '&search_month='.$search_month; if (! empty($search_year)) - $option .= '&search_year='.$search_year; + $option .= '&search_year='.$search_year; + if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit); print '' . "\n"; if (! empty($sortfield)) @@ -205,7 +203,7 @@ if ($id > 0 || ! empty($ref)) $option .= '&page=' . $page; } - print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,''); + print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"],"&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - '; @@ -233,10 +231,13 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); + $total_ht+=$objp->total_ht; + $total_qty+=$objp->qty; + $invoicestatic->id=$objp->facid; $invoicestatic->ref=$objp->facnumber; $societestatic->fetch($objp->socid); @@ -255,15 +256,11 @@ if ($id > 0 || ! empty($ref)) print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).''; 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 ea67553e632..fbf75377694 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -49,11 +49,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"; @@ -112,7 +114,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - show_stats_for_company($product, $socid); + $nboflines = show_stats_for_company($product, $socid); print "
"; @@ -147,19 +149,16 @@ 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) @@ -172,6 +171,7 @@ 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 (! empty($sortfield)) @@ -183,7 +183,7 @@ if ($id > 0 || ! empty($ref)) $option .= '&page=' . $page; } - print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); print '
'; print '
'; print $langs->trans('Period') . ' (' . $langs->trans("DateInvoice") . ') - '; @@ -211,10 +211,13 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { - 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; + $supplierinvoicestatic->id = $objp->facid; $supplierinvoicestatic->ref = $objp->ref; $supplierinvoicestatic->ref_supplier = $objp->ref_supplier; @@ -222,12 +225,13 @@ if ($id > 0 || ! empty($ref)) $supplierinvoicestatic->total_ht = $objp->total_ht; $supplierinvoicestatic->total_ttc = $objp->total_ttc; $supplierinvoicestatic->total_tva = $objp->total_tva; + $supplierinvoicestatic->ref = $objp->facnumber; + $societestatic->fetch($objp->socid); print ''; print ''; print $supplierinvoicestatic->getNomUrl(1); print "\n"; - $societestatic->fetch($objp->socid); print '' . $societestatic->getNomUrl(1) . ''; print "" . $objp->code_client . "\n"; print ''; @@ -236,16 +240,12 @@ if ($id > 0 || ! empty($ref)) print '' . price($objp->total_ht) . "\n"; print '' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . ''; 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/propal.php b/htdocs/product/stats/propal.php index 69c567508f3..80256037dfe 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - show_stats_for_company($product, $socid); + $nboflines = show_stats_for_company($product, $socid); print "
"; @@ -148,24 +148,21 @@ if ($id > 0 || ! empty($ref)) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; if ($socid) $sql .= " AND p.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)) { + + // 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->amount; - $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) @@ -178,6 +175,7 @@ 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 (! empty($sortfield)) @@ -189,7 +187,7 @@ if ($id > 0 || ! empty($ref)) $option .= '&page=' . $page; } - print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); print '
'; print '
'; print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - '; @@ -216,18 +214,22 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { - while ($i < $num && $i < $conf->liste_limit) + while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); - print ''; - print ''; + $total_ht+=$objp->amount; + $total_qty+=$objp->qty; + $propalstatic->id=$objp->propalid; $propalstatic->ref=$objp->ref; $propalstatic->ref_client=$objp->ref_client; - print $propalstatic->getNomUrl(1); - print "\n"; $societestatic->fetch($objp->socid); + + print ''; + print ''; + print $propalstatic->getNomUrl(1); + print "\n"; print ''.$societestatic->getNomUrl(1).''; print ''; print dol_print_date($db->jdate($objp->datep), 'dayhour') . ""; @@ -235,17 +237,13 @@ if ($id > 0 || ! empty($ref)) print '' . price($objp->amount) . '' . "\n"; print '' . $propalstatic->LibStatut($objp->statut, 5) . ''; 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/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index c040e3ae3a5..cac015171cf 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - show_stats_for_company($product, $socid); + $nboflines = show_stats_for_company($product, $socid); print "
"; @@ -148,24 +148,21 @@ if ($id > 0 || ! empty($ref)) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; if ($socid) $sql .= " AND p.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)) { + + // 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->amount; - $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) @@ -178,6 +175,7 @@ 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 (! empty($sortfield)) @@ -189,7 +187,7 @@ if ($id > 0 || ! empty($ref)) $option .= '&page=' . $page; } - print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit); print '
'; print '
'; print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - '; @@ -216,17 +214,21 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { - while ($i < $num && $i < $conf->liste_limit) + while ($i < min($num, $limit)) { $objp = $db->fetch_object($result); - print ''; - print ''; + $total_ht+=$objp->amount; + $total_qty+=$objp->qty; + $propalstatic->id=$objp->propalid; $propalstatic->ref=$objp->ref; - print $propalstatic->getNomUrl(1); - print "\n"; $societestatic->fetch($objp->socid); + + print ''; + print ''; + print $propalstatic->getNomUrl(1); + print "\n"; print ''.$societestatic->getNomUrl(1).''; print ''; print dol_print_date($db->jdate($objp->date_valid), 'dayhour') . ""; @@ -234,17 +236,13 @@ if ($id > 0 || ! empty($ref)) print '' . price($objp->amount) . '' . "\n"; print '' . $propalstatic->LibStatut($objp->statut, 5) . ''; 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) . '';