Skip to content
Snippets Groups Projects
Commit d584d29e authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

parents 95906a9a 93393db9
No related branches found
No related tags found
No related merge requests found
...@@ -27,8 +27,10 @@ ProductsAndServicesNotOnSell=Produits et Services hors vente ...@@ -27,8 +27,10 @@ ProductsAndServicesNotOnSell=Produits et Services hors vente
ProductsAndServicesStatistics=Statistiques produits et services ProductsAndServicesStatistics=Statistiques produits et services
ProductsStatistics=Statistiques produits ProductsStatistics=Statistiques produits
ProductsOnSell=Produits en vente ou en achat ProductsOnSell=Produits en vente ou en achat
ProductsOnSellAndOnBuy=Produits en vente et en achat
ProductsNotOnSell=Produits hors vente et hors achat ProductsNotOnSell=Produits hors vente et hors achat
ServicesOnSell=Services en vente ou en achat ServicesOnSell=Services en vente ou en achat
ServicesOnSellAndOnBuy=Services en vente et en achat
ServicesNotOnSell=Services hors vente et hors achat ServicesNotOnSell=Services hors vente et hors achat
InternalRef=Référence interne InternalRef=Référence interne
LastRecorded=Derniers produits/services en vente enregistrés LastRecorded=Derniers produits/services en vente enregistrés
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -111,9 +112,10 @@ $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy"; ...@@ -111,9 +112,10 @@ $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
$result = $db->query($sql); $result = $db->query($sql);
while ($objp = $db->fetch_object($result)) while ($objp = $db->fetch_object($result))
{ {
$status=1; $status=2;
if (! $objp->tosell && ! $objp->tobuy) $status=0; // To sell OR to buy if (! $objp->tosell && ! $objp->tobuy) $status=0; // To sell OR to buy
$prodser[$objp->fk_product_type][$status]+=$objp->total; if ((! $objp->tosell && $objp->tobuy) || ($objp->tosell && ! $objp->tobuy)) $status=1;
$prodser[$objp->fk_product_type][$status]=$objp->total;
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
...@@ -124,40 +126,105 @@ if (! empty($conf->product->enabled)) ...@@ -124,40 +126,105 @@ if (! empty($conf->product->enabled))
$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>'; $statProducts.= '<td><a href="liste.php?type=0&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
$statProducts.= "</tr>"; $statProducts.= "</tr>";
$statProducts.= "<tr ".$bc[1].">"; $statProducts.= "<tr ".$bc[1].">";
$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>'; $statProducts.= '<td><a href="liste.php?type=0">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
$statProducts.= "</tr>"; $statProducts.= "</tr>";
$statProducts.= "<tr ".$bc[0].">";
$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=1&amp;tobuy=1">'.$langs->trans("ProductsOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[0][2]).'</td>';
$statProducts.= "</tr>";
} }
if (! empty($conf->service->enabled)) if (! empty($conf->service->enabled))
{ {
$statServices = "<tr ".$bc[0].">"; $statServices = "<tr ".$bc[1].">";
$statServices.= '<td><a href="liste.php?type=1&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>'; $statServices.= '<td><a href="liste.php?type=1&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
$statServices.= "</tr>"; $statServices.= "</tr>";
$statServices.= "<tr ".$bc[0].">";
$statServices.= '<td><a href="liste.php?type=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
$statServices.= "</tr>";
$statServices.= "<tr ".$bc[1].">"; $statServices.= "<tr ".$bc[1].">";
$statServices.= '<td><a href="liste.php?type=1&amp;tosell=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>'; $statServices.= '<td><a href="liste.php?type=1&amp;tosell=1&amp;tobuy=1">'.$langs->trans("ServicesOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[1][2]).'</td>';
$statServices.= "</tr>"; $statServices.= "</tr>";
} }
$total=0; $total=0;
if ($type == '0') if ($type == '0')
{ {
print $statProducts; print $statProducts;
$total=round($prodser[0][0])+round($prodser[0][1]); $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
} }
else if ($type == '1') else if ($type == '1')
{ {
print $statServices; print $statServices;
$total=round($prodser[1][0])+round($prodser[1][1]); $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2]);
} }
else else
{ {
print $statProducts.$statServices; print $statProducts.$statServices;
$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[0][0])+round($prodser[0][1]); $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
} }
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'; print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
print $total; print $total;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
print '<tr><td align="center">';
$sql = "SELECT c.label, count(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
$sql.= " WHERE c.type = 0";
$sql.= " AND c.entity IN (".getEntity('category',1).")";
$sql.= " GROUP BY c.label";
$total=0;
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i=0;
if (! empty($conf->use_javascript_ajax))
{
$dataseries=array();
$rest=0;
$nbmax=10;
while ($i < $num)
{
$obj = $db->fetch_object($result);
if ($i < $nbmax)
$dataseries[]=array('label'=>$obj->label,'data'=>round($obj->nb));
else
$rest+=$obj->nb;
$total+=$obj->nb;
$i++;
}
if ($i > $nbmax)
$dataseries[]=array('label'=>$langs->trans("Other"),'data'=>round($rest));
$data=array('series'=>$dataseries);
dol_print_graph('statscategproduct',300,180,$data,1,'pie',0);
}
else
{
$var=true;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print '<tr $bc[$var]><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
$total+=$obj->nb;
$i++;
}
}
}
print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
print $total;
print '</td></tr>';
print '</table>';
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Charles-Fr Benke <charles.fr@benke.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -158,6 +159,66 @@ print $total; ...@@ -158,6 +159,66 @@ print $total;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$elementtype = 'societe';
print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
print '<tr><td align="center">';
$sql = "SELECT c.label, count(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
$sql.= " WHERE c.type = 2";
$sql.= " AND c.entity IN (".getEntity('category',1).")";
$sql.= " GROUP BY c.label";
$total=0;
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i=0;
if (! empty($conf->use_javascript_ajax) )
{
$dataseries=array();
$rest=0;
$nbmax=10;
while ($i < $num)
{
$obj = $db->fetch_object($result);
if ($i < $nbmax)
$dataseries[]=array('label'=>$obj->label,'data'=>round($obj->nb));
else
$rest+=$obj->nb;
$total+=$obj->nb;
$i++;
}
if ($i > $nbmax)
$dataseries[]=array('label'=>$langs->trans("Other"),'data'=>round($rest));
$data=array('series'=>$dataseries);
dol_print_graph('statscategclient',300,180,$data,1,'pie',0);
}
else
{
$var=true;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print '<tr $bc[$var]><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
$total+=$obj->nb;
$i++;
}
}
}
print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
print $total;
print '</td></tr>';
print '</table>';
}
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">'; //print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment