2
0
forked from Wavyzz/dolibarr

Removed deprecated code

This commit is contained in:
Laurent Destailleur
2009-01-10 02:18:17 +00:00
parent 530c1312ac
commit dbaf649a8e
9 changed files with 256 additions and 237 deletions

View File

@@ -54,6 +54,7 @@ CanceledBy=Canceled by %s
ClosedBy=Closed by %s
FileWasRemoved=File was deleted
DirWasRemoved=Directory was removed
FeatureNotYetAvailableShort=Available in a next version
FeatureNotYetAvailable=Feature not yet available in this version
FeatureExperimental=Experimental feature. Not stable in this version
FeatureDevelopment=Development feature. Not stable in this version

View File

@@ -34,6 +34,7 @@ NumberOfUnit=Number of units
TotalStock=Total in stock
StockTooLow=Stock too low
EnhancedValue=Value
PMPValue=Value
EnhancedValueOfWarehouses=Warehouses value
UserWarehouseAutoCreate=Create a stock automatically when creating a user
QtyDispatched=Quantity dispatched

View File

@@ -54,6 +54,7 @@ CanceledBy=Annul
ClosedBy=Clotur<75> par %s
FileWasRemoved=Le fichier a <20>t<EFBFBD> supprim<69>
DirWasRemoved=Le r<>pertoire a <20>t<EFBFBD> supprim<69>
FeatureNotYetAvailableShort=Disponible dans une prochaine version
FeatureNotYetAvailable=Fonctionnalit<69> pas encore disponible dans cette version
FeatureExperimental=Fonctionnalit<69> exp<78>rimentale. Non stable dans cette version
FeatureDevelopment=Fonctionnalit<69> en d<>veloppement. Non stable dans cette version

View File

@@ -34,6 +34,7 @@ NumberOfUnit=Nombre de pi
TotalStock=Total en stock
StockTooLow=Stock insuffisant
EnhancedValue=Valorisation
PMPValue=Valorisation (PMP)
EnhancedValueOfWarehouses=Valorisation des stocks
UserWarehouseAutoCreate=Cr<43>er un stock automatiquement <20> la cr<63>ation d'un utilisateur
QtyDispatched=Quantit<69> ventil<69>e

View File

@@ -265,11 +265,13 @@ else
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>';
// Nb of products
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
print $entrepot->nb_products();
$nb=$entrepot->nb_products();
print empty($nb)?'0':$nb;
print "</td></tr>";
// Dernier mouvement
// 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."';";
@@ -320,11 +322,13 @@ else
print_liste_field_titre($langs->trans("Product"),"", "p.ref","&amp;id=".$_GET['id'],"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),"", "p.label","&amp;id=".$_GET['id'],"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&amp;id=".$_GET['id'],"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PMP"),"", "ps.pmp","&amp;id=".$_GET['id'],"",'align="center"',$sortfield,$sortorder);
if ($user->rights->stock->mouvement->creer) print '<td>&nbsp;</td>';
if ($user->rights->stock->creer) print '<td>&nbsp;</td>';
print "</tr>";
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, ps.reel as value ";
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit,";
$sql.= " ps.reel as value";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p ";
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{
@@ -375,8 +379,11 @@ else
print img_object($langs->trans("ShowProduct"),"product").' '.$objp->ref;
print "</a></td>";
print '<td>'.$objp->produit.'</td>';
print '<td align="right">'.$objp->value.'</td>';
print '<td align="center">'.$langs->trans("FeatureNotYetAvailableShort").'</td>';
if ($user->rights->stock->mouvement->creer)
{
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$entrepot->id.'&amp;id='.$objp->rowid.'&amp;action=transfert">';

View File

@@ -71,7 +71,7 @@ class MouvementStock
$error = -1;
}
// Get current value of stock
// Test if there is already a record for couple (warehouse / product)
$num = 0;
if ($error == 0)
{
@@ -108,6 +108,8 @@ class MouvementStock
dolibarr_syslog("MouvementStock::_Create sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
// TODO
// Update value of PMP in product_stock
}
else
@@ -117,6 +119,7 @@ class MouvementStock
}
}
/*
if ($error == 0)
{
$valo_mouvement = 0;
@@ -127,6 +130,7 @@ class MouvementStock
{
$error = $this->CalculateEntrepotValoPmp($user, $entrepot_id, $valo_mouvement);
}
*/
}
// Add movement for sub products
@@ -157,7 +161,7 @@ class MouvementStock
/**
* \brief Create movement in databse for all subproducts
* \brief Create movement in database for all subproducts
* \return int <0 si ko, 0 si ok
*/
function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price=0)
@@ -199,7 +203,6 @@ class MouvementStock
}
/**
* \brief Cr<43>e un mouvement en base pour toutes les compositions de produits
* \return int <0 si ko, 0 si ok
@@ -240,10 +243,52 @@ class MouvementStock
}
/**
* \brief Decrease stock for product and subproducts
* \return int <0 if KO, >0 if OK
*/
function livraison($user, $fk_product, $entrepot_id, $qty)
{
return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2);
}
/**
* \brief Increase stock for product and subproducts
* \return int <0 if KO, >0 if OK
*/
function reception($user, $fk_product, $entrepot_id, $qty, $price=0)
{
return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price);
}
/**
* Return nb of subproducts for a product
*
* @param unknown_type $id
* @return unknown
*/
function nbOfSubProdcuts($id)
{
$nbSP=0;
$resql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."product_association";
$resql.= " WHERE fk_product_pere = ".$id;
if ($this->db->query($resql))
{
$obj=$this->db->fetch_object($resql);
$nbSP=$obj->nb;
}
$this->db->free($resql);
return $nbSP;
}
/**
* \brief Calcul ???
* \return int <0 si ko, >0 si ok
*/
/*
function CalculateEntrepotValoPmp($user, $entrepot_id, $valo_mouvement)
{
$error = 0;
@@ -338,7 +383,7 @@ class MouvementStock
return 0;
}
}
*/
/**
* \brief ???
@@ -349,6 +394,7 @@ class MouvementStock
* \param value_ope float Valeur du mouvement en retour
* \return int <0 si ko, 0 si ok
*/
/*
function CalculateValoPmp($mvid, $fk_product, $qty, $price=0, &$value_ope)
{
$error = 0;
@@ -382,9 +428,7 @@ class MouvementStock
}
}
/*
* Calcul
*/
// Calcul
if ($qty > 0)
{
// on stock
@@ -405,9 +449,8 @@ class MouvementStock
$new_stock_qty = $qty_stock + $qty;
$new_stock_value_pmp = $stock_value_pmp + $value_ope;
/*
* Fin calcul
*/
// Fin calcul
if ($error === 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_valorisation";
@@ -446,48 +489,6 @@ class MouvementStock
return 0;
}
}
/**
* \brief Decrease stock for product and subproducts
* \return int <0 if KO, >0 if OK
*/
function livraison($user, $fk_product, $entrepot_id, $qty)
{
return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2);
}
/**
* \brief Increase stock for product and subproducts
* \return int <0 if KO, >0 if OK
*/
function reception($user, $fk_product, $entrepot_id, $qty, $price=0)
{
return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price);
}
/**
* Return nb of subproducts for a product
*
* @param unknown_type $id
* @return unknown
*/
function nbOfSubProdcuts($id)
{
$nbSP=0;
$resql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."product_association";
$resql.= " WHERE fk_product_pere = ".$id;
if ($this->db->query($resql))
{
$obj=$this->db->fetch_object($resql);
$nbSP=$obj->nb;
}
$this->db->free($resql);
return $nbSP;
}
}
?>

