New: Add more graph and fix some statistics.
This commit is contained in:
parent
5a6221629e
commit
c6df144818
@ -2396,11 +2396,11 @@ class Commande extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
* \param statut Id statut
|
* @param statut Id statut
|
||||||
* \param facturee Si facturee
|
* @param facturee Si facturee
|
||||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* \return string Libelle
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$facturee,$mode)
|
function LibStatut($statut,$facturee,$mode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class CommandeStats extends Stats
|
|||||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
$this->field='total_ht';
|
$this->field='total_ht';
|
||||||
$this->where.= " c.fk_statut >= 3 AND c.date_commande IS NOT NULL";
|
$this->where.= " c.fk_statut > 0";
|
||||||
}
|
}
|
||||||
$this->where.= " AND c.fk_soc = s.rowid AND s.entity = ".$conf->entity;
|
$this->where.= " AND c.fk_soc = s.rowid AND s.entity = ".$conf->entity;
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class CommandeStats extends Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le nombre de commande par mois pour une ann<EFBFBD>e donn<EFBFBD>e
|
* \brief Renvoie le nombre de commande par mois pour une annee donnee
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function getNbByMonth($year)
|
function getNbByMonth($year)
|
||||||
@ -95,10 +95,10 @@ class CommandeStats extends Stats
|
|||||||
global $conf;
|
global $conf;
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, count(*) nb";
|
$sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE date_format(c.date_commande,'%Y') = ".$year;
|
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year;
|
||||||
$sql.= " AND ".$this->where;
|
$sql.= " AND ".$this->where;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
@ -115,7 +115,7 @@ class CommandeStats extends Stats
|
|||||||
global $conf;
|
global $conf;
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, count(*), sum(c.".$this->field.")";
|
$sql = "SELECT date_format(c.date_valid,'%Y') as dm, count(*), sum(c.".$this->field.")";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE ".$this->where;
|
$sql.= " WHERE ".$this->where;
|
||||||
@ -134,10 +134,10 @@ class CommandeStats extends Stats
|
|||||||
global $conf;
|
global $conf;
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, sum(c.".$this->field.")";
|
$sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE date_format(c.date_commande,'%Y') = ".$year;
|
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year;
|
||||||
$sql.= " AND ".$this->where;
|
$sql.= " AND ".$this->where;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
@ -154,10 +154,10 @@ class CommandeStats extends Stats
|
|||||||
global $conf;
|
global $conf;
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, avg(c.".$this->field.")";
|
$sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE date_format(c.date_commande,'%Y') = ".$year;
|
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year;
|
||||||
$sql.= " AND ".$this->where;
|
$sql.= " AND ".$this->where;
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
@ -174,7 +174,7 @@ class CommandeStats extends Stats
|
|||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, count(*) as nb, sum(c.".$this->field.") as total, avg(".$this->field.") as avg";
|
$sql = "SELECT date_format(c.date_valid,'%Y') as year, count(*) as nb, sum(c.".$this->field.") as total, avg(".$this->field.") as avg";
|
||||||
$sql.= " FROM ".$this->from;
|
$sql.= " FROM ".$this->from;
|
||||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE ".$this->where;
|
$sql.= " WHERE ".$this->where;
|
||||||
|
|||||||
@ -95,8 +95,6 @@ if ($resql)
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$var=True;
|
|
||||||
|
|
||||||
$total=0;
|
$total=0;
|
||||||
$totalinprocess=0;
|
$totalinprocess=0;
|
||||||
$dataseries=array();
|
$dataseries=array();
|
||||||
@ -107,7 +105,7 @@ if ($resql)
|
|||||||
$row = $db->fetch_row($resql);
|
$row = $db->fetch_row($resql);
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
if ($row[1]!=3 || $row[2]!=1)
|
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
|
||||||
{
|
{
|
||||||
$vals[$row[1]]=$row[0];
|
$vals[$row[1]]=$row[0];
|
||||||
$totalinprocess+=$row[0];
|
$totalinprocess+=$row[0];
|
||||||
@ -119,19 +117,22 @@ if ($resql)
|
|||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</td></tr>'."\n";
|
||||||
print "</tr>\n";
|
$var=true;
|
||||||
foreach (array(1,2,3,-1) as $statut)
|
$listofstatus=array(0,1,3,3,-1); $bool=false;
|
||||||
|
foreach ($listofstatus as $status)
|
||||||
{
|
{
|
||||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,0),'values'=>array(0=>(isset($vals[$statut])?$vals[$statut]:0)));
|
$dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,0),'values'=>array(0=>(isset($vals[$status])?$vals[$status]:0)));
|
||||||
if (! $conf->use_javascript_ajax)
|
if (! $conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>'.$commandestatic->LibStatut($statut,0).'</td>';
|
print '<td>'.$commandestatic->LibStatut($status,$bool,0).'</td>';
|
||||||
print '<td align="right"><a href="liste.php?statut='.$statut.'">'.(isset($vals[$statut])?$vals[$statut]:0).'</a></td>';
|
print '<td align="right"><a href="liste.php?statut='.$status.'">'.(isset($vals[$status])?$vals[$status]:0).'</a></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
if ($status==3 && $bool==false) $bool=true;
|
||||||
|
else $bool=false;
|
||||||
}
|
}
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
@ -141,8 +142,8 @@ if ($resql)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
//if ($totalinprocess != $total)
|
//if ($totalinprocess != $total)
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("CustomersOrders").')</td><td align="right">'.$total.'</td></tr>';
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
@ -61,6 +61,9 @@ if (! $sortfield) $sortfield='c.rowid';
|
|||||||
if (! $sortorder) $sortorder='DESC';
|
if (! $sortorder) $sortorder='DESC';
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
|
|
||||||
|
$viewstatut=GETPOST('viewstatut');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -74,11 +77,8 @@ $companystatic = new Societe($db);
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$viewstatut=$_GET['viewstatut'];
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||||
$sql.= ' c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -115,11 +115,11 @@ if ($viewstatut <> '')
|
|||||||
}
|
}
|
||||||
if ($_GET['ordermonth'] > 0)
|
if ($_GET['ordermonth'] > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND date_format(c.date_commande, '%Y-%m') = '$orderyear-$ordermonth'";
|
$sql.= " AND date_format(c.date_valid, '%Y-%m') = '$orderyear-$ordermonth'";
|
||||||
}
|
}
|
||||||
if ($_GET['orderyear'] > 0)
|
if ($_GET['orderyear'] > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND date_format(c.date_commande, '%Y') = $orderyear";
|
$sql.= " AND date_format(c.date_valid, '%Y') = $orderyear";
|
||||||
}
|
}
|
||||||
if ($_GET['deliverymonth'] > 0)
|
if ($_GET['deliverymonth'] > 0)
|
||||||
{
|
{
|
||||||
@ -215,7 +215,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
||||||
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_commande) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_valid) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td width="16" align="right" class="nobordernopadding">';
|
print '<td width="16" align="right" class="nobordernopadding">';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.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
|
||||||
@ -52,7 +52,7 @@ $staticcontratligne=new ContratLigne($db);
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$now = gmmktime();
|
$now = dol_now();
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -81,16 +81,22 @@ if ($conf->contrat->enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Legends / Status
|
* Statistics
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$nb=array();
|
$nb=array();
|
||||||
|
$total=0;
|
||||||
|
$totalinprocess=0;
|
||||||
|
$dataseries=array();
|
||||||
|
$vals=array();
|
||||||
|
|
||||||
// Search by status (except expired)
|
// Search by status (except expired)
|
||||||
$sql = "SELECT count(cd.rowid), cd.statut";
|
$sql = "SELECT count(cd.rowid), cd.statut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
$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";
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||||
$sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= ".$db->idate(dol_now('tzref')).')))';
|
$sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate(dol_now('tzref'))."')))";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
@ -100,11 +106,19 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row($resql);
|
$row = $db->fetch_row($resql);
|
||||||
$nb[$row[1]]=$row[0];
|
if ($row)
|
||||||
|
{
|
||||||
|
$nb[$row[1]]=$row[0];
|
||||||
|
if ($row[1]!=5)
|
||||||
|
{
|
||||||
|
$vals[$row[1]]=$row[0];
|
||||||
|
$totalinprocess+=$row[0];
|
||||||
|
}
|
||||||
|
$total+=$row[0];
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -119,7 +133,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
$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";
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||||
$sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < ".$db->idate(dol_now('tzref')).')';
|
$sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate(dol_now('tzref'))."')";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
@ -128,36 +142,72 @@ $resql = $db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
// 0 inactive, 4 active, 5 closed
|
||||||
{
|
$i = 0;
|
||||||
$row = $db->fetch_row($resql);
|
while ($i < $num)
|
||||||
$nb[$row[1].true]=$row[0];
|
{
|
||||||
$i++;
|
$row = $db->fetch_row($resql);
|
||||||
}
|
if ($row)
|
||||||
$db->free($resql);
|
{
|
||||||
|
$nb[$row[1].true]=$row[0];
|
||||||
|
if ($row[1]!=5)
|
||||||
|
{
|
||||||
|
$vals[$row[1]]=$row[0];
|
||||||
|
$totalinprocess+=$row[0];
|
||||||
|
}
|
||||||
|
$total+=$row[0];
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<table class="liste" width="100%">';
|
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
print '<table class="noborder" width="100%">';
|
||||||
print "</tr>\n";
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Services").'</td></tr>'."\n";
|
||||||
|
$var=true;
|
||||||
|
$listofstatus=array(0,4,4,5); $bool=false;
|
||||||
|
foreach($listofstatus as $status)
|
||||||
|
{
|
||||||
|
$dataseries[]=array('label'=>$staticcontratligne->LibStatut($status,0,($bool?1:0)),'values'=>array(0=>($nb[$status.$bool]?$nb[$status.$bool]:0)));
|
||||||
|
if (! $conf->use_javascript_ajax)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||||
|
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
if ($status==4 && $bool==false) $bool=true;
|
||||||
|
else $bool=false;
|
||||||
|
}
|
||||||
|
if ($conf->use_javascript_ajax)
|
||||||
|
{
|
||||||
|
print '<tr><td align="center" colspan="2">';
|
||||||
|
$data=array('series'=>$dataseries);
|
||||||
|
dol_print_graph('stats',300,180,$data,1,'pie');
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
$var=true;
|
$var=true;
|
||||||
$listofstatus=array(0,4,4,5); $bool=false;
|
$listofstatus=array(0,4,4,5); $bool=false;
|
||||||
foreach($listofstatus as $status)
|
foreach($listofstatus as $status)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||||
if ($status==4 && $bool==false) $bool=true;
|
if ($status==4 && $bool==false) $bool=true;
|
||||||
else $bool=false;
|
else $bool=false;
|
||||||
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
//if ($totalinprocess != $total)
|
||||||
|
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||||
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -116,9 +116,9 @@ if ($resql)
|
|||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</td></tr>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
foreach (array(0,1,2,3,4) as $statut)
|
foreach (array(0,1,2,3,4,5,6) as $statut)
|
||||||
{
|
{
|
||||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,0),'values'=>array(0=>(isset($vals[$statut])?$vals[$statut]:0)));
|
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,0),'values'=>array(0=>(isset($vals[$statut])?$vals[$statut]:0)));
|
||||||
if (! $conf->use_javascript_ajax)
|
if (! $conf->use_javascript_ajax)
|
||||||
@ -138,8 +138,8 @@ if ($resql)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
//if ($totalinprocess != $total)
|
//if ($totalinprocess != $total)
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrders").')</td><td align="right">'.$total.'</td></tr>';
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||||
|
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.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
|
||||||
|
|||||||
@ -163,7 +163,7 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
|
|||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
||||||
-- Accountancy - Orders to bill
|
-- Accountancy - Orders to bill
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&status=3&afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
||||||
-- Donations
|
-- Donations
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
||||||
|
|||||||
@ -185,7 +185,7 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
|
|||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->facture->enabled && $conf->banque->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
||||||
-- Accountancy - Orders to bill
|
-- Accountancy - Orders to bill
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&status=3&afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/commande/liste.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
||||||
-- Donations
|
-- Donations
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
||||||
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
||||||
|
|||||||
@ -900,7 +900,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
|||||||
if ($conf->commande->enabled)
|
if ($conf->commande->enabled)
|
||||||
{
|
{
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
if ($conf->facture->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&status=3&afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
|
if ($conf->facture->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
|
||||||
// if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
|
// if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user