Fix month of the fiscal year start min 1 max 12 / january = 1
This commit is contained in:
parent
552f160235
commit
7eb48a3f9c
@ -74,8 +74,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
//$facturestatic=new Facture($db);
|
//$facturestatic=new Facture($db);
|
||||||
|
|
||||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
|
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0;
|
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||||
|
|
||||||
$text = $langs->trans("BoxCustomersInvoicesPerMonth", $max);
|
$text = $langs->trans("BoxCustomersInvoicesPerMonth", $max);
|
||||||
$this->info_box_head = array(
|
$this->info_box_head = array(
|
||||||
@ -149,7 +149,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,8 +73,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
|
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0;
|
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||||
|
|
||||||
$text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max);
|
$text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max);
|
||||||
$this->info_box_head = array(
|
$this->info_box_head = array(
|
||||||
@ -146,7 +146,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,8 +74,8 @@ class box_graph_orders_permonth extends ModeleBoxes
|
|||||||
//include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
//$commandestatic=new Commande($db);
|
//$commandestatic=new Commande($db);
|
||||||
|
|
||||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
|
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0;
|
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||||
|
|
||||||
$text = $langs->trans("BoxCustomersOrdersPerMonth", $max);
|
$text = $langs->trans("BoxCustomersOrdersPerMonth", $max);
|
||||||
$this->info_box_head = array(
|
$this->info_box_head = array(
|
||||||
@ -147,7 +147,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,8 +73,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
|||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||||
|
|
||||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
|
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0;
|
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||||
|
|
||||||
$text = $langs->trans("BoxSuppliersOrdersPerMonth", $max);
|
$text = $langs->trans("BoxSuppliersOrdersPerMonth", $max);
|
||||||
$this->info_box_head = array(
|
$this->info_box_head = array(
|
||||||
@ -146,7 +146,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,8 +74,8 @@ class box_graph_propales_permonth extends ModeleBoxes
|
|||||||
//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
//$propalstatic=new Propal($db);
|
//$propalstatic=new Propal($db);
|
||||||
|
|
||||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
|
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 0;
|
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||||
|
|
||||||
$langs->load("propal");
|
$langs->load("propal");
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
|||||||
$i=$startyear;$legend=array();
|
$i=$startyear;$legend=array();
|
||||||
while ($i <= $endyear)
|
while ($i <= $endyear)
|
||||||
{
|
{
|
||||||
if ($startmonth != 0)
|
if ($startmonth != 1)
|
||||||
{
|
{
|
||||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,11 +40,11 @@ abstract class Stats
|
|||||||
* @param int $startyear End year
|
* @param int $startyear End year
|
||||||
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||||
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 0 = january
|
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january
|
||||||
* @return array Array of values
|
* @return array Array of values
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 0)
|
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -88,10 +88,8 @@ abstract class Stats
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$year=$startyear;
|
$year=$startyear;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) {
|
$sm = $startmonth - 1;
|
||||||
$startmonth = 0;
|
if ($sm != 0) $year = $year - 1;
|
||||||
}
|
|
||||||
if ($startmonth != 0) $year = $year - 1;
|
|
||||||
while ($year <= $endyear)
|
while ($year <= $endyear)
|
||||||
{
|
{
|
||||||
$datay[$year] = $this->getNbByMonth($year, $format);
|
$datay[$year] = $this->getNbByMonth($year, $format);
|
||||||
@ -102,11 +100,11 @@ abstract class Stats
|
|||||||
|
|
||||||
for ($i = 0 ; $i < 12 ; $i++)
|
for ($i = 0 ; $i < 12 ; $i++)
|
||||||
{
|
{
|
||||||
$data[$i][]=$datay[$endyear][($i+$startmonth)%12][0];
|
$data[$i][]=$datay[$endyear][($i+$sm)%12][0];
|
||||||
$year=$startyear;
|
$year=$startyear;
|
||||||
while($year <= $endyear)
|
while($year <= $endyear)
|
||||||
{
|
{
|
||||||
$data[$i][]=$datay[$year - (1 - ((int) ($i+$startmonth)/12) + ($startmonth == 0 ? 1 : 0))][($i+$startmonth)%12][1];
|
$data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1];
|
||||||
$year++;
|
$year++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,10 +138,10 @@ abstract class Stats
|
|||||||
* @param int $startyear End year
|
* @param int $startyear End year
|
||||||
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||||
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 0 = january
|
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january
|
||||||
* @return array Array of values
|
* @return array Array of values
|
||||||
*/
|
*/
|
||||||
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 0)
|
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -188,10 +186,8 @@ abstract class Stats
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$year=$startyear;
|
$year=$startyear;
|
||||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) {
|
$sm = $startmonth - 1;
|
||||||
$startmonth = 0;
|
if ($sm != 0) $year = $year - 1;
|
||||||
}
|
|
||||||
if ($startmonth != 0) $year = $year - 1;
|
|
||||||
while($year <= $endyear)
|
while($year <= $endyear)
|
||||||
{
|
{
|
||||||
$datay[$year] = $this->getAmountByMonth($year, $format);
|
$datay[$year] = $this->getAmountByMonth($year, $format);
|
||||||
@ -202,11 +198,11 @@ abstract class Stats
|
|||||||
// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
|
// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
|
||||||
for ($i = 0 ; $i < 12 ; $i++)
|
for ($i = 0 ; $i < 12 ; $i++)
|
||||||
{
|
{
|
||||||
$data[$i][]=$datay[$endyear][($i+$startmonth)%12][0]; // set label
|
$data[$i][]=$datay[$endyear][($i+$sm)%12][0]; // set label
|
||||||
$year=$startyear;
|
$year=$startyear;
|
||||||
while($year <= $endyear)
|
while($year <= $endyear)
|
||||||
{
|
{
|
||||||
$data[$i][]=$datay[$year - (1 - ((int) ($i+$startmonth)/12) + ($startmonth == 0 ? 1 : 0))][($i+$startmonth)%12][1]; // set yval for x=i
|
$data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1]; // set yval for x=i
|
||||||
$year++;
|
$year++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,7 +418,8 @@ abstract class Stats
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Renvoie le nombre de proposition par mois pour une annee donnee
|
* Renvoie le nombre de documents par mois pour une annee donnee
|
||||||
|
* Return number of documents per month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
* @param string $sql SQL
|
* @param string $sql SQL
|
||||||
@ -481,7 +478,8 @@ abstract class Stats
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Renvoie le nombre d'element par mois pour une annee donnee
|
* Renvoie le montant totalise par mois pour une annee donnee
|
||||||
|
* Return the amount per month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
* @param string $sql SQL
|
* @param string $sql SQL
|
||||||
@ -538,6 +536,7 @@ abstract class Stats
|
|||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Renvoie le montant moyen par mois pour une annee donnee
|
* Renvoie le montant moyen par mois pour une annee donnee
|
||||||
|
* Return the amount average par month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
* @param string $sql SQL
|
* @param string $sql SQL
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user