View File

@@ -18,10 +18,10 @@
*/
/**
\file htdocs/product/stock/valo.php
\ingroup stock
\brief Page de valorisation des stocks
\version $Id$
* \file htdocs/product/stock/valo.php
* \ingroup stock
* \brief Page de valorisation des stocks
* \version $Id$
*/
require("./pre.inc.php");
@@ -38,8 +38,8 @@ $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
if (! $sortfield) $sortfield="valo";
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="e.label";
if (! $sortorder) $sortorder="ASC";
$page = $_GET["page"];
if ($page < 0) $page = 0;
$limit = $conf->liste_limit;
@@ -53,7 +53,7 @@ $year = strftime("%Y",time());
*/
// Affichage valorisation par entrepot
$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu, e.valo_pmp as valo";
$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE 1=1";
if ($sref)
@@ -82,7 +82,7 @@ if ($result)
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"valo.php", "e.label","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LocationSummary"),"valo.php", "e.lieu","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EnhancedValue"),"valo.php", "valo",'','','align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PMPValue"),"valo.php", "valo",'','','align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder);
print "</tr>\n";
@@ -97,7 +97,10 @@ if ($result)
print "<tr $bc[$var]>";
print '<td><a href="fiche.php?id='.$objp->ref.'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.'</a></td>';
print '<td>'.$objp->lieu.'</td>';
print '<td align="right">'.price($objp->valo).' '.$langs->trans('Currency'.$conf->monnaie).'</td>';
print '<td align="right">';
// This value is real QTY * PMP of products in llx_product_stock for the warehouse
print $langs->trans("FeatureNotYetAvailableShort");
print '</td>';
print '<td align="right">'.$entrepot->LibStatut($objp->statut,5).'</td>';
print "</tr>\n";
$total += $objp->valo;

View File

@@ -13,3 +13,6 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (71, 'facture_fourn', 'external', 'BILLING', 'Contact fournisseur facturation', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
alter table llx_product_stock add column pmp double(24,8) default 0 NOT NULL;

View File

@@ -24,6 +24,7 @@ create table llx_product_stock
tms timestamp,
fk_product integer NOT NULL,
fk_entrepot integer NOT NULL,
reel integer -- stock r<>el
reel integer -- physical stock
pmp double(24,8) default 0 NOT NULL -- PMP value for product in this warehous
)type=innodb;