Ajoute onglet mouvement de stock qui concerne un entrepot donné sur fiche entrepot

This commit is contained in:
Laurent Destailleur 2006-08-19 02:30:41 +00:00
parent 4db6af8def
commit 33d2be8924
5 changed files with 118 additions and 62 deletions

View File

@ -23,6 +23,7 @@ LastMovements=Last movements
Units=Units Units=Units
StockCorrection=Stock correction StockCorrection=Stock correction
StockMovement=Transfer StockMovement=Transfer
StockMovements=Stock transferts
NumberOfUnit=Number of units NumberOfUnit=Number of units
TotalStock=Total in stock TotalStock=Total in stock
StockTooLow=Stock too low StockTooLow=Stock too low

View File

@ -23,6 +23,7 @@ LastMovements=Derniers mouvements
Units=Unités Units=Unités
StockCorrection=Correction stock StockCorrection=Correction stock
StockMovement=Transfert StockMovement=Transfert
StockMovements=Mouvements de stock
NumberOfUnit=Nombre de pièces NumberOfUnit=Nombre de pièces
TotalStock=Total en stock TotalStock=Total en stock
StockTooLow=Stock insuffisant StockTooLow=Stock insuffisant

View File

@ -113,13 +113,6 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
} }
} }
llxHeader("","",$langs->trans("WarehouseCard"));
$form=new Form($db);
if ($_POST["cancel"] == $langs->trans("Cancel")) if ($_POST["cancel"] == $langs->trans("Cancel"))
{ {
$_GET["action"] = ''; $_GET["action"] = '';
@ -127,11 +120,16 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
} }
/* /*
* Affichage fiche en mode création * Affichage fiche en mode création
* *
*/ */
llxHeader("","",$langs->trans("WarehouseCard"));
$form=new Form($db);
if ($_GET["action"] == 'create') if ($_GET["action"] == 'create')
{ {
print "<form action=\"fiche.php\" method=\"post\">\n"; print "<form action=\"fiche.php\" method=\"post\">\n";
@ -139,7 +137,8 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="type" value="'.$type.'">'."\n"; print '<input type="hidden" name="type" value="'.$type.'">'."\n";
print_titre($langs->trans("NewWarehouse")); print_titre($langs->trans("NewWarehouse"));
if ($mesg) { if ($mesg)
{
print $mesg; print $mesg;
} }
@ -156,7 +155,7 @@ if ($_GET["action"] == 'create')
{ {
// Editeur wysiwyg // Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('desc',$entrepot->description,200,'dolibarr_notes','In',false); $doleditor=new DolEditor('desc',$entrepot->description,180,'dolibarr_notes','In',false);
$doleditor->Create(); $doleditor->Create();
} }
else else
@ -176,7 +175,7 @@ if ($_GET["action"] == 'create')
$form->select_pays($entrepot->pays_id?$entrepot->pays_id:$mysoc->pays_code, 'pays_id'); $form->select_pays($entrepot->pays_id?$entrepot->pays_id:$mysoc->pays_code, 'pays_id');
print '</td></tr>'; print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
print '<select name="statut">'; print '<select name="statut">';
print '<option value="0" selected="true">'.$langs->trans("WarehouseClosed").'</option>'; print '<option value="0" selected="true">'.$langs->trans("WarehouseClosed").'</option>';
print '<option value="1">'.$langs->trans("WarehouseOpened").'</option>'; print '<option value="1">'.$langs->trans("WarehouseOpened").'</option>';
@ -196,7 +195,7 @@ else
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$result = $entrepot->fetch($_GET["id"]); $result = $entrepot->fetch($_GET["id"]);
if (! $result) if ($result < 0)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
@ -217,6 +216,10 @@ else
$hselected=$h; $hselected=$h;
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("StockMovements");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$h++; $h++;
@ -244,7 +247,8 @@ else
print $entrepot->pays; print $entrepot->pays;
print '</td></tr>'; print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>'; // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
print $entrepot->nb_products(); print $entrepot->nb_products();
@ -267,6 +271,7 @@ else
print '<tr><td valign="top"><a href="mouvement.php">'.$langs->trans("LastMovement").'</a></td><td colspan="3">'; print '<tr><td valign="top"><a href="mouvement.php">'.$langs->trans("LastMovement").'</a></td><td colspan="3">';
print dolibarr_print_date($row[0]); print dolibarr_print_date($row[0]);
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";
print '</div>'; print '</div>';
@ -368,8 +373,6 @@ else
dolibarr_print_error($db); dolibarr_print_error($db);
} }
print "</table>\n"; print "</table>\n";
print "</div>\n";
} }
@ -397,7 +400,7 @@ else
{ {
// Editeur wysiwyg // Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('desc',$entrepot->description,200,'dolibarr_notes','In',false); $doleditor=new DolEditor('desc',$entrepot->description,180,'dolibarr_notes','In',false);
$doleditor->Create(); $doleditor->Create();
} }
else else

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -53,6 +52,10 @@ $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("WarehouseCard"); $head[$h][1] = $langs->trans("WarehouseCard");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("StockMovements");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id; $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$hselected=$h; $hselected=$h;

