diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 1f22f4218a8..79de3a9a656 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2005 Simon Tosser * * 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 @@ -164,114 +165,151 @@ if ($_GET["action"] == 'create') } else { - if ($_GET["id"]) + if ($_GET["id"]) { - - if ($mesg) { - print $mesg; - } - - $entrepot = new Entrepot($db); - $result = $entrepot->fetch($_GET["id"]); - if (! $result) + + if ($mesg) print $mesg; + + $entrepot = new Entrepot($db); + $result = $entrepot->fetch($_GET["id"]); + if (! $result) { - dolibarr_print_error($db); + dolibarr_print_error($db); } - - /* - * Affichage fiche - */ - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') + + /* + * Affichage fiche + */ + if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') { + + /* + * Affichage onglets + */ + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("WarehouseCard"); + $hselected=$h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + + dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); + + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print '"; + print "
'.$langs->trans("Ref").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans('Address').''; + print $entrepot->address; + print '
'.$langs->trans('Zip').''.$entrepot->cp.''.$langs->trans('Town').''.$entrepot->ville.'
'.$langs->trans('Country').''; + $entrepot->pays; + print '
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
'.$langs->trans("NumberOfProducts").''; + print $entrepot->nb_products(); + print "
"; + + //affichage de la liste des produits de l\'entrepot + print ''; + print ""; - /* - * Affichage onglets - */ - $h = 0; + print_liste_field_titre($langs->trans("Product"),"", "p.ref","","","",$sortfield); - $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("WarehouseCard"); - $hselected=$h; - $h++; + print ""; + print "\n"; + $sql = "SELECT p.rowid as rowid, p.label as produit, ps.reel as value "; + $sql .= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p "; + $sql .= " WHERE ps.fk_product = p.rowid "; + $sql .= " AND ps.reel >0 AND ps.fk_entrepot = $id"; - $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); - - print '
".$langs->trans("Units")."
'; - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''; - - print '"; - print "
'.$langs->trans("Ref").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans('Address').''; - print $entrepot->address; - print '
'.$langs->trans('Zip').''.$entrepot->cp.''.$langs->trans('Town').''.$entrepot->ville.'
'.$langs->trans('Country').''; - $entrepot->pays; - print '
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
'.$langs->trans("NumberOfProducts").''; - print $entrepot->nb_products(); - print "
"; - - print "
\n"; + //$sql .= $db->plimit($limit + 1 ,$offset); + $resql = $db->query($sql) ; + if ($resql) + {$num = $db->num_rows($resql); + $i = 0; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + //print ''.dolibarr_print_date($objp->datem).''; + print "rowid\">"; + print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit; + print "\n"; + print ''.$objp->value.''; + //print "entrepot_id\">"; + //print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock; + //print "\n"; + print "\n"; + $i++; + } + $db->free($resql); + } + print "\n"; + print "
\n"; + } - - - /* - * Edition fiche - */ - if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) + + + /* + * Edition fiche + */ + if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) { - print_fiche_titre('Edition de la fiche entrepot', $mesg); - - print '
'; - print ''; - print ''; - - print ''; - print ''; - print '"; - - print ''; - - print ''; - - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Description").''; - print '
'.$langs->trans("LocationSummary").'
'.$langs->trans('Address').'
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Country').''; - $form->select_pays($entrepot->pays_id,$entrepot->pays_code); - print '
'.$langs->trans("Status").''; - print ''; - print '
 '; - print '
'; - print '
'; - + print_fiche_titre('Edition de la fiche entrepot', $mesg); + + print '
'; + print ''; + print ''; + + print ''; + print ''; + print '"; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Description").''; + print '
'.$langs->trans("LocationSummary").'
'.$langs->trans('Address').'
'.$langs->trans('Zip').''.$langs->trans('Town').'
'.$langs->trans('Country').''; + $form->select_pays($entrepot->pays_id,$entrepot->pays_code); + print '
'.$langs->trans("Status").''; + print ''; + print '
 '; + print '
'; + print '
'; + } } } @@ -293,7 +331,6 @@ if ($_GET["action"] == '') print ""; - $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$");