New: Add total of unique different product into warehouse
This commit is contained in:
parent
cf89a8e96a
commit
3fb890e9b7
@ -27,6 +27,7 @@ ListOfStockMovements=List of stock movements
|
|||||||
StocksArea=Stocks area
|
StocksArea=Stocks area
|
||||||
Location=Location
|
Location=Location
|
||||||
LocationSummary=Short name location
|
LocationSummary=Short name location
|
||||||
|
NumberOfDifferentProducts=Number of different products
|
||||||
NumberOfProducts=Total number of products
|
NumberOfProducts=Total number of products
|
||||||
LastMovement=Last movement
|
LastMovement=Last movement
|
||||||
LastMovements=Last movements
|
LastMovements=Last movements
|
||||||
|
|||||||
@ -27,6 +27,7 @@ ListOfStockMovements=Liste des mouvements de stock
|
|||||||
StocksArea=Espace stocks
|
StocksArea=Espace stocks
|
||||||
Location=Lieu
|
Location=Lieu
|
||||||
LocationSummary=Nom court du lieu
|
LocationSummary=Nom court du lieu
|
||||||
|
NumberOfDifferentProducts=Nombre de produits différents
|
||||||
NumberOfProducts=Nombre total de produits
|
NumberOfProducts=Nombre total de produits
|
||||||
LastMovement=Dernier mouvement
|
LastMovement=Dernier mouvement
|
||||||
LastMovements=Derniers mouvements
|
LastMovements=Derniers mouvements
|
||||||
|
|||||||
@ -377,6 +377,38 @@ class Entrepot extends CommonObject
|
|||||||
return $liste;
|
return $liste;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return number of unique different product into a warehosue
|
||||||
|
*
|
||||||
|
* @return Array Array('nb'=>Nb, 'value'=>Value)
|
||||||
|
*/
|
||||||
|
function nb_different_products()
|
||||||
|
{
|
||||||
|
$ret=array();
|
||||||
|
|
||||||
|
$sql = "SELECT count(distinct p.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
|
$sql.= " WHERE ps.fk_entrepot = ".$this->id;
|
||||||
|
$sql.= " AND ps.fk_product = p.rowid";
|
||||||
|
|
||||||
|
//print $sql;
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
$ret['nb']=$obj->nb;
|
||||||
|
$this->db->free($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return stock and value of warehosue
|
* Return stock and value of warehosue
|
||||||
*
|
*
|
||||||
|
|||||||
@ -276,8 +276,14 @@ else
|
|||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
|
$calcproductsunique=$object->nb_different_products();
|
||||||
$calcproducts=$object->nb_products();
|
$calcproducts=$object->nb_products();
|
||||||
|
|
||||||
|
// Total nb of different products
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("NumberOfDifferentProducts").'</td><td colspan="3">';
|
||||||
|
print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb'];
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
// 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">';
|
||||||
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
||||||
|
|||||||
@ -236,8 +236,14 @@ if ($resql)
|
|||||||
// Status
|
// Status
|
||||||
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>';
|
||||||
|
|
||||||
|
$calcproductsunique=$entrepot->nb_different_products();
|
||||||
$calcproducts=$entrepot->nb_products();
|
$calcproducts=$entrepot->nb_products();
|
||||||
|
|
||||||
|
// Total nb of different products
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("NumberOfDifferentProducts").'</td><td colspan="3">';
|
||||||
|
print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb'];
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
// 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">';
|
||||||
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
print empty($calcproducts['nb'])?'0':$calcproducts['nb'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user