View File

@ -22,10 +22,10 @@
*/ */
/** /**
\file htdocs/product/stock/mouvement.php \file htdocs/product/stock/mouvement.php
\ingroup stock \ingroup stock
\brief Page liste des mouvements de stocks \brief Page liste des mouvements de stocks
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -51,13 +51,13 @@ $sql = "SELECT p.rowid, p.label as produit, s.label as stock, m.value, ".$db->pd
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as s, ".MAIN_DB_PREFIX."stock_mouvement as m, ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as s, ".MAIN_DB_PREFIX."stock_mouvement as m, ".MAIN_DB_PREFIX."product as p";
if ($conf->categorie->enabled && !$user->rights->categorie->voir) if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
} }
$sql .= " WHERE m.fk_product = p.rowid AND m.fk_entrepot = s.rowid"; $sql .= " WHERE m.fk_product = p.rowid AND m.fk_entrepot = s.rowid";
if ($conf->categorie->enabled && !$user->rights->categorie->voir) if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{ {
$sql.= ' AND IFNULL(c.visible,1)=1'; $sql.= ' AND IFNULL(c.visible,1)=1';
} }
$sql .= " ORDER BY $sortfield $sortorder "; $sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->plimit($limit + 1 ,$offset); $sql .= $db->plimit($limit + 1 ,$offset);
@ -65,48 +65,96 @@ $result = $db->query($sql) ;
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; if ($_GET["id"])
{
$entrepot = new Entrepot($db);
$result = $entrepot->fetch($_GET["id"]);
if ($result < 0)
{
dolibarr_print_error($db);
}
}
$texte = $langs->trans("ListOfStockMovements"); $i = 0;
llxHeader("","",$texte);
print_barre_liste($texte, $page, "mouvement.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); $texte = $langs->trans("ListOfStockMovements");
llxHeader("","",$texte);
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Date"),"mouvement.php", "m.datem","","","",$sortfield);
print_liste_field_titre($langs->trans("Product"),"mouvement.php", "p.ref","","","",$sortfield);
print "<td align=\"center\">".$langs->trans("Units")."</td>";
print_liste_field_titre($langs->trans("Warehouse"),"mouvement.php", "s.label","","","",$sortfield);
print "</tr>\n";
$var=True; /*
while ($i < min($num,$limit)) * Affichage onglets
{ */
$objp = $db->fetch_object($result); if ($_GET["id"])
$var=!$var; {
print "<tr $bc[$var]>"; $h = 0;
print '<td>'.dolibarr_print_date($objp->datem).'</td>';
print "<td><a href=\"../fiche.php?id=$objp->rowid\">";
print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit;
print "</a></td>\n";
print '<td align="center">'.$objp->value.'</td>';
print "<td><a href=\"fiche.php?id=$objp->entrepot_id\">";
print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock;
print "</a></td>\n";
print "</tr>\n";
$i++;
}
$db->free($result);
print "</table>"; $head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("WarehouseCard");
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
$head[$h][1] = $langs->trans("StockMovements");
$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 '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$entrepot->libelle.'</td>';
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
print "</table>";
print '</div>';
}
print_barre_liste($texte, $page, "mouvement.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num);
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Date"),"mouvement.php", "m.datem","","","",$sortfield);
print_liste_field_titre($langs->trans("Product"),"mouvement.php", "p.ref","","","",$sortfield);
print "<td align=\"center\">".$langs->trans("Units")."</td>";
print_liste_field_titre($langs->trans("Warehouse"),"mouvement.php", "s.label","","","",$sortfield);
print "</tr>\n";
$var=True;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td>'.dolibarr_print_date($objp->datem).'</td>';
print "<td><a href=\"../fiche.php?id=$objp->rowid\">";
print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit;
print "</a></td>\n";
print '<td align="center">'.$objp->value.'</td>';
print "<td><a href=\"fiche.php?id=$objp->entrepot_id\">";
print img_object($langs->trans("ShowWarehous"),"stock").' '.$objp->stock;
print "</a></td>\n";
print "</tr>\n";
$i++;
}
$db->free($result);
print "</table>";
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }