Split the page in two tabs, filters and pagination should work now
This commit is contained in:
parent
e9ef91cdbc
commit
a637127599
@ -266,7 +266,14 @@ if ($resql) {
|
||||
$helpurl .= 'ES:Módulo_Stocks';
|
||||
$texte = $langs->trans('Replenishment');
|
||||
llxHeader('', $title, $helpurl, $texte);
|
||||
|
||||
$head = array();
|
||||
$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
|
||||
$head[0][1] = $title;
|
||||
$head[0][2] = 'replenish';
|
||||
$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
|
||||
$head[1][1] = $langs->trans("ReplenishmentOrders");
|
||||
$head[1][2] = 'replenishorders';
|
||||
dol_fiche_head($head, 'replenish', $title, 0, 'stock');
|
||||
if ($sref || $snom || $sall || GETPOST('search')) {
|
||||
print_barre_liste($texte,
|
||||
$page,
|
||||
@ -305,7 +312,7 @@ if ($resql) {
|
||||
print '<input type="hidden" name="type" value="' . $type . '">';
|
||||
print '<input type="hidden" name="linecount" value="' . $num . '">';
|
||||
print '<input type="hidden" name="action" value="order">';
|
||||
|
||||
//print '</div>';
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// Filter on categories
|
||||
@ -589,220 +596,6 @@ else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$commandestatic = new CommandeFournisseur($db);
|
||||
$sref = GETPOST('search_ref');
|
||||
$snom = GETPOST('search_nom');
|
||||
$suser = GETPOST('search_user');
|
||||
$sttc = GETPOST('search_ttc');
|
||||
$sall = GETPOST('search_all');
|
||||
|
||||
$page = GETPOST('page', 'int');
|
||||
|
||||
$sortorder = 'DESC';
|
||||
$sortfield = 'cf.date_creation';
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,';
|
||||
$sql .= ' cf.rowid,cf.ref, cf.fk_statut, cf.total_ttc';
|
||||
$sql .= ", cf.fk_user_author, u.login";
|
||||
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'societe as s,';
|
||||
$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
|
||||
}
|
||||
$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ';
|
||||
$sql .= 'ON cf.fk_user_author = u.rowid';
|
||||
$sql .= ' WHERE cf.fk_soc = s.rowid ';
|
||||
$sql .= ' AND cf.entity = ' . $conf->entity;
|
||||
$sql .= ' AND cf.source = 42';
|
||||
$sql .= ' AND cf.fk_statut < 5';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
|
||||
}
|
||||
if ($sref) {
|
||||
$sql .= ' AND cf.ref LIKE "%' . $db->escape($sref) . '%"';
|
||||
}
|
||||
if ($snom) {
|
||||
$sql .= ' AND s.nom LIKE "%' . $db->escape($snom) . '%"';
|
||||
}
|
||||
if ($suser) {
|
||||
$sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"';
|
||||
}
|
||||
if ($sttc) {
|
||||
$sql .= ' AND total_ttc = ' . price2num($sttc);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
|
||||
$sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= ' AND s.rowid = ' . $socid;
|
||||
}
|
||||
|
||||
if (GETPOST('statut'))
|
||||
{
|
||||
$sql .= ' AND fk_statut = ' . GETPOST('statut');
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('ReplenishmentOrders'),
|
||||
$page,
|
||||
'replenish.php',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
$num
|
||||
);
|
||||
print '<form action="replenish.php" method="GET">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('Company'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('Author'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('AmountTTC'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('OrderCreation'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'align="center"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('Status'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_ref" value="' . $sref . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_nom" value="' . $snom . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_user" value="' . $suser . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">';
|
||||
print '</td>';
|
||||
print '<td colspan="2" class="liste_titre" align="right">';
|
||||
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
|
||||
$value = dol_escape_htmltag($langs->trans('Search'));
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="'.$value.'" title="'.$value.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = true;
|
||||
$userstatic = new User($db);
|
||||
|
||||
while($i < min($num,$conf->liste_limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
// Ref
|
||||
print '<td>';
|
||||
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
|
||||
print '<a href="' . $href . '">';
|
||||
print img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref;
|
||||
print '</a></td>'."";
|
||||
|
||||
// Company
|
||||
print '<td>';
|
||||
$href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
|
||||
print '<a href="' . $href .'">';
|
||||
print img_object($langs->trans('ShowCompany'), 'company') . ' ' . $obj->nom;
|
||||
print '</a></td>'."";
|
||||
|
||||
// Author
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
$userstatic->login = $obj->login;
|
||||
print '<td>';
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td align="right" width="100">';
|
||||
print price($obj->total_ttc);
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="center" width="100">';
|
||||
if ($obj->dc) {
|
||||
print dol_print_date($db->jdate($obj->dc), 'day');
|
||||
}
|
||||
else {
|
||||
print '-';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="right">';
|
||||
print $commandestatic->LibStatut($obj->fk_statut, 5);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
269
htdocs/product/stock/replenishorders.php
Normal file
269
htdocs/product/stock/replenishorders.php
Normal file
@ -0,0 +1,269 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/product/stock/replenishorders.php
|
||||
* \ingroup produit
|
||||
* \brief Page to list replenishment orders
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("stocks");
|
||||
$langs->load("orders");
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'produit|service');
|
||||
|
||||
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
|
||||
$helpurl .= 'ES:Módulo_Stocks';
|
||||
$texte = $langs->trans('ReplenishmentOrders');
|
||||
llxHeader('', $texte, $helpurl, $texte);
|
||||
$head = array();
|
||||
$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
|
||||
$head[0][1] = $langs->trans('Replenishment');
|
||||
$head[0][2] = 'replenish';
|
||||
$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
|
||||
$head[1][1] = $langs->trans("ReplenishmentOrders");
|
||||
$head[1][2] = 'replenishorders';
|
||||
dol_fiche_head($head, 'replenishorders', $langs->trans("Replenishment"), 0, 'stock');
|
||||
$commandestatic = new CommandeFournisseur($db);
|
||||
$sref = GETPOST('search_ref');
|
||||
$snom = GETPOST('search_nom');
|
||||
$suser = GETPOST('search_user');
|
||||
$sttc = GETPOST('search_ttc');
|
||||
$sall = GETPOST('search_all');
|
||||
|
||||
$page = GETPOST('page', 'int');
|
||||
|
||||
$sortorder = GETPOST('sortorder');
|
||||
$sortfield = GETPOST('sortfield');
|
||||
if(!$sortorder) $sortorder = 'DESC';
|
||||
if(!$sortfield) $sortfield = 'cf.date_creation';
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,';
|
||||
$sql .= ' cf.rowid,cf.ref, cf.fk_statut, cf.total_ttc';
|
||||
$sql .= ", cf.fk_user_author, u.login";
|
||||
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'societe as s,';
|
||||
$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
|
||||
}
|
||||
$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ';
|
||||
$sql .= 'ON cf.fk_user_author = u.rowid';
|
||||
$sql .= ' WHERE cf.fk_soc = s.rowid ';
|
||||
$sql .= ' AND cf.entity = ' . $conf->entity;
|
||||
$sql .= ' AND cf.source = 42';
|
||||
$sql .= ' AND cf.fk_statut < 5';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
|
||||
}
|
||||
if ($sref) {
|
||||
$sql .= ' AND cf.ref LIKE "%' . $db->escape($sref) . '%"';
|
||||
}
|
||||
if ($snom) {
|
||||
$sql .= ' AND s.nom LIKE "%' . $db->escape($snom) . '%"';
|
||||
}
|
||||
if ($suser) {
|
||||
$sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"';
|
||||
}
|
||||
if ($sttc) {
|
||||
$sql .= ' AND cf.total_ttc = ' . price2num($sttc);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
|
||||
$sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= ' AND s.rowid = ' . $socid;
|
||||
}
|
||||
|
||||
if (GETPOST('statut'))
|
||||
{
|
||||
$sql .= ' AND fk_statut = ' . GETPOST('statut');
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('ReplenishmentOrders'),
|
||||
$page,
|
||||
'replenishorders.php',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
$num
|
||||
);
|
||||
print '<form action="replenish.php" method="GET">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.ref',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('Company'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
's.nom',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('Author'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'u.login',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('AmountTTC'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.total_ttc',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('OrderCreation'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.date_creation',
|
||||
'',
|
||||
'',
|
||||
'align="center"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre($langs->trans('Status'),
|
||||
$_SERVER['PHP_SELF'],
|
||||
'cf.fk_statut',
|
||||
'',
|
||||
'',
|
||||
'align="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_ref" value="' . $sref . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_nom" value="' . $snom . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_user" value="' . $suser . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">';
|
||||
print '</td>';
|
||||
print '<td colspan="2" class="liste_titre" align="right">';
|
||||
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
|
||||
$value = dol_escape_htmltag($langs->trans('Search'));
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="'.$value.'" title="'.$value.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = true;
|
||||
$userstatic = new User($db);
|
||||
|
||||
while($i < min($num,$conf->liste_limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
// Ref
|
||||
print '<td>';
|
||||
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
|
||||
print '<a href="' . $href . '">';
|
||||
print img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref;
|
||||
print '</a></td>'."";
|
||||
|
||||
// Company
|
||||
print '<td>';
|
||||
$href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
|
||||
print '<a href="' . $href .'">';
|
||||
print img_object($langs->trans('ShowCompany'), 'company') . ' ' . $obj->nom;
|
||||
print '</a></td>'."";
|
||||
|
||||
// Author
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
$userstatic->login = $obj->login;
|
||||
print '<td>';
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getLoginUrl(1);
|
||||
}
|
||||
else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td align="right" width="100">';
|
||||
print price($obj->total_ttc);
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="center" width="100">';
|
||||
if ($obj->dc) {
|
||||
print dol_print_date($db->jdate($obj->dc), 'day');
|
||||
}
|
||||
else {
|
||||
print '-';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="right">';
|
||||
print $commandestatic->LibStatut($obj->fk_statut, 5);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user