Clean code

This commit is contained in:
Laurent Destailleur 2021-04-26 11:59:47 +02:00
parent c9d6bc70e8
commit 87393cee98
8 changed files with 320 additions and 233 deletions

View File

@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager = new HookManager($db);
@ -102,6 +104,11 @@ print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial');
print '<div class="fichecenter"><div class="fichethirdleft">';
print getCustomerProposalPieChart($socid);
print '<br>';
print getCustomerOrderPieChart($socid);
print '<br>';
/*
* Draft customer proposals
*/

View File

@ -28,6 +28,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager = new HookManager($db);
@ -45,6 +46,7 @@ if (isset($user->socid) && $user->socid > 0) {
$action = '';
$socid = $user->socid;
}
restrictedArea($user, 'propal');
@ -65,124 +67,8 @@ print load_fiche_titre($langs->trans("ProspectionArea"), '', 'propal');
print '<div class="fichecenter">';
print '<div class="fichethirdleft">';
/*
* Statistics
*/
$listofstatus = array(Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED);
$sql = "SELECT count(p.rowid) as nb, p.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid";
if ($user->socid) {
$sql .= ' AND p.fk_soc = '.$user->socid;
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
$sql .= " AND p.fk_statut IN (".$db->sanitize(implode(" ,", $listofstatus)).")";
$sql .= " GROUP BY p.fk_statut";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalinprocess = 0;
$dataseries = array();
$colorseries = array();
$vals = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj) {
$vals[$obj->status] = $obj->nb;
$totalinprocess += $obj->nb;
$total += $obj->nb;
}
$i++;
}
$db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'</td>';
print '</tr>';
foreach ($listofstatus as $status) {
$dataseries[] = array($propalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Propal::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
if ($status == Propal::STATUS_VALIDATED) {
$colorseries[$status] = $badgeStatus1;
}
if ($status == Propal::STATUS_SIGNED) {
$colorseries[$status] = $badgeStatus4;
}
if ($status == Propal::STATUS_NOTSIGNED) {
$colorseries[$status] = $badgeStatus9;
}
if ($status == Propal::STATUS_BILLED) {
$colorseries[$status] = $badgeStatus6;
}
if (empty($conf->use_javascript_ajax)) {
print '<tr class="oddeven">';
print '<td>'.$propalstatic->LibStatut($status, 0).'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
print "</tr>\n";
}
}
if ($conf->use_javascript_ajax) {
print '<tr>';
print '<td align="center" colspan="2">';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphthirdparties');
print $dolgraph->show($total ? 0 : 1);
print '</td>';
print '</tr>';
}
//if ($totalinprocess != $total)
//{
// print '<tr class="liste_total">';
// print '<td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')</td>';
// print '<td class="right">'.$totalinprocess.'</td>';
// print '</tr>';
//}
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td class="right">'.$total.'</td>';
print '</tr>';
print '</table>';
print '</div>';
print '<br>';
} else {
dol_print_error($db);
}
print getCustomerProposalPieChart($socid);
print '<br>';
/*
* Draft proposals

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
if (!$user->rights->commande->lire) {
accessforbidden();
@ -76,113 +77,8 @@ print load_fiche_titre($langs->trans("OrdersArea"), '', 'order');
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
* Statistics
*/
$sql = "SELECT count(c.rowid) as nb, c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('societe').")";
if ($user->socid) {
$sql .= ' AND c.fk_soc = '.$user->socid;
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
$sql .= " GROUP BY c.fk_statut";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalinprocess = 0;
$dataseries = array();
$colorseries = array();
$vals = array();
// -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not)
while ($i < $num) {
$row = $db->fetch_row($resql);
if ($row) {
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
{
if (!isset($vals[$row[1]])) {
$vals[$row[1]] = 0;
}
$vals[$row[1]] += $row[0];
$totalinprocess += $row[0];
}
$total += $row[0];
}
$i++;
}
$db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</th></tr>'."\n";
$listofstatus = array(0, 1, 2, 3, -1);
foreach ($listofstatus as $status) {
$dataseries[] = array($commandestatic->LibStatut($status, 0, 1, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Commande::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
if ($status == Commande::STATUS_VALIDATED) {
$colorseries[$status] = $badgeStatus1;
}
if ($status == Commande::STATUS_SHIPMENTONPROCESS) {
$colorseries[$status] = $badgeStatus4;
}
if ($status == Commande::STATUS_CLOSED && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
$colorseries[$status] = $badgeStatus6;
}
if ($status == Commande::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
$colorseries[$status] = $badgeStatus6;
}
if ($status == Commande::STATUS_CANCELED) {
$colorseries[$status] = $badgeStatus9;
}
if (empty($conf->use_javascript_ajax)) {
print '<tr class="oddeven">';
print '<td>'.$commandestatic->LibStatut($status, 0, 0, 1).'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).' ';
print $commandestatic->LibStatut($status, 0, 3, 1);
print '</a></td>';
print "</tr>\n";
}
}
if ($conf->use_javascript_ajax) {
print '<tr class="impair"><td align="center" colspan="2">';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
print '</td></tr>';
}
//if ($totalinprocess != $total)
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'.$total.'</td></tr>';
print "</table></div><br>";
} else {
dol_print_error($db);
}
print getCustomerOrderPieChart($socid);
print '<br>';
/*

View File

@ -149,8 +149,8 @@ class box_graph_product_distribution extends ModeleBoxes
$socid = empty($user->socid) ? 0 : $user->socid;
$userid = 0; // No filter on user creation
$WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '160' : '320';
$HEIGHT = '192';
$WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '300' : '320';
$HEIGHT = '120';
if (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) {
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
@ -177,6 +177,7 @@ class box_graph_product_distribution extends ModeleBoxes
$i = 0;
$legend = array();
// Truncate length of legend
foreach ($data2 as $key => $val) {
$data2[$key][0] = dol_trunc($data2[$key][0], 32);
$legend[] = $data2[$key][0];
@ -194,7 +195,7 @@ class box_graph_product_distribution extends ModeleBoxes
$px2->setShowPointValue($showpointvalue);
$px2->setShowPercent(0);
$px2->SetMaxValue($px2->GetCeilMaxValue());
//$px2->SetWidth($WIDTH);
$px2->SetWidth($WIDTH);
$px2->SetHeight($HEIGHT);
//$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
$px2->SetShading(3);
@ -236,6 +237,7 @@ class box_graph_product_distribution extends ModeleBoxes
$i = 0;
$legend = array();
// Truncate length of legend
foreach ($data3 as $key => $val) {
$data3[$key][0] = dol_trunc($data3[$key][0], 32);
$legend[] = $data3[$key][0];
@ -253,7 +255,7 @@ class box_graph_product_distribution extends ModeleBoxes
$px3->setShowPointValue($showpointvalue);
$px3->setShowPercent(0);
$px3->SetMaxValue($px3->GetCeilMaxValue());
//$px3->SetWidth($WIDTH);
$px3->SetWidth($WIDTH);
$px3->SetHeight($HEIGHT);
//$px3->SetYLabel($langs->trans("AmountOfBillsHT"));
$px3->SetShading(3);
@ -296,6 +298,7 @@ class box_graph_product_distribution extends ModeleBoxes
$i = 0;
$legend = array();
// Truncate length of legend
foreach ($data1 as $key => $val) {
$data1[$key][0] = dol_trunc($data1[$key][0], 32);
$legend[] = $data1[$key][0];
@ -313,7 +316,7 @@ class box_graph_product_distribution extends ModeleBoxes
$px1->setShowPointValue($showpointvalue);
$px1->setShowPercent(0);
$px1->SetMaxValue($px1->GetCeilMaxValue());
//$px1->SetWidth($WIDTH);
$px1->SetWidth($WIDTH);
$px1->SetHeight($HEIGHT);
//$px1->SetYLabel($langs->trans("NumberOfBills"));
$px1->SetShading(3);

View File

@ -1165,9 +1165,32 @@ class DolGraph
if (!empty($legendMaxLines)) {
$this->stringtoshow .= ', maxLines: ' . $legendMaxLines . '';
}
/* This has no effect on chartjs version with dol v14
$this->stringtoshow .= ', labels: {
color: \'rgb(255, 0, 0)\',
// This more specific font property overrides the global property
font: {
size: 24
}
}';
*/
$this->stringtoshow .= ' }, ' . "\n";
}
/* This has no effect on chartjs version with dol v14
$this->stringtoshow .= 'plugins: {
legend: {
display: true,
labels: {
color: \'rgb(255, 0, 0)\',
// This more specific font property overrides the global property
font: {
size: 24
}
}
}
},'."\n"; */
if ($this->type[$firstlot] == 'piesemicircle') {
$this->stringtoshow .= 'circumference: Math.PI,' . "\n";
$this->stringtoshow .= 'rotation: -Math.PI,' . "\n";
@ -1236,7 +1259,7 @@ class DolGraph
if ($i > 0) {
$this->stringtoshow .= ', ';
}
$this->stringtoshow .= "'" . dol_escape_js(dol_trunc($val, 32)) . "'";
$this->stringtoshow .= "'" . dol_escape_js(dol_trunc($val, 22)) . "'";
$i++;
}

View File

@ -315,7 +315,8 @@ function getCustomerInvoicePieChart($socid = 0)
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']);
$dolgraph->setHeight('200');
$dolgraph->setHeight('150');
$dolgraph->setWidth('300');
$dolgraph->draw('idgraphcustomerinvoices');
$result .= '<tr>';
@ -435,7 +436,8 @@ function getPurchaseInvoicePieChart($socid = 0)
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']);
$dolgraph->setHeight('200');
$dolgraph->setHeight('150');
$dolgraph->setWidth('300');
$dolgraph->draw('idgraphpurchaseinvoices');
$result .= '<tr>';

View File

@ -171,3 +171,135 @@ function order_admin_prepare_head()
return $head;
}
/**
* Return a HTML table that contains a pie chart of customer orders
*
* @param int $socid (Optional) Show only results from the customer with this id
* @return string A HTML table that contains a pie chart of customer invoices
*/
function getCustomerOrderPieChart($socid = 0)
{
global $conf, $db, $langs, $user;
$result = '';
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) {
return '';
}
$commandestatic = new Commande($db);
/*
* Statistics
*/
$sql = "SELECT count(c.rowid) as nb, c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('societe').")";
if ($user->socid) {
$sql .= ' AND c.fk_soc = '.$user->socid;
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
$sql .= " GROUP BY c.fk_statut";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalinprocess = 0;
$dataseries = array();
$colorseries = array();
$vals = array();
// -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not)
while ($i < $num) {
$row = $db->fetch_row($resql);
if ($row) {
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
{
if (!isset($vals[$row[1]])) {
$vals[$row[1]] = 0;
}
$vals[$row[1]] += $row[0];
$totalinprocess += $row[0];
}
$total += $row[0];
}
$i++;
}
$db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
$result = '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder nohover centpercent">';
$result .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</th></tr>'."\n";
$listofstatus = array(0, 1, 2, 3, -1);
foreach ($listofstatus as $status) {
$dataseries[] = array($commandestatic->LibStatut($status, 0, 1, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Commande::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
if ($status == Commande::STATUS_VALIDATED) {
$colorseries[$status] = $badgeStatus1;
}
if ($status == Commande::STATUS_SHIPMENTONPROCESS) {
$colorseries[$status] = $badgeStatus4;
}
if ($status == Commande::STATUS_CLOSED && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
$colorseries[$status] = $badgeStatus6;
}
if ($status == Commande::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
$colorseries[$status] = $badgeStatus6;
}
if ($status == Commande::STATUS_CANCELED) {
$colorseries[$status] = $badgeStatus9;
}
if (empty($conf->use_javascript_ajax)) {
$result .= '<tr class="oddeven">';
$result .= '<td>'.$commandestatic->LibStatut($status, 0, 0, 1).'</td>';
$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).' ';
$result .= $commandestatic->LibStatut($status, 0, 3, 1);
$result .= '</a></td>';
$result .= "</tr>\n";
}
}
if ($conf->use_javascript_ajax) {
$result .= '<tr class="impair"><td align="center" colspan="2">';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('150');
$dolgraph->setWidth('300');
$dolgraph->draw('idgraphstatus');
$result .= $dolgraph->show($total ? 0 : 1);
$result .= '</td></tr>';
}
//if ($totalinprocess != $total)
$result .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'.$total.'</td></tr>';
$result .= "</table></div><br>";
} else {
dol_print_error($db);
}
return $result;
}

