Standardize color of status
This commit is contained in:
parent
62fefab5ac
commit
86fc2c5d26
@ -2785,7 +2785,7 @@ class ContratLigne extends CommonObjectLine
|
||||
elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); }
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3';
|
||||
if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status1';
|
||||
if ($status == self::STATUS_CLOSED) $statusType = 'status6';
|
||||
|
||||
$params = array(); $reg = array();
|
||||
|
||||
@ -109,7 +109,7 @@ $dataseries = array();
|
||||
$vals = array();
|
||||
|
||||
// Search by status (except expired)
|
||||
$sql = "SELECT count(cd.rowid), cd.statut";
|
||||
$sql = "SELECT count(cd.rowid) as nb, cd.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -126,16 +126,16 @@ if ($resql)
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$nb[$row[1]] = $row[0];
|
||||
if ($row[1] != 5)
|
||||
$nb[$obj->status] = $obj->nb;
|
||||
if ($obj->status != 5)
|
||||
{
|
||||
$vals[$row[1]] = $row[0];
|
||||
$totalinprocess += $row[0];
|
||||
$vals[$obj->status] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
}
|
||||
$total += $row[0];
|
||||
$total += $obj->nb;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -146,7 +146,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
// Search by status (only expired)
|
||||
$sql = "SELECT count(cd.rowid), cd.statut";
|
||||
$sql = "SELECT count(cd.rowid) as nb, cd.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -165,16 +165,16 @@ if ($resql)
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$nb[$row[1].true] = $row[0];
|
||||
if ($row[1] != 5)
|
||||
$nb[$obj->status.true] = $obj->nb;
|
||||
if ($obj->status != 5)
|
||||
{
|
||||
$vals[$row[1]] = $row[0];
|
||||
$totalinprocess += $row[0];
|
||||
$vals[$obj->status.true] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
}
|
||||
$total += $row[0];
|
||||
$total += $obj->nb;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -185,6 +185,10 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$colorseries = array();
|
||||
|
||||
include_once 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("Services").'</th></tr>'."\n";
|
||||
@ -192,6 +196,11 @@ $listofstatus = array(0, 4, 4, 5); $bool = false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0));
|
||||
if ($status == ContratLigne::STATUS_INITIAL) $colorseries[$status.$bool] = '-'.$badgeStatus0;
|
||||
if ($status == ContratLigne::STATUS_OPEN && !$bool) $colorseries[$status.$bool] = $badgeStatus4;
|
||||
if ($status == ContratLigne::STATUS_OPEN && $bool) $colorseries[$status.$bool] = $badgeStatus1;
|
||||
if ($status == ContratLigne::STATUS_CLOSED) $colorseries[$status.$bool] = $badgeStatus6;
|
||||
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
@ -209,6 +218,7 @@ if (!empty($conf->use_javascript_ajax))
|
||||
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'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user