Ajout onglet commande fournisseurs et factures fournisseurs référente à un produit
This commit is contained in:
parent
6316c76b02
commit
8cb0402445
@ -35,6 +35,7 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
|
|||||||
|
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
$user->getrights('fournisseur');
|
$user->getrights('fournisseur');
|
||||||
|
|
||||||
|
|||||||
@ -651,7 +651,6 @@ else
|
|||||||
* Liste des paiements
|
* Liste des paiements
|
||||||
*/
|
*/
|
||||||
print '<tr><td colspan="2">';
|
print '<tr><td colspan="2">';
|
||||||
print $langs->trans('Payments').' :<br>';
|
|
||||||
$sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
|
$sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
|
||||||
$sql .= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
|
$sql .= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
|
||||||
@ -667,7 +666,7 @@ else
|
|||||||
$i = 0; $totalpaye = 0;
|
$i = 0; $totalpaye = 0;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans('Date').'</td>';
|
print '<td>'.$langs->trans('Payments').'</td>';
|
||||||
print '<td>'.$langs->trans('Type').'</td>';
|
print '<td>'.$langs->trans('Type').'</td>';
|
||||||
|
|
||||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0)
|
||||||
@ -744,7 +743,12 @@ else
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$fac->lignes[$i][0].'</td>';
|
|
||||||
|
print '<td>';
|
||||||
|
//print '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),'product').' ';
|
||||||
|
print $fac->lignes[$i][0];
|
||||||
|
//print '</a>';
|
||||||
|
print '</td>';
|
||||||
print '<td align="right">'.price($fac->lignes[$i][1]).'</td>';
|
print '<td align="right">'.price($fac->lignes[$i][1]).'</td>';
|
||||||
print '<td align="right">'.$fac->lignes[$i][3].'</td>';
|
print '<td align="right">'.$fac->lignes[$i][3].'</td>';
|
||||||
print '<td align="right">'.price($fac->lignes[$i][4]).'</td>';
|
print '<td align="right">'.price($fac->lignes[$i][4]).'</td>';
|
||||||
|
|||||||
@ -340,7 +340,7 @@ class FactureFournisseur extends Facture
|
|||||||
* \param tauxtva taux de tva
|
* \param tauxtva taux de tva
|
||||||
* \param qty quantité
|
* \param qty quantité
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu, $tauxtva, $qty)
|
function addline($desc, $pu, $tauxtva, $qty, $idproduct)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
|
||||||
$sql .= ' VALUES ('.$this->id.');';
|
$sql .= ' VALUES ('.$this->id.');';
|
||||||
@ -348,14 +348,18 @@ class FactureFournisseur extends Facture
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
|
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
|
||||||
$this->updateline($idligne, $desc, $pu, $tauxtva, $qty);
|
$this->updateline($idligne, $desc, $pu, $tauxtva, $qty, $idproduct);
|
||||||
|
|
||||||
|
// Mise a jour prix facture
|
||||||
|
$this->update_price($this->id);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
dolibarr_print_error($this->db);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
// Mise a jour prix facture
|
|
||||||
$this->update_price($this->id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -367,7 +371,7 @@ class FactureFournisseur extends Facture
|
|||||||
* \param qty quantité
|
* \param qty quantité
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function updateline($id, $label, $puht, $tauxtva, $qty=1)
|
function updateline($id, $label, $puht, $tauxtva, $qty=1, $idproduct)
|
||||||
{
|
{
|
||||||
$puht = price2num($puht);
|
$puht = price2num($puht);
|
||||||
$qty = price2num($qty);
|
$qty = price2num($qty);
|
||||||
@ -379,15 +383,17 @@ class FactureFournisseur extends Facture
|
|||||||
$totalttc = $totalht + $tva;
|
$totalttc = $totalht + $tva;
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det ';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det ';
|
||||||
$sql .= 'SET ';
|
$sql.= 'SET ';
|
||||||
$sql .= 'description =\''.addslashes($label).'\'';
|
$sql.= 'description =\''.addslashes($label).'\'';
|
||||||
$sql .= ', pu_ht = ' .$puht;
|
$sql.= ', pu_ht = ' .$puht;
|
||||||
$sql .= ', qty =' .$qty;
|
$sql.= ', qty =' .$qty;
|
||||||
$sql .= ', total_ht=' .price2num($totalht);
|
$sql.= ', total_ht=' .price2num($totalht);
|
||||||
$sql .= ', tva=' .price2num($tva);
|
$sql.= ', tva=' .price2num($tva);
|
||||||
$sql .= ', tva_taux=' .price2num($tauxtva);
|
$sql.= ', tva_taux=' .price2num($tauxtva);
|
||||||
$sql .= ', total_ttc='.price2num($totalttc);
|
$sql.= ', total_ttc='.price2num($totalttc);
|
||||||
$sql .= ' WHERE rowid = '.$id.';';
|
if ($idproduct) $sql.= ', fk_product='.$idproduct;
|
||||||
|
else $sql.= ', fk_product=null';
|
||||||
|
$sql.= ' WHERE rowid = '.$id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -21,10 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/fourn/product/liste.php
|
\file htdocs/fourn/product/liste.php
|
||||||
\ingroup produit
|
\ingroup produit
|
||||||
\brief Page liste des produits ou services
|
\brief Page liste des produits ou services
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -44,7 +44,7 @@ $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
|||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||||
$page = $_GET["page"];
|
$page = $_GET["page"];
|
||||||
if ($page < 0) {
|
if ($page < 0) {
|
||||||
$page = 0 ; }
|
$page = 0 ; }
|
||||||
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
@ -53,24 +53,24 @@ if (! $sortfield) $sortfield="p.ref";
|
|||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
|
||||||
if ($_POST["button_removefilter"] == $langs->trans("RemoveFilter")) {
|
if ($_POST["button_removefilter"] == $langs->trans("RemoveFilter")) {
|
||||||
$sref="";
|
$sref="";
|
||||||
$snom="";
|
$snom="";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["fourn_id"] > 0)
|
if ($_GET["fourn_id"] > 0)
|
||||||
{
|
{
|
||||||
$fourn_id = $_GET["fourn_id"];
|
$fourn_id = $_GET["fourn_id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['catid']))
|
if (isset($_REQUEST['catid']))
|
||||||
{
|
{
|
||||||
$catid = $_REQUEST['catid'];
|
$catid = $_REQUEST['catid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Mode Liste
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$title=$langs->trans("ProductsAndServices");
|
$title=$langs->trans("ProductsAndServices");
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ $sql .= ", s.nom";
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($catid)
|
if ($catid)
|
||||||
{
|
{
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||||
}
|
}
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = pf.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = pf.fk_soc";
|
||||||
@ -89,39 +89,40 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON ppf.fk
|
|||||||
|
|
||||||
if ($_POST["mode"] == 'search')
|
if ($_POST["mode"] == 'search')
|
||||||
{
|
{
|
||||||
$sql .= " WHERE p.ref like '%".$_POST["sall"]."%'";
|
$sql .= " WHERE p.ref like '%".$_POST["sall"]."%'";
|
||||||
$sql .= " OR p.label like '%".$_POST["sall"]."%'";
|
$sql .= " OR p.label like '%".$_POST["sall"]."%'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql .= " WHERE 1=1";
|
$sql .= " WHERE 1=1";
|
||||||
if (isset($_GET["type"]) || isset($_POST["type"]))
|
if ($_GET["type"] || $_POST["type"])
|
||||||
{
|
{
|
||||||
$sql .= " AND p.fk_product_type = ".(isset($_GET["type"])?$_GET["type"]:$_POST["type"]);
|
$sql .= " AND p.fk_product_type = ".(isset($_GET["type"])?$_GET["type"]:$_POST["type"]);
|
||||||
}
|
}
|
||||||
if ($sref)
|
if ($sref)
|
||||||
{
|
{
|
||||||
$sql .= " AND p.ref like '%".$sref."%'";
|
$sql .= " AND p.ref like '%".$sref."%'";
|
||||||
}
|
}
|
||||||
if ($snom)
|
if ($snom)
|
||||||
{
|
{
|
||||||
$sql .= " AND p.label like '%".$snom."%'";
|
$sql .= " AND p.label like '%".$snom."%'";
|
||||||
}
|
}
|
||||||
if($catid)
|
if($catid)
|
||||||
{
|
{
|
||||||
$sql .= " AND cp.fk_product = p.rowid";
|
$sql .= " AND cp.fk_product = p.rowid";
|
||||||
$sql .= " AND cp.fk_categorie = ".$catid;
|
$sql .= " AND cp.fk_categorie = ".$catid;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($fourn_id > 0)
|
if ($fourn_id > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = $fourn_id";
|
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY p.rowid";
|
$sql .= " GROUP BY p.rowid";
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||||
$sql .= $db->plimit($limit + 1 ,$offset);
|
$sql .= $db->plimit($limit + 1 ,$offset);
|
||||||
|
|
||||||
|
|
||||||
dolibarr_syslog("fourn/product/liste: sql=$sql");
|
dolibarr_syslog("fourn/product/liste: sql=$sql");
|
||||||
|
|
||||||
$resql = $db->query($sql) ;
|
$resql = $db->query($sql) ;
|
||||||
@ -141,14 +142,8 @@ if ($resql)
|
|||||||
$texte = $langs->trans("List");
|
$texte = $langs->trans("List");
|
||||||
llxHeader("","",$texte);
|
llxHeader("","",$texte);
|
||||||
|
|
||||||
if ($sref || $snom || $_POST["sall"] || $_POST["search"])
|
$param="&envente=$envente&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"");
|
||||||
{
|
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
||||||
print_barre_liste($texte, $page, "liste.php", "&sref=".$sref."&snom=".$snom, $sortfield, $sortorder,'',$num);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print_barre_liste($texte, $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($catid))
|
if (isset($catid))
|
||||||
@ -165,10 +160,10 @@ if ($resql)
|
|||||||
|
|
||||||
// Lignes des titres
|
// Lignes des titres
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref","&envente=$envente".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield);
|
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref",$param,"","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield);
|
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label",$param,"","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Supplier"),"liste.php", "pf.fk_soc","","","",$sortfield);
|
print_liste_field_titre($langs->trans("Supplier"),"liste.php", "pf.fk_soc",$param,"","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield);
|
print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price",$param,"",'align="right"',$sortfield);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
|
|||||||
@ -129,4 +129,123 @@ function product_prepare_head($product)
|
|||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function show_stats_for_company($product,$socidp)
|
||||||
|
{
|
||||||
|
global $conf,$langs,$user,$db;
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td align="left" width="25%" valign="top">'.$langs->trans("Referers").'</td>';
|
||||||
|
print '<td align="right" width="25%">'.$langs->trans("NbOfThirdParties").'</td>';
|
||||||
|
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
|
||||||
|
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Propals
|
||||||
|
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||||
|
{
|
||||||
|
$ret=$product->load_stats_propale($socidp);
|
||||||
|
if ($ret < 0) dolibarr_print_error($db);
|
||||||
|
$langs->load("propal");
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_propale['customers'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_propale['nb'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_propale['qty'];
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
// Commandes clients
|
||||||
|
if ($conf->commande->enabled && $user->rights->commande->lire)
|
||||||
|
{
|
||||||
|
$ret=$product->load_stats_commande($socidp);
|
||||||
|
if ($ret < 0) dolibarr_print_error($db);
|
||||||
|
$langs->load("orders");
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_commande['customers'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_commande['nb'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_commande['qty'];
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
// Commandes fournisseurs
|
||||||
|
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire)
|
||||||
|
{
|
||||||
|
$ret=$product->load_stats_commande_fournisseur($socidp);
|
||||||
|
if ($ret < 0) dolibarr_print_error($db);
|
||||||
|
$langs->load("orders");
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_commande_fournisseur['suppliers'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_commande_fournisseur['nb'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_commande_fournisseur['qty'];
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
// Contrats
|
||||||
|
if ($conf->contrat->enabled && $user->rights->contrat->lire)
|
||||||
|
{
|
||||||
|
$ret=$product->load_stats_contrat($socidp);
|
||||||
|
if ($ret < 0) dolibarr_print_error($db);
|
||||||
|
$langs->load("contracts");
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_contrat['customers'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_contrat['nb'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_contrat['qty'];
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
// Factures clients
|
||||||
|
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||||
|
{
|
||||||
|
$ret=$product->load_stats_facture($socidp);
|
||||||
|
if ($ret < 0) dolibarr_print_error($db);
|
||||||
|
$langs->load("bills");
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_facture['customers'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_facture['nb'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_facture['qty'];
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
// Factures fournisseurs
|
||||||
|
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
|
||||||
|
{
|
||||||
|
$ret=$product->load_stats_facture_fournisseur($socidp);
|
||||||
|
if ($ret < 0) dolibarr_print_error($db);
|
||||||
|
$langs->load("bills");
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_facture_fournisseur['suppliers'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_facture_fournisseur['nb'];
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print $product->stats_facture_fournisseur['qty'];
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
\file htdocs/product/stats/commande.php
|
\file htdocs/product/stats/commande.php
|
||||||
\ingroup product, service, commande
|
\ingroup product, service, commande
|
||||||
\brief Page des stats des commandes pour un produit
|
\brief Page des stats des commandes clients pour un produit
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -36,6 +36,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
|||||||
|
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
@ -113,80 +114,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print $product->getLibStatut(2);
|
print $product->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
|
show_stats_for_company($product,$socidp);
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Propals
|
|
||||||
if ($conf->propal->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_propale($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("propal");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes clients
|
|
||||||
if ($conf->commande->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Contrats
|
|
||||||
if ($conf->contrat->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_contrat($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("contracts");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures
|
|
||||||
if ($conf->facture->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
200
htdocs/product/stats/commande_fournisseur.php
Normal file
200
htdocs/product/stats/commande_fournisseur.php
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/product/stats/commande_fournisseur.php
|
||||||
|
\ingroup product, service, commande
|
||||||
|
\brief Page des stats des commandes fournisseurs pour un produit
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||||
|
|
||||||
|
$langs->load("orders");
|
||||||
|
$langs->load("products");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
|
$mesg = '';
|
||||||
|
|
||||||
|
$page = $_GET["page"];
|
||||||
|
$sortfield=$_GET["sortfield"];
|
||||||
|
$sortorder=$_GET["sortorder"];
|
||||||
|
if ($page == -1) { $page = 0 ; }
|
||||||
|
$offset = $conf->liste_limit * $_GET["page"] ;
|
||||||
|
$pageprev = $_GET["page"] - 1;
|
||||||
|
$pagenext = $_GET["page"] + 1;
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
if (! $sortfield) $sortfield="c.date_creation";
|
||||||
|
|
||||||
|
|
||||||
|
// Securite
|
||||||
|
$socidp = 0;
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socidp = $user->societe_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$socidp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affiche fiche
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if ($_GET["id"] || $_GET["ref"])
|
||||||
|
{
|
||||||
|
$product = new Product($db);
|
||||||
|
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||||
|
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||||
|
|
||||||
|
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* En mode visu
|
||||||
|
*/
|
||||||
|
$head=product_prepare_head($product);
|
||||||
|
$titre=$langs->trans("CardProduct".$product->type);
|
||||||
|
dolibarr_fiche_head($head, 'referers', $titre);
|
||||||
|
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Reference
|
||||||
|
print '<tr>';
|
||||||
|
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||||
|
$product->load_previous_next_ref();
|
||||||
|
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
|
||||||
|
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
|
||||||
|
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
|
||||||
|
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Libelle
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Prix
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="3">'.price($product->price).'</td></tr>';
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
|
||||||
|
print $product->getLibStatut(2);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
show_stats_for_company($product,$socidp);
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT distinct(s.nom), s.idp, s.code_client, c.rowid, c.total_ht as amount, c.ref,";
|
||||||
|
$sql.= " ".$db->pdate("c.date_creation")." as date, c.fk_statut as statut, c.rowid as commandeid";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."commande_fournisseurdet as d";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE c.fk_soc = s.idp";
|
||||||
|
$sql.= " AND d.fk_commande = c.rowid AND d.fk_product =".$product->id;
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
if ($socidp)
|
||||||
|
{
|
||||||
|
$sql .= " AND c.fk_soc = ".$socidp;
|
||||||
|
}
|
||||||
|
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||||
|
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("SuppliersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","","&id=".$_GET["id"],'',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$_GET["id"],'',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$_GET["id"],'',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"c.date_creation","","&id=".$_GET["id"],'align="center"',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.amount_ht","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$commandestatic=new Commande($db);
|
||||||
|
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num && $i < $conf->liste_limit)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->commandeid.'">'.img_object($langs->trans("ShowOrder"),"order").' ';
|
||||||
|
print $objp->ref;
|
||||||
|
print "</a></td>\n";
|
||||||
|
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).'</a></td>';
|
||||||
|
print "<td>".$objp->code_client."</td>\n";
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
print dolibarr_print_date($objp->date)."</td>";
|
||||||
|
print "<td align=\"right\">".price($objp->amount)."</td>\n";
|
||||||
|
print '<td align="right">'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
print '<br>';
|
||||||
|
$db->free($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
?>
|
||||||
@ -28,7 +28,6 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||||
@ -36,6 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
|||||||
|
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
@ -112,80 +112,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print $product->getLibStatut(2);
|
print $product->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
|
show_stats_for_company($product,$socidp);
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Propals
|
|
||||||
if ($conf->propal->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_propale($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("propal");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes
|
|
||||||
if ($conf->commande->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Contrats
|
|
||||||
if ($conf->contrat->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_contrat($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("contracts");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures
|
|
||||||
if ($conf->facture->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
\file htdocs/product/stats/facture.php
|
\file htdocs/product/stats/facture.php
|
||||||
\ingroup product, service, facture
|
\ingroup product, service, facture
|
||||||
\brief Page des stats des factures pour un produit
|
\brief Page des stats des factures clients pour un produit
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -108,114 +108,8 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print $product->getLibStatut(2);
|
print $product->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
|
show_stats_for_company($product,$socidp);
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfThirdParties").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Propals
|
|
||||||
if ($conf->propal->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_propale($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("propal");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes clients
|
|
||||||
if ($conf->commande->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes fournisseurs
|
|
||||||
if ($conf->fournisseur->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande_fournisseur($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande_fournisseur['suppliers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande_fournisseur['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande_fournisseur['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Contrats
|
|
||||||
if ($conf->contrat->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_contrat($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("contracts");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures clients
|
|
||||||
if ($conf->facture->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures fournisseurs
|
|
||||||
if ($conf->fournisseur->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture_fournisseur($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture_fournisseur['suppliers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture_fournisseur['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture_fournisseur['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
194
htdocs/product/stats/facture_fournisseur.php
Normal file
194
htdocs/product/stats/facture_fournisseur.php
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/product/stats/facture_fournisseur.php
|
||||||
|
\ingroup product, service, facture
|
||||||
|
\brief Page des stats des factures fournisseurs pour un produit
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("bills");
|
||||||
|
$langs->load("products");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
|
$mesg = '';
|
||||||
|
|
||||||
|
$page = $_GET["page"];
|
||||||
|
$sortfield=$_GET["sortfield"];
|
||||||
|
$sortorder=$_GET["sortorder"];
|
||||||
|
if ($page == -1) { $page = 0 ; }
|
||||||
|
$offset = $conf->liste_limit * $_GET["page"] ;
|
||||||
|
$pageprev = $_GET["page"] - 1;
|
||||||
|
$pagenext = $_GET["page"] + 1;
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
if (! $sortfield) $sortfield="f.datef";
|
||||||
|
|
||||||
|
// Securite
|
||||||
|
$socidp = 0;
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$socidp = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affiche fiche
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if ($_GET["id"] || $_GET["ref"])
|
||||||
|
{
|
||||||
|
$product = new Product($db);
|
||||||
|
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||||
|
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||||
|
|
||||||
|
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* En mode visu
|
||||||
|
*/
|
||||||
|
$head=product_prepare_head($product);
|
||||||
|
$titre=$langs->trans("CardProduct".$product->type);
|
||||||
|
dolibarr_fiche_head($head, 'referers', $titre);
|
||||||
|
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Reference
|
||||||
|
print '<tr>';
|
||||||
|
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||||
|
$product->load_previous_next_ref();
|
||||||
|
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
|
||||||
|
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
|
||||||
|
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
|
||||||
|
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Libelle
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Prix
|
||||||
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="3">'.price($product->price).'</td></tr>';
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
|
||||||
|
print $product->getLibStatut(2);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
show_stats_for_company($product,$socidp);
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT distinct(s.nom), s.idp, s.code_client, f.facnumber, f.amount as amount,";
|
||||||
|
$sql.= " ".$db->pdate("f.datef")." as date, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."facture_fourn_det as d";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE f.fk_soc = s.idp";
|
||||||
|
$sql.= " AND d.fk_facture_fourn = f.rowid AND d.fk_product =".$product->id;
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
if ($socidp)
|
||||||
|
{
|
||||||
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
}
|
||||||
|
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||||
|
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("SuppliersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.idp","","&id=".$_GET["id"],'',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$_GET["id"],'',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$_GET["id"],'',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$_GET["id"],'align="center"',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.amount","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num && $conf->liste_limit)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' ';
|
||||||
|
print $objp->facnumber;
|
||||||
|
print "</a></td>\n";
|
||||||
|
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socidp='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).'</a></td>';
|
||||||
|
print "<td>".$objp->code_client."</td>\n";
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
print dolibarr_print_date($objp->date)."</td>";
|
||||||
|
print "<td align=\"right\">".price($objp->amount)."</td>\n";
|
||||||
|
$fac=new Facture($db);
|
||||||
|
print '<td align="right">'.$fac->LibStatut($objp->paye,$objp->statut,5).'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
print '<br>';
|
||||||
|
$db->free($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
?>
|
||||||
@ -174,114 +174,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print $product->getLibStatut(2);
|
print $product->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
|
show_stats_for_company($product,$socidp);
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfThirdParties").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Propals
|
|
||||||
if ($conf->propal->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_propale($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("propal");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes clients
|
|
||||||
if ($conf->commande->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes fournisseurs
|
|
||||||
if ($conf->fournisseur->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande_fournisseur($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande_fournisseur['suppliers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande_fournisseur['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande_fournisseur['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Contrats
|
|
||||||
if ($conf->contrat->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_contrat($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("contracts");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures clients
|
|
||||||
if ($conf->facture->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture($socid);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures fournisseurs
|
|
||||||
if ($conf->fournisseur->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture_fournisseur($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture_fournisseur['suppliers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture_fournisseur['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture_fournisseur['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -194,5 +194,5 @@ $db->free();
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -111,80 +111,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print $product->getLibStatut(2);
|
print $product->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>';
|
show_stats_for_company($product,$socidp);
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>';
|
|
||||||
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Propals
|
|
||||||
if ($conf->propal->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_propale($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("propal");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_propale['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Commandes
|
|
||||||
if ($conf->commande->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_commande($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("orders");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_commande['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Contrats
|
|
||||||
if ($conf->contrat->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_contrat($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("contracts");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_contrat['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
// Factures
|
|
||||||
if ($conf->facture->enabled)
|
|
||||||
{
|
|
||||||
$ret=$product->load_stats_facture($socidp);
|
|
||||||
if ($ret < 0) dolibarr_print_error($db);
|
|
||||||
$langs->load("bills");
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['customers'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['nb'];
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $product->stats_facture['qty'];
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user