View File

@ -152,3 +152,141 @@ function propal_admin_prepare_head()
return $head;
}
/**
* Return a HTML table that contains a pie chart of customer proposals
*
* @param int $socid (Optional) Show only results from the customer with this id
* @return string A HTML table that contains a pie chart of customer invoices
*/
function getCustomerProposalPieChart($socid = 0)
{
global $conf, $db, $langs, $user;
$result= '';
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) {
return '';
}
$listofstatus = array(Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED);
$propalstatic = new Propal($db);
$sql = "SELECT count(p.rowid) as nb, p.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid";
if ($user->socid) {
$sql .= ' AND p.fk_soc = '.$user->socid;
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
$sql .= " AND p.fk_statut IN (".$db->sanitize(implode(" ,", $listofstatus)).")";
$sql .= " GROUP BY p.fk_statut";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$totalinprocess = 0;
$dataseries = array();
$colorseries = array();
$vals = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj) {
$vals[$obj->status] = $obj->nb;
$totalinprocess += $obj->nb;
$total += $obj->nb;
}
$i++;
}
$db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
$result = '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder nohover centpercent">';
$result .= '<tr class="liste_titre">';
$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'</td>';
$result .= '</tr>';
foreach ($listofstatus as $status) {
$dataseries[] = array($propalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Propal::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
if ($status == Propal::STATUS_VALIDATED) {
$colorseries[$status] = $badgeStatus1;
}
if ($status == Propal::STATUS_SIGNED) {
$colorseries[$status] = $badgeStatus4;
}
if ($status == Propal::STATUS_NOTSIGNED) {
$colorseries[$status] = $badgeStatus9;
}
if ($status == Propal::STATUS_BILLED) {
$colorseries[$status] = $badgeStatus6;
}
if (empty($conf->use_javascript_ajax)) {
$result .= '<tr class="oddeven">';
$result .= '<td>'.$propalstatic->LibStatut($status, 0).'</td>';
$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
$result .= "</tr>\n";
}
}
if ($conf->use_javascript_ajax) {
$result .= '<tr>';
$result .= '<td align="center" colspan="2">';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('150');
$dolgraph->setWidth('300');
$dolgraph->draw('idgraphthirdparties');
$result .= $dolgraph->show($total ? 0 : 1);
$result .= '</td>';
$result .= '</tr>';
}
//if ($totalinprocess != $total)
//{
// print '<tr class="liste_total">';
// print '<td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')</td>';
// print '<td class="right">'.$totalinprocess.'</td>';
// print '</tr>';
//}
$result .= '<tr class="liste_total">';
$result .= '<td>'.$langs->trans("Total").'</td>';
$result .= '<td class="right">'.$total.'</td>';
$result .= '</tr>';
$result .= '</table>';
$result .= '</div>';
$result .= '<br>';
} else {
dol_print_error($db);
}
return $result;
}