|
@@ -72,7 +72,6 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|
|
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
|
|
{
|
|
|
// Search customer orders
|
|
|
- $var = false;
|
|
|
print '<form method="post" action="'.DOL_URL_ROOT.'/commande/list.php">';
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
@@ -88,7 +87,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
|
|
|
* Statistics
|
|
|
*/
|
|
|
|
|
|
-$sql = "SELECT count(c.rowid), c.fk_statut";
|
|
|
+$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";
|
|
@@ -117,7 +116,7 @@ if ($resql)
|
|
|
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
|
|
|
{
|
|
|
if (! isset($vals[$row[1]])) $vals[$row[1]]=0;
|
|
|
- $vals[$row[1].$bool]+=$row[0];
|
|
|
+ $vals[$row[1]]+=$row[0];
|
|
|
$totalinprocess+=$row[0];
|
|
|
}
|
|
|
$total+=$row[0];
|
|
@@ -125,13 +124,32 @@ if ($resql)
|
|
|
$i++;
|
|
|
}
|
|
|
$db->free($resql);
|
|
|
+
|
|
|
+ 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("CustomersOrders").'</th></tr>'."\n";
|
|
|
$listofstatus=array(0,1,2,3,-1);
|
|
|
foreach ($listofstatus as $status)
|
|
|
{
|
|
|
- $dataseries[]=array($commandestatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
|
|
|
+ $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)
|
|
|
{
|
|
@@ -140,6 +158,7 @@ if ($resql)
|
|
|
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'));
|
|
@@ -149,19 +168,6 @@ if ($resql)
|
|
|
|
|
|
print '</td></tr>';
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- foreach ($listofstatus as $status)
|
|
|
- {
|
|
|
- print '<tr class="oddeven">';
|
|
|
- print '<td>'.$commandestatic->LibStatut($status, $bool, 0).'</td>';
|
|
|
- print '<td class="right"><a href="list.php?viewstatut='.$status.'">'.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' ';
|
|
|
- print $commandestatic->LibStatut($status, $bool, 3);
|
|
|
- print '</a>';
|
|
|
- print '</td>';
|
|
|
- print "</tr>\n";
|
|
|
- }
|
|
|
- }
|
|
|
//if ($totalinprocess != $total)
|
|
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'.$total.'</td></tr>';
|
|
|
print "</table></div><br>";
|
|
@@ -202,7 +208,6 @@ if (!empty($conf->commande->enabled))
|
|
|
if ($num)
|
|
|
{
|
|
|
$i = 0;
|
|
|
- $var = true;
|
|
|
while ($i < $num)
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
@@ -241,7 +246,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|
|
$max = 5;
|
|
|
|
|
|
/*
|
|
|
- * Last modified orders
|
|
|
+ * Lattest modified orders
|
|
|
*/
|
|
|
|
|
|
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
|
|
@@ -272,7 +277,6 @@ if ($resql)
|
|
|
if ($num)
|
|
|
{
|
|
|
$i = 0;
|
|
|
- $var = true;
|
|
|
while ($i < $num)
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
@@ -320,6 +324,7 @@ if ($resql)
|
|
|
}
|
|
|
else dol_print_error($db);
|
|
|
|
|
|
+$max = 10;
|
|
|
|
|
|
/*
|
|
|
* Orders to process
|
|
@@ -335,7 +340,7 @@ if (!empty($conf->commande->enabled))
|
|
|
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('commande').")";
|
|
|
- $sql .= " AND c.fk_statut = 1";
|
|
|
+ $sql .= " AND c.fk_statut = ".Commande::STATUS_VALIDATED;
|
|
|
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
|
|
$sql .= " ORDER BY c.rowid DESC";
|
|
@@ -344,16 +349,16 @@ if (!empty($conf->commande->enabled))
|
|
|
if ($resql)
|
|
|
{
|
|
|
$num = $db->num_rows($resql);
|
|
|
+
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
print '<table class="noborder centpercent">';
|
|
|
print '<tr class="liste_titre">';
|
|
|
- print '<th colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></th></tr>';
|
|
|
+ print '<th colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut='.Commande::STATUS_VALIDATED.'"><span class="badge">'.$num.'</span></a></th></tr>';
|
|
|
|
|
|
if ($num)
|
|
|
{
|
|
|
$i = 0;
|
|
|
- $var = true;
|
|
|
- while ($i < $num)
|
|
|
+ while ($i < $num && $i < $max)
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
print '<tr class="oddeven">';
|
|
@@ -395,6 +400,9 @@ if (!empty($conf->commande->enabled))
|
|
|
print '</tr>';
|
|
|
$i++;
|
|
|
}
|
|
|
+ if ($i < $num) {
|
|
|
+ print '<tr><td><span class="opacitymedium">'.$langs->trans("More").'...</span></td><td></td><td></td></tr>';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
print "</table></div><br>";
|
|
@@ -403,7 +411,7 @@ if (!empty($conf->commande->enabled))
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- * Orders thar are in a shipping process
|
|
|
+ * Orders that are in process
|
|
|
*/
|
|
|
if (!empty($conf->commande->enabled))
|
|
|
{
|
|
@@ -416,7 +424,7 @@ if (!empty($conf->commande->enabled))
|
|
|
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('commande').")";
|
|
|
- $sql .= " AND c.fk_statut = 2 ";
|
|
|
+ $sql .= " AND c.fk_statut = ".Commande::STATUS_ACCEPTED;
|
|
|
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
|
|
$sql .= " ORDER BY c.rowid DESC";
|
|
@@ -429,13 +437,12 @@ if (!empty($conf->commande->enabled))
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
print '<table class="noborder centpercent">';
|
|
|
print '<tr class="liste_titre">';
|
|
|
- print '<th colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=2"><span class="badge">'.$num.'</span></a></th></tr>';
|
|
|
+ print '<th colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut='.Commande::STATUS_ACCEPTED.'"><span class="badge">'.$num.'</span></a></th></tr>';
|
|
|
|
|
|
if ($num)
|
|
|
{
|
|
|
$i = 0;
|
|
|
- $var = true;
|
|
|
- while ($i < $num)
|
|
|
+ while ($i < $num && $i < $max)
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
print '<tr class="oddeven">';
|
|
@@ -477,6 +484,9 @@ if (!empty($conf->commande->enabled))
|
|
|
print '</tr>';
|
|
|
$i++;
|
|
|
}
|
|
|
+ if ($i < $num) {
|
|
|
+ print '<tr><td><span class="opacitymedium">'.$langs->trans("More").'...</span></td><td></td><td></td></tr>';
|
|
|
+ }
|
|
|
}
|
|
|
print "</table></div><br>";
|
|
|
}
|