Quelques corrections sur pages des statistiques produits
This commit is contained in:
parent
fafab1df27
commit
62e40a90c9
@ -872,9 +872,9 @@ class Product
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT pr.fk_soc) as nb_customers, COUNT(DISTINCT pr.rowid) as nb,";
|
||||
$sql.= " COUNT(pd.rowid) as nb_rows, SUM(pd.qty) as qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."propal as pr";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as pr";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.rowid = pd.fk_product AND pd.fk_propal = pr.rowid AND p.rowid = ".$this->id;
|
||||
$sql.= " WHERE pr.rowid = pd.fk_propal AND pd.fk_product = ".$this->id;
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND pr.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//$sql.= " AND pr.fk_statut != 0";
|
||||
if ($socid > 0)
|
||||
@ -912,10 +912,10 @@ class Product
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,";
|
||||
$sql.= " COUNT(cd.rowid) as nb_rows, SUM(cd.qty) as qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."product as p,";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.rowid = cd.fk_commande AND p.rowid = cd.fk_product AND p.rowid = ".$this->id;
|
||||
$sql.= " WHERE c.rowid = cd.fk_commande AND cd.fk_product = ".$this->id;
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//$sql.= " AND c.fk_statut != 0";
|
||||
if ($socid > 0)
|
||||
@ -952,17 +952,17 @@ class Product
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,";
|
||||
$sql.= " COUNT(cd.rowid) as nb_rows, SUM(cd.qty) as qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p,";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.rowid = cd.fk_contrat AND p.rowid = cd.fk_product AND p.rowid = ".$this->id;
|
||||
$sql.= " WHERE c.rowid = cd.fk_contrat AND cd.fk_product = ".$this->id;
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//$sql.= " AND c.statut != 0";
|
||||
if ($socid > 0)
|
||||
{
|
||||
$sql .= " AND c.fk_soc = $socid";
|
||||
}
|
||||
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
if ( $result )
|
||||
{
|
||||
@ -992,10 +992,10 @@ class Product
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_customers, COUNT(DISTINCT f.rowid) as nb,";
|
||||
$sql.= " COUNT(pd.rowid) as nb_rows, SUM(pd.qty) as qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as pd, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as pd,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.rowid = pd.fk_facture AND p.rowid = pd.fk_product AND p.rowid = ".$this->id;
|
||||
$sql.= " WHERE f.rowid = pd.fk_facture AND pd.fk_product = ".$this->id;
|
||||
if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//$sql.= " AND f.fk_statut != 0";
|
||||
if ($socid > 0)
|
||||
|
||||
@ -48,6 +48,8 @@ if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="c.date_creation";
|
||||
|
||||
|
||||
// Securite
|
||||
$socidp = 0;
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
@ -67,10 +69,11 @@ else
|
||||
llxHeader();
|
||||
|
||||
|
||||
if ($_GET["id"])
|
||||
if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($_GET["id"]);
|
||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -292,7 +295,7 @@ if ($_GET["id"])
|
||||
print_liste_field_titre($langs->trans("CustomerCode"),$_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="center"',$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);
|
||||
|
||||
@ -47,7 +47,8 @@ $pagenext = $_GET["page"] + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="c.datec";
|
||||
|
||||
|
||||
// Securite
|
||||
$socidp = 0;
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
@ -67,10 +68,11 @@ else
|
||||
llxHeader();
|
||||
|
||||
|
||||
if ($_GET["id"])
|
||||
if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($_GET["id"]);
|
||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -292,7 +294,7 @@ if ($_GET["id"])
|
||||
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$_GET["id"],'',$sortfield);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"c.datec","","&id=".$_GET["id"],'align="center"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.amount","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$_GET["id"],'align="center"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||
print "</tr>\n";
|
||||
|
||||
$contratstatic=new Contrat($db);
|
||||
@ -314,7 +316,7 @@ if ($_GET["id"])
|
||||
print "<td align=\"center\">";
|
||||
print dolibarr_print_date($objp->date)."</td>";
|
||||
print "<td align=\"right\">".price($objp->amount)."</td>\n";
|
||||
print '<td align="center">'.$contratstatic->LibStatut($objp->statut,5).'</td>';
|
||||
print '<td align="right">'.$contratstatic->LibStatut($objp->statut,5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print_liste_field_titre($langs->trans("CustomerCode"),$_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="center"',$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)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
*
|
||||
|
||||
@ -45,6 +45,8 @@ if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="p.datec";
|
||||
|
||||
|
||||
// Securite
|
||||
$socidp = 0;
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
@ -63,10 +65,11 @@ else
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($_GET["id"])
|
||||
if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($_GET["id"]);
|
||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||
|
||||
if ( $result > 0)
|
||||
{
|
||||
@ -286,7 +289,7 @@ if ($_GET["id"])
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$_GET["id"],'',$sortfield);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"p.datec","","&id=".$_GET["id"],'align="center"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"p.total","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","","&id=".$_GET["id"],'align="center"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","","&id=".$_GET["id"],'align="right"',$sortfield);
|
||||
print "</tr>\n";
|
||||
|
||||
$propalstatic=new Propal($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user