New: Add value of stock in movement pages
This commit is contained in:
parent
05ea7a0af9
commit
31a9a9d65f
@ -54,7 +54,7 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Constructeur de l'objet entrepot
|
* \brief Constructeur de l'objet entrepot
|
||||||
* \param DB Handler d'accès à la base de donnée
|
* \param DB Handler d'acc<EFBFBD>s <EFBFBD> la base de donn<EFBFBD>e
|
||||||
*/
|
*/
|
||||||
function Entrepot($DB)
|
function Entrepot($DB)
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Creation d'un entrepot en base
|
* \brief Creation d'un entrepot en base
|
||||||
* \param Objet user qui crée l'entrepot
|
* \param Objet user qui cr<EFBFBD>e l'entrepot
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Mise a jour des information d'un entrepot
|
* \brief Mise a jour des information d'un entrepot
|
||||||
* \param id id de l'entrepot à modifier
|
* \param id id de l'entrepot <EFBFBD> modifier
|
||||||
* \param user
|
* \param user
|
||||||
*/
|
*/
|
||||||
function update($id, $user)
|
function update($id, $user)
|
||||||
@ -162,8 +162,8 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Recupéeration de la base d'un entrepot
|
* \brief Recup<EFBFBD>eration de la base d'un entrepot
|
||||||
* \param id id de l'entrepot a récupérer
|
* \param id id de l'entrepot a r<EFBFBD>cup<EFBFBD>rer
|
||||||
*/
|
*/
|
||||||
function fetch ($id)
|
function fetch ($id)
|
||||||
{
|
{
|
||||||
@ -262,7 +262,7 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la liste des entrepôts ouverts
|
* \brief Renvoie la liste des entrep<EFBFBD>ts ouverts
|
||||||
*/
|
*/
|
||||||
function list_array()
|
function list_array()
|
||||||
{
|
{
|
||||||
@ -290,13 +290,16 @@ class Entrepot extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le stock (nombre de produits) de l'entrepot
|
* \brief Renvoie le stock (nombre de produits) et valorisation de l'entrepot
|
||||||
|
* \return Array Array('nb'=>Nb, 'value'=>Value)
|
||||||
*/
|
*/
|
||||||
function nb_products()
|
function nb_products()
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
$sql = "SELECT sum(ps.reel)";
|
$ret=array();
|
||||||
|
|
||||||
|
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value";
|
||||||
$sql .= " FROM llx_product_stock as ps";
|
$sql .= " FROM llx_product_stock as ps";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||||
{
|
{
|
||||||
@ -309,24 +312,28 @@ class Entrepot extends CommonObject
|
|||||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//print $sql;
|
||||||
$result = $this->db->query($sql) ;
|
$result = $this->db->query($sql) ;
|
||||||
|
if ($result)
|
||||||
if ( $result )
|
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row(0);
|
$obj = $this->db->fetch_object($result);
|
||||||
return $row[0];
|
$ret['nb']=$obj->nb;
|
||||||
|
$ret['value']=$obj->value;
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le libellé du statut d'un entrepot (ouvert, ferme)
|
* \brief Retourne le libell<EFBFBD> du statut d'un entrepot (ouvert, ferme)
|
||||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
|
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long
|
||||||
* \return string Libelle
|
* \return string Libelle
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
@ -335,10 +342,10 @@ class Entrepot extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi le libellé d'un statut donné
|
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
||||||
* \param statut Id statut
|
* \param statut Id statut
|
||||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||||
* \return string Libellé du statut
|
* \return string Libell<EFBFBD> du statut
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode=0)
|
function LibStatut($statut,$mode=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2009 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
|
||||||
@ -112,9 +112,18 @@ if ($_GET["id"])
|
|||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
$calcproducts=$entrepot->nb_products();
|
||||||
|
|
||||||
|
// Nb of products
|
||||||
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 empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// Value
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("EstimatedStockValueShort").'</td><td colspan="3">';
|
||||||
|
print empty($calcproducts['value'])?'0':$calcproducts['value'];
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -255,13 +255,16 @@ else
|
|||||||
// Description
|
// Description
|
||||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
||||||
|
|
||||||
|
// Address
|
||||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
||||||
print $entrepot->address;
|
print $entrepot->address;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Ville
|
||||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
||||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
||||||
|
|
||||||
|
// Country
|
||||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||||
print $entrepot->pays;
|
print $entrepot->pays;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -269,10 +272,16 @@ else
|
|||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
$calcproducts=$entrepot->nb_products();
|
||||||
|
|
||||||
// Nb of products
|
// Nb of products
|
||||||
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
|
||||||
$nb=$entrepot->nb_products();
|
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
||||||
print empty($nb)?'0':$nb;
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// Value
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("EstimatedStockValueShort").'</td><td colspan="3">';
|
||||||
|
print empty($calcproducts['value'])?'0':$calcproducts['value'];
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Last movement
|
// Last movement
|
||||||
@ -326,12 +335,15 @@ else
|
|||||||
print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "ps.pmp","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "ps.pmp","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
|
||||||
if ($user->rights->stock->mouvement->creer) print '<td> </td>';
|
if ($user->rights->stock->mouvement->creer) print '<td> </td>';
|
||||||
if ($user->rights->stock->creer) print '<td> </td>';
|
if ($user->rights->stock->creer) print '<td> </td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
$totalunit=0;
|
||||||
|
$totalvalue=0;
|
||||||
|
|
||||||
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type,";
|
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type,";
|
||||||
$sql.= " ps.pmp, ps.reel as value";
|
$sql.= " ps.pmp, ps.reel as value";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
|
||||||
@ -348,7 +360,6 @@ else
|
|||||||
$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);
|
||||||
|
|
||||||
$resql = $db->query($sql) ;
|
$resql = $db->query($sql) ;
|
||||||
@ -390,10 +401,12 @@ else
|
|||||||
print '<td>'.$objp->produit.'</td>';
|
print '<td>'.$objp->produit.'</td>';
|
||||||
|
|
||||||
print '<td align="right">'.$objp->value.'</td>';
|
print '<td align="right">'.$objp->value.'</td>';
|
||||||
|
$totalunit+=$objp->value;
|
||||||
|
|
||||||
print '<td align="center">'.price(price2num($objp->pmp,'MU')).'</td>';
|
print '<td align="right">'.price(price2num($objp->pmp,'MU')).'</td>';
|
||||||
|
|
||||||
print '<td align="center">'.price(price2num($objp->pmp*$objp->value,'MT')).'</td>';
|
print '<td align="right">'.price(price2num($objp->pmp*$objp->value,'MT')).'</td>';
|
||||||
|
$totalvalue+=price2num($objp->pmp*$objp->value,'MT');
|
||||||
|
|
||||||
if ($user->rights->stock->mouvement->creer)
|
if ($user->rights->stock->mouvement->creer)
|
||||||
{
|
{
|
||||||
@ -413,6 +426,15 @@ else
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
|
print '<tr class="liste_total"><td class="liste_total" colspan="2">'.$langs->trans("Total").'</td>';
|
||||||
|
print '<td class="liste_total" align="right">'.$totalunit.'</td>';
|
||||||
|
print '<td class="liste_total"> </td>';
|
||||||
|
print '<td class="liste_total" align="right">'.$totalvalue.'</td>';
|
||||||
|
print '<td class="liste_total"> </td>';
|
||||||
|
print '<td class="liste_total"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/product/stock/info.php
|
* \file htdocs/product/stock/info.php
|
||||||
\ingroup facture
|
* \ingroup stock
|
||||||
\brief Page des informations d'un entrepot
|
* \brief Page des informations d'un entrepot
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|||||||
@ -166,9 +166,56 @@ if ($resql)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>';
|
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
||||||
|
|
||||||
|
// Address
|
||||||
|
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
||||||
|
print $entrepot->address;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Ville
|
||||||
|
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
||||||
|
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
||||||
|
|
||||||
|
// Country
|
||||||
|
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||||
|
print $entrepot->pays;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
$calcproducts=$entrepot->nb_products();
|
||||||
|
|
||||||
|
// Nb of products
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
|
||||||
|
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// Value
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("EstimatedStockValueShort").'</td><td colspan="3">';
|
||||||
|
print empty($calcproducts['value'])?'0':$calcproducts['value'];
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
// Last movement
|
||||||
|
$sql = "SELECT max( ".$db->pdate("m.datem").") as datem";
|
||||||
|
$sql .= " FROM llx_stock_mouvement as m";
|
||||||
|
$sql .= " WHERE m.fk_entrepot = '".$entrepot->id."';";
|
||||||
|
$resqlbis = $db->query($sql);
|
||||||
|
if ($resqlbis)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resqlbis);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("LastMovement").'</td><td colspan="3">';
|
||||||
|
print '<a href="mouvement.php?id='.$entrepot->id.'">'.dol_print_date($row[0]).'</a>';
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -20,11 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/product/stock/user.php
|
\file htdocs/product/stock/user.php
|
||||||
\ingroup stock
|
\ingroup stock
|
||||||
\brief Page to link dolibarr users with warehouses
|
\brief Page to link dolibarr users with warehouses
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
@ -49,132 +49,131 @@ $mesg = '';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage fiche en mode création
|
* View
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
llxHeader("","",$langs->trans("WarehouseCard"));
|
llxHeader("","",$langs->trans("WarehouseCard"));
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
{
|
{
|
||||||
if ($mesg) print $mesg;
|
if ($mesg) print $mesg;
|
||||||
|
|
||||||
$entrepot = new Entrepot($db);
|
|
||||||
$result = $entrepot->fetch($_GET["id"]);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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");
|
|
||||||
$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/fiche-valo.php?id='.$entrepot->id;
|
|
||||||
$head[$h][1] = $langs->trans("EnhancedValue");
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id;
|
$entrepot = new Entrepot($db);
|
||||||
$head[$h][1] = $langs->trans("Users");
|
$result = $entrepot->fetch($_GET["id"]);
|
||||||
$hselected=$h;
|
if ($result < 0)
|
||||||
$h++;
|
{
|
||||||
|
dol_print_error($db);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
|
}
|
||||||
$head[$h][1] = $langs->trans("Info");
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle);
|
/*
|
||||||
|
* Affichage fiche
|
||||||
print '<table class="border" width="100%">';
|
*/
|
||||||
|
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
|
||||||
// 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>';
|
|
||||||
|
|
||||||
// Description
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
/*
|
||||||
print $entrepot->address;
|
* Affichage onglets
|
||||||
print '</td></tr>';
|
*/
|
||||||
|
$h = 0;
|
||||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
|
||||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
|
||||||
print $entrepot->pays;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Statut
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* Barre d'action */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
print "<div class=\"tabsAction\">\n";
|
|
||||||
|
|
||||||
print "</div>";
|
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id;
|
||||||
/* ************************************************************************** */
|
$head[$h][1] = $langs->trans("WarehouseCard");
|
||||||
/* */
|
$h++;
|
||||||
/* Affichage des utilisateurs de l'entrepot */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print_liste_field_titre($langs->trans("User"),"", "p.ref","&id=".$_GET['id'],"",'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
|
|
||||||
print "</tr>";
|
|
||||||
$sql = "SELECT u.rowid as rowid, u.name, u.firstname, ue.send, ue.consult ";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."user_entrepot as ue, ".MAIN_DB_PREFIX."user as u ";
|
|
||||||
|
|
||||||
$sql .= " WHERE ue.fk_user = u.rowid ";
|
$head[$h][0] = DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id;
|
||||||
$sql .= " AND ue.fk_entrepot = ".$entrepot->id;
|
$head[$h][1] = $langs->trans("StockMovements");
|
||||||
|
$h++;
|
||||||
//$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
|
||||||
//$sql .= $db->plimit($limit + 1 ,$offset);
|
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$entrepot->id;
|
||||||
|
$head[$h][1] = $langs->trans("EnhancedValue");
|
||||||
$resql = $db->query($sql) ;
|
$h++;
|
||||||
if ($resql)
|
|
||||||
{
|
$head[$h][0] = DOL_URL_ROOT.'/product/stock/user.php?id='.$entrepot->id;
|
||||||
$num = $db->num_rows($resql);
|
$head[$h][1] = $langs->trans("Users");
|
||||||
$i = 0;
|
$hselected=$h;
|
||||||
$var=True;
|
$h++;
|
||||||
while ($i < $num)
|
|
||||||
{
|
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$entrepot->id;
|
||||||
|
$head[$h][1] = $langs->trans("Info");
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
dol_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>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
|
||||||
|
print $entrepot->address;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>';
|
||||||
|
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||||
|
print $entrepot->pays;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Barre d'action */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
print "<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Affichage des utilisateurs de l'entrepot */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print_liste_field_titre($langs->trans("User"),"", "p.ref","&id=".$_GET['id'],"",'align="left"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
|
||||||
|
print "</tr>";
|
||||||
|
$sql = "SELECT u.rowid as rowid, u.name, u.firstname, ue.send, ue.consult ";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."user_entrepot as ue, ".MAIN_DB_PREFIX."user as u ";
|
||||||
|
|
||||||
|
$sql .= " WHERE ue.fk_user = u.rowid ";
|
||||||
|
$sql .= " AND ue.fk_entrepot = ".$entrepot->id;
|
||||||
|
|
||||||
|
//$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
||||||
|
//$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);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
@ -185,16 +184,16 @@ $form=new Form($db);
|
|||||||
print '<td align="center">'.$objp->send.'</td>';
|
print '<td align="center">'.$objp->send.'</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user