';
+ if ($result > 0)
+ {
+ $head=product_prepare_head($product, $user);
+ $titre=$langs->trans("CardProduct".$product->type);
+ dolibarr_fiche_head($head, 'stock', $titre);
- // Reference
- print '';
- print '| '.$langs->trans("Ref").' | ';
- print $html->showrefnav($product,'ref','',1,'ref');
- print ' | ';
- print '
';
-
- // Libellé
- print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
- print '
';
+ $html = new Form($db);
- // Prix
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
+ print($mesg);
- // Statut
- print '| '.$langs->trans("Status").' | ';
- print $product->getLibStatut(2);
- print ' |
';
+ print '';
- // Stock
- print '| '.$langs->trans("StockLimit").' | ';
- print ''.$product->seuil_stock_alerte.' | ';
- print '
';
-
- // Stock
- print '| '.$langs->trans("PhysicalStock").' | ';
- if ($product->stock_reel < $product->seuil_stock_alerte)
+ // Reference
+ print '
';
+ print '| '.$langs->trans("Ref").' | ';
+ print $html->showrefnav($product,'ref','',1,'ref');
+ print ' | ';
+ print '
';
+
+ // Libellé
+ print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
+ print '
';
+
+ // Prix
+ print '| '.$langs->trans("SellingPrice").' | ';
+ if ($product->price_base_type == 'TTC')
{
- print ' | '.$product->stock_reel.' '.img_warning().' | ';
+ print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
}
else
{
- print "".$product->stock_reel.' | ';
+ print price($product->price).' '.$langs->trans($product->price_base_type);
}
- print '
';
-
- // Stock
- print '| '.$langs->trans("VirtualStock").' | ';
- print "".$langs->trans("FeatureNotYetAvailable").' | ';
- print '
';
-
- // Nbre de commande clients en cours
- if ($conf->commande->enabled)
- {
- $result=$product->load_stats_commande(0,'2');
- if ($result < 0) dolibarr_print_error($db,$product->error);
- print '| '.$langs->trans("CustomersOrdersRunning").' | ';
- print '';
- print $product->stats_commande['qty'];
- $result=$product->load_stats_commande(0,'0,1');
- if ($result < 0) dolibarr_print_error($db,$product->error);
- print ' ('.$langs->trans("DraftOrWaitingShipped").': '.$product->stats_commande['qty'].')';
- print ' |
';
- }
-
- // Nbre de commande fournisseurs en cours
- if ($conf->fournisseur->enabled)
- {
- $result=$product->load_stats_commande_fournisseur(0,'3');
- if ($result < 0) dolibarr_print_error($db,$product->error);
- print '| '.$langs->trans("SuppliersOrdersRunning").' | ';
- print '';
- print $product->stats_commande_fournisseur['qty'];
- $result=$product->load_stats_commande_fournisseur(0,'0,1,2');
- if ($result < 0) dolibarr_print_error($db,$product->error);
- print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')';
- print ' |
';
- }
-
- print "
";
+ print '';
- }
- print '';
+ // Statut
+ print '| '.$langs->trans("Status").' | ';
+ print $product->getLibStatut(2);
+ print ' |
';
- /*
- * Correction du stock
- */
- if ($_GET["action"] == "correction")
- {
- print_titre($langs->trans("StockCorrection"));
- print "';
+ // Calculating a theorical value of stock if stock increment is done on order
+ if ($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)
+ {
+ $stock_commande_client=$stock_commande_fournisseur=0;
+
+ if ($conf->commande->enabled)
+ {
+ $result=$product->load_stats_commande(0,'2');
+ if ($result < 0) dolibarr_print_error($db,$product->error);
+ $stock_commande_client=$product->stats_commande['qty'];
+ }
+ if ($conf->fournisseur->enabled)
+ {
+ $result=$product->load_stats_commande_fournisseur(0,'3');
+ if ($result < 0) dolibarr_print_error($db,$product->error);
+ $stock_commande_fournisseur=$product->stats_commande_fournisseur['qty'];
+ }
+
+ $product->stock_theorique=$product->stock_reel-$stock_commande_client+$stock_commande_fournisseur;
+
+ // Stock theorique
+ print '| '.$langs->trans("VirtualStock").' | ';
+ print "".$product->stock_theorique;
+ if ($product->stock_theorique < $product->seuil_stock_alerte)
+ {
+ print ' '.img_warning($langs->trans("StockTooLow"));
+ }
+ print ' | ';
+ print '
';
+
+ if ($product->stock_theorique != $product->stock_reel)
+ {
+ print '| '.$langs->trans("StockDiffPhysicTeoric").' | ';
+ print '';
+ $found=0;
+
+ // Nbre de commande clients en cours
+ if ($conf->commande->enabled)
+ {
+ if ($found) print ' '; else $found=1;
+ print $langs->trans("CustomersOrdersRunning").': '.$stock_commande_client;
+ $result=$product->load_stats_commande(0,'0,1');
+ if ($result < 0) dolibarr_print_error($db,$product->error);
+ print ' ('.$langs->trans("DraftOrWaitingShipped").': '.$product->stats_commande['qty'].')';
+ }
+
+ // Nbre de commande fournisseurs en cours
+ if ($conf->fournisseur->enabled)
+ {
+ if ($found) print ' '; else $found=1;
+ print $langs->trans("SuppliersOrdersRunning").': '.$stock_commande_fournisseur;
+ $result=$product->load_stats_commande_fournisseur(0,'0,1,2');
+ if ($result < 0) dolibarr_print_error($db,$product->error);
+ print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')';
+ }
+ print ' |
';
+ }
+ }
+
+ // Stock
+ print '| '.$langs->trans("StockLimit").' | ';
+ print ''.$product->seuil_stock_alerte.' | ';
+ print '
';
- }
-
- /*
- * Transfert de pièces
- */
- if ($_GET["action"] == "transfert")
- {
- print_titre($langs->trans("Transfer"));
- print "
';
+ print '';
- }
-
- /*
- *
- */
- if ($_GET["action"] == "definir")
- {
- print_titre($langs->trans("SetStock"));
- print "\n";
@@ -351,7 +371,7 @@ if ($_GET["action"] == '' )
{
print '
'.$langs->trans("StockMovement").'';
}
-
+
if ($user->rights->stock->creer)
{
print '
'.$langs->trans("StockCorrection").'';
@@ -378,21 +398,21 @@ $entrepotstatic=new Entrepot($db);
$resql=$db->query($sql);
if ($resql)
{
- $num = $db->num_rows($resql);
- $i=0; $total=0; $var=false;
- while ($i < $num)
- {
- $obj = $db->fetch_object($resql);
- $entrepotstatic->id=$obj->rowid;
- $entrepotstatic->libelle=$obj->label;
- print '
';
- print '| '.$entrepotstatic->getNomUrl(1).' | ';
- print ''.$obj->reel.' | ';
- print '
'; ;
- $total = $total + $obj->reel;
- $i++;
- $var=!$var;
- }
+ $num = $db->num_rows($resql);
+ $i=0; $total=0; $var=false;
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($resql);
+ $entrepotstatic->id=$obj->rowid;
+ $entrepotstatic->libelle=$obj->label;
+ print '
';
+ print '| '.$entrepotstatic->getNomUrl(1).' | ';
+ print ''.$obj->reel.' | ';
+ print '
'; ;
+ $total = $total + $obj->reel;
+ $i++;
+ $var=!$var;
+ }
}
print '
| '.$langs->trans("Total").': | '.$total." |
";
print "";