';
print '
'."\n";
@@ -301,15 +303,15 @@
$sortorder
);
if ($modecompta == 'CREANCES-DETTES') {
- print_liste_field_titre(
- $langs->trans('AmountHT'),
- $_SERVER["PHP_SELF"],
- "amount_ht",
- "",
- $paramslink,
- 'class="right"',
- $sortfield,
- $sortorder
+ print_liste_field_titre(
+ $langs->trans('AmountHT'),
+ $_SERVER["PHP_SELF"],
+ "amount_ht",
+ "",
+ $paramslink,
+ 'class="right"',
+ $sortfield,
+ $sortorder
);
} else {
print_liste_field_titre('');
@@ -344,129 +346,132 @@
print "\n";
if (count($amount)) {
- $arrayforsort = $name;
-
- // We define arrayforsort
- if ($sortfield == 'name' && $sortorder == 'asc') {
- asort($name);
- $arrayforsort = $name;
- }
- if ($sortfield == 'name' && $sortorder == 'desc') {
- arsort($name);
- $arrayforsort = $name;
- }
- if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
- asort($amount_ht);
- $arrayforsort = $amount_ht;
- }
- if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
- arsort($amount_ht);
- $arrayforsort = $amount_ht;
- }
- if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
- asort($amount);
- $arrayforsort = $amount;
- }
- if ($sortfield == 'amount_ttc' && $sortorder == 'desc') {
- arsort($amount);
- $arrayforsort = $amount;
- }
-
- $i = 0;
-
- foreach ($arrayforsort as $key => $value) {
- print '';
-
- // Third party
- $fullname = $name[$key];
- if ($key >= 0) {
- $linkname = ''.img_object($langs->trans("ShowUser"), 'user').' '.$fullname.' ';
- } else {
- $linkname = $langs->trans("PaymentsNotLinkedToUser");
- }
- print "".$linkname." \n";
-
- // Amount w/o VAT
- print '';
- if ($modecompta == 'RECETTES-DEPENSES') {
- if ($key > 0) {
- //print '';
- } else {
- //print ' ';
- }
- } elseif ($modecompta == 'CREANCES-DETTES') {
- if ($key > 0) {
- print ' ';
- } else {
- //print ' ';
- }
- print price($amount_ht[$key]);
- if ($key > 0) print ' ';
- }
- print ' ';
-
- // Amount with VAT
- print '';
- if ($modecompta == 'RECETTES-DEPENSES') {
- if ($key > 0) {
- //print '';
- } else {
- //print ' ';
- }
- } elseif ($modecompta == 'CREANCES-DETTES') {
- if ($key > 0) {
- print ' ';
- } else {
- //print ' ';
- }
- }
- print price($amount[$key]);
- if ($modecompta == 'RECETTES-DEPENSES') {
- if ($key > 0) {
- //print ' ';
- } else {
- //print '';
- }
- } elseif ($modecompta == 'CREANCES-DETTES') {
- if ($key > 0) {
- print '';
- }
- }
- print ' ';
-
- // Percent
- print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').' ';
-
- // Other stats
- print '';
- if (!empty($conf->propal->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("ProposalStats"), "stats").' ';
- }
- if (!empty($conf->commande->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
- }
- if (!empty($conf->facture->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
- }
- print ' ';
- print " \n";
- $i++;
- }
-
- // Total
- print '';
- print ''.$langs->trans("Total").' ';
- if ($modecompta != 'CREANCES-DETTES') {
- print ' ';
- } else {
- print ''.price($catotal_ht).' ';
- }
- print ''.price($catotal).' ';
- print ' ';
- print ' ';
- print ' ';
-
- $db->free($result);
+ $arrayforsort = $name;
+
+ // We define arrayforsort
+ if ($sortfield == 'name' && $sortorder == 'asc') {
+ asort($name);
+ $arrayforsort = $name;
+ }
+ if ($sortfield == 'name' && $sortorder == 'desc') {
+ arsort($name);
+ $arrayforsort = $name;
+ }
+ if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
+ asort($amount_ht);
+ $arrayforsort = $amount_ht;
+ }
+ if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
+ arsort($amount_ht);
+ $arrayforsort = $amount_ht;
+ }
+ if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
+ asort($amount);
+ $arrayforsort = $amount;
+ }
+ if ($sortfield == 'amount_ttc' && $sortorder == 'desc') {
+ arsort($amount);
+ $arrayforsort = $amount;
+ }
+
+ $i = 0;
+
+ foreach ($arrayforsort as $key => $value) {
+ print '';
+
+ // Third party
+ $fullname = $name[$key];
+ if ($key >= 0) {
+ $linkname = ''.img_object($langs->trans("ShowUser"), 'user').' '.$fullname.' ';
+ } else {
+ $linkname = $langs->trans("PaymentsNotLinkedToUser");
+ }
+ print "".$linkname." \n";
+
+ // Amount w/o VAT
+ print '';
+ if ($modecompta == 'RECETTES-DEPENSES') {
+ if ($key > 0) {
+ //print '';
+ } else {
+ //print ' ';
+ }
+ }
+ elseif ($modecompta == 'CREANCES-DETTES') {
+ if ($key > 0) {
+ print ' ';
+ } else {
+ //print ' ';
+ }
+ print price($amount_ht[$key]);
+ if ($key > 0) print ' ';
+ }
+ print ' ';
+
+ // Amount with VAT
+ print '';
+ if ($modecompta == 'RECETTES-DEPENSES') {
+ if ($key > 0) {
+ //print '';
+ } else {
+ //print ' ';
+ }
+ }
+ elseif ($modecompta == 'CREANCES-DETTES') {
+ if ($key > 0) {
+ print ' ';
+ } else {
+ //print ' ';
+ }
+ }
+ print price($amount[$key]);
+ if ($modecompta == 'RECETTES-DEPENSES') {
+ if ($key > 0) {
+ //print ' ';
+ } else {
+ //print '';
+ }
+ }
+ elseif ($modecompta == 'CREANCES-DETTES') {
+ if ($key > 0) {
+ print '';
+ }
+ }
+ print ' ';
+
+ // Percent
+ print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').' ';
+
+ // Other stats
+ print '';
+ if (!empty($conf->propal->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("ProposalStats"), "stats").' ';
+ }
+ if (!empty($conf->commande->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
+ }
+ if (!empty($conf->facture->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
+ }
+ print ' ';
+ print " \n";
+ $i++;
+ }
+
+ // Total
+ print '';
+ print ''.$langs->trans("Total").' ';
+ if ($modecompta != 'CREANCES-DETTES') {
+ print ' ';
+ } else {
+ print ''.price($catotal_ht).' ';
+ }
+ print ''.price($catotal).' ';
+ print ' ';
+ print ' ';
+ print ' ';
+
+ $db->free($result);
}
print "
";
--- /tmp/dsg/dolibarr/htdocs/compta/stats/github_casoc.php
+++ /tmp/dsg/dolibarr/htdocs/compta/stats/client_casoc.php
@@ -53,16 +53,13 @@
$selected_cat = (int) GETPOST('search_categ', 'int');
$subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') {
- $subcat = true;
+ $subcat = true;
}
// Security check
if ($user->socid > 0) $socid = $user->socid;
if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat');
if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
-
-// Hook
-$hookmanager->initHooks(array('casoclist'));
// Date range
$year = GETPOST("year", 'int');
@@ -116,7 +113,9 @@
if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
-} else {
+}
+else
+{
// TODO We define q
}
@@ -155,7 +154,7 @@
$tableparams = array_merge($commonparams, $tableparams);
foreach ($allparams as $key => $value) {
- $paramslink .= '&'.$key.'='.$value;
+ $paramslink .= '&'.$key.'='.$value;
}
@@ -181,10 +180,11 @@
//$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'
',' ').')';
$description = $langs->trans("RulesCADue");
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
- else $description .= $langs->trans("DepositsAreIncluded");
+ else $description .= $langs->trans("DepositsAreIncluded");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties");
$calcmode = $langs->trans("CalcModeEngagement");
@@ -193,9 +193,11 @@
$description .= $langs->trans("DepositsAreIncluded");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "BOOKKEEPING")
-{
-} elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
+}
+elseif ($modecompta == "BOOKKEEPING")
+{
+}
+elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
{
}
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
@@ -206,7 +208,7 @@
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
- print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
+ print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
@@ -220,28 +222,30 @@
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) // Without any category
{
- $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
- } elseif ($selected_cat) // Into a specific category
+ $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
+ }
+ elseif ($selected_cat) // Into a specific category
{
- $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
}
$sql .= " WHERE f.fk_statut in (1,2)";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql .= " AND f.type IN (0,1,2,5)";
+ $sql .= " AND f.type IN (0,1,2,5)";
} else {
- $sql .= " AND f.type IN (0,1,2,3,5)";
+ $sql .= " AND f.type IN (0,1,2,3,5)";
}
$sql .= " AND f.fk_soc = s.rowid";
if ($date_start && $date_end) {
- $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
+ $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
}
if ($selected_cat === -2) // Without any category
{
- $sql .= " AND cs.fk_soc is null";
- } elseif ($selected_cat) { // Into a specific category
- $sql .= " AND (c.rowid = ".$db->escape($selected_cat);
- if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat);
- $sql .= ")";
+ $sql .= " AND cs.fk_soc is null";
+ }
+ elseif ($selected_cat) { // Into a specific category
+ $sql .= " AND (c.rowid = ".$db->escape($selected_cat);
+ if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat);
+ $sql .= ")";
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
}
} else {
@@ -256,24 +260,26 @@
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) // Without any category
{
- $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
- } elseif ($selected_cat) // Into a specific category
+ $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
+ }
+ elseif ($selected_cat) // Into a specific category
{
- $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
}
$sql .= " WHERE p.rowid = pf.fk_paiement";
$sql .= " AND pf.fk_facture = f.rowid";
$sql .= " AND f.fk_soc = s.rowid";
if ($date_start && $date_end) {
- $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
+ $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
}
if ($selected_cat === -2) // Without any category
{
- $sql .= " AND cs.fk_soc is null";
- } elseif ($selected_cat) { // Into a specific category
- $sql .= " AND (c.rowid = ".$selected_cat;
- if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
- $sql .= ")";
+ $sql .= " AND cs.fk_soc is null";
+ }
+ elseif ($selected_cat) { // Into a specific category
+ $sql .= " AND (c.rowid = ".$selected_cat;
+ if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
+ $sql .= ")";
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
}
}
@@ -287,8 +293,6 @@
$sql .= " ORDER BY s.rowid";
//echo $sql;
-$amount = array();
-
dol_syslog("casoc", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
@@ -296,15 +300,15 @@
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
- $amount_ht[$obj->socid] = $obj->amount;
- $amount[$obj->socid] = $obj->amount_ttc;
- $name[$obj->socid] = $obj->name.' '.$obj->firstname;
+ $amount_ht[$obj->socid] = $obj->amount;
+ $amount[$obj->socid] = $obj->amount_ttc;
+ $name[$obj->socid] = $obj->name.' '.$obj->firstname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
- $catotal_ht += $obj->amount;
- $catotal += $obj->amount_ttc;
- $i++;
+ $catotal_ht += $obj->amount;
+ $catotal += $obj->amount_ttc;
+ $i++;
}
} else {
dol_print_error($db);
@@ -352,7 +356,7 @@
// Extra parameters management
foreach ($headerparams as $key => $value)
{
- print '
';
+ print '
';
}
$moreforfilter = '';
@@ -368,7 +372,7 @@
print $langs->trans("SubCats").'? ';
print '
';
print '
';
@@ -435,18 +439,18 @@
$sortfield, $sortorder
);
if ($modecompta == 'CREANCES-DETTES') {
- print_liste_field_titre(
- $langs->trans('AmountHT'),
- $_SERVER["PHP_SELF"],
- "amount_ht",
- "",
- $paramslink,
- 'class="right"',
- $sortfield,
- $sortorder
- );
+ print_liste_field_titre(
+ $langs->trans('AmountHT'),
+ $_SERVER["PHP_SELF"],
+ "amount_ht",
+ "",
+ $paramslink,
+ 'class="right"',
+ $sortfield,
+ $sortorder
+ );
} else {
- print_liste_field_titre('');
+ print_liste_field_titre('');
}
print_liste_field_titre(
$langs->trans("AmountTTC"),
@@ -491,12 +495,12 @@
$arrayforsort = $name;
}
if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
- asort($amount_ht);
- $arrayforsort = $amount_ht;
+ asort($amount_ht);
+ $arrayforsort = $amount_ht;
}
if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
- arsort($amount_ht);
- $arrayforsort = $amount_ht;
+ arsort($amount_ht);
+ $arrayforsort = $amount_ht;
}
if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
asort($amount);
@@ -537,10 +541,10 @@
// Third party
$fullname = $name[$key];
if ($key > 0) {
- $thirdparty_static->id = $key;
- $thirdparty_static->name = $fullname;
- $thirdparty_static->client = 1;
- $linkname = $thirdparty_static->getNomUrl(1, 'customer');
+ $thirdparty_static->id = $key;
+ $thirdparty_static->name = $fullname;
+ $thirdparty_static->client = 1;
+ $linkname = $thirdparty_static->getNomUrl(1, 'customer');
} else {
$linkname = $langs->trans("PaymentsNotLinkedToInvoice");
}
@@ -561,35 +565,35 @@
// Amount w/o VAT
print ' ';
if ($modecompta != 'CREANCES-DETTES') {
- if ($key > 0) {
- print '';
- } else {
- print ' ';
- }
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
} else {
- if ($key > 0) {
- print ' ';
- } else {
- print ' ';
- }
- print price($amount_ht[$key]);
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
+ print price($amount_ht[$key]);
}
print ' ';
// Amount with VAT
print '
';
if ($modecompta != 'CREANCES-DETTES') {
- if ($key > 0) {
- print '';
- } else {
- print ' ';
- }
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
} else {
- if ($key > 0) {
- print ' ';
- } else {
- print ' ';
- }
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
}
print price($amount[$key]);
print ' ';
@@ -598,21 +602,21 @@
// Percent;
print ' '.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').' ';
- // Other stats
- print '
';
- if (!empty($conf->propal->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("ProposalStats"), "stats").' ';
- }
- if (!empty($conf->commande->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
- }
- if (!empty($conf->facture->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
- }
- print ' ';
- print "\n";
- $i++;
- }
+ // Other stats
+ print '
';
+ if (!empty($conf->propal->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("ProposalStats"), "stats").' ';
+ }
+ if (!empty($conf->commande->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
+ }
+ if (!empty($conf->facture->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
+ }
+ print ' ';
+ print "\n";
+ $i++;
+ }
// Total
print '
';
@@ -621,9 +625,9 @@
print ' ';
print ' ';
if ($modecompta != 'CREANCES-DETTES') {
- print ' ';
+ print ' ';
} else {
- print ''.price($catotal_ht).' ';
+ print ''.price($catotal_ht).' ';
}
print ''.price($catotal).' ';
print ' ';
--- /tmp/dsg/dolibarr/htdocs/compta/stats/github_index.php
+++ /tmp/dsg/dolibarr/htdocs/compta/stats/client_index.php
@@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
* Copyright (C) 2017 Olivier Geffroy
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,12 +44,12 @@
$year = GETPOST('year', 'int');
if (empty($year))
{
- $year_current = dol_print_date(dol_now(), "%Y");
- $month_current = dol_print_date(dol_now(), "%m");
+ $year_current = strftime("%Y", dol_now());
+ $month_current = strftime("%m", dol_now());
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
- $month_current = dol_print_date(dol_now(), "%m");
+ $month_current = strftime("%m", dol_now());
$year_start = $year - ($nbofyear - 1);
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@@ -58,12 +58,12 @@
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
- $q = GETPOST("q") ? GETPOST("q") : 0;
+ $q = GETPOST("q") ?GETPOST("q") : 0;
if ($q == 0)
{
// We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1);
- $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
+ $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (!GETPOST('month'))
{
if (!GETPOST("year") && $month_start > $month_current)
@@ -73,7 +73,8 @@
}
$month_end = $month_start - 1;
if ($month_end < 1) $month_end = 12;
- } else $month_end = $month_start;
+ }
+ else $month_end = $month_start;
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
@@ -86,10 +87,8 @@
$socid = GETPOST('socid', 'int');
$tmps = dol_getdate($date_start);
-$mothn_start = $tmps['mon'];
$year_start = $tmps['year'];
$tmpe = dol_getdate($date_end);
-$month_end = $tmpe['mon'];
$year_end = $tmpe['year'];
$nbofyear = ($year_end - $year_start) + 1;
@@ -110,10 +109,6 @@
* View
*/
-$param = '';
-if ($date_startday && $date_startmonth && $date_startyear) $param .= '&date_startday='.$date_startday.'&date_startmonth='.$date_startmonth.'&date_startyear='.$date_startyear;
-if ($date_endday && $date_endmonth && $date_endyear) $param .= '&date_endday='.$date_endday.'&date_endmonth='.$date_endmonth.'&date_endyear='.$date_endyear;
-
llxHeader();
$form = new Form($db);
@@ -124,17 +119,16 @@
$name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeDebt");
//$calcmode.=' ('.$langs->trans("SeeReportInInputOutputMode",'',' ').')';
- $calcmode .= ' ('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
- $calcmode = str_replace('{link1}', '', $calcmode);
- $calcmode = str_replace('{link2}', ' ', $calcmode);
+ $calcmode .= ' ('.$langs->trans("SeeReportInBookkeepingMode", '', ' ').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "".img_previous()." ".img_next()." " : "");
$description = $langs->trans("RulesCADue");
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
- else $description .= $langs->trans("DepositsAreIncluded");
+ else $description .= $langs->trans("DepositsAreIncluded");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
$name = $langs->trans("TurnoverCollected");
$calcmode = $langs->trans("CalcModeEngagement");
@@ -146,13 +140,12 @@
$description .= $langs->trans("DepositsAreIncluded");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "BOOKKEEPING")
+}
+elseif ($modecompta == "BOOKKEEPING")
{
$name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeBookkeeping");
- $calcmode .= ' ('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
- $calcmode = str_replace('{link1}', '', $calcmode);
- $calcmode = str_replace('{link2}', ' ', $calcmode);
+ $calcmode .= ' ('.$langs->trans("SeeReportInDueDebtMode", '', ' ').')';
//$calcmode.=' ('.$langs->trans("SeeReportInInputOutputMode",'',' ').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "".img_previous()." ".img_next()." " : "");
@@ -167,7 +160,7 @@
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
- print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
+ print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
@@ -180,7 +173,8 @@
else $sql .= " AND f.type IN (0,1,2,3,5)";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
/*
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
@@ -194,7 +188,8 @@
$sql .= " AND pf.fk_facture = f.rowid";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
-} elseif ($modecompta == "BOOKKEEPING")
+}
+elseif ($modecompta == "BOOKKEEPING")
{
$sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.credit) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj";
@@ -228,7 +223,8 @@
$i++;
}
$db->free($result);
-} else {
+}
+else {
dol_print_error($db);
}
@@ -263,7 +259,9 @@
}
$i++;
}
- } else {
+ }
+ else
+ {
dol_print_error($db);
}
}
@@ -281,9 +279,9 @@
else print '';
if ($modecompta != 'BOOKKEEPING') print '';
print $annee;
- if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee + 1);
- if ($modecompta != 'BOOKKEEPING') print ' ';
- print ' ';
+ if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee + 1);
+ if ($modecompta != 'BOOKKEEPING') print '';
+ print '';
if ($annee != $year_end) print ' ';
}
print ' ';
@@ -308,18 +306,13 @@
$casenow = dol_print_date($now, "%Y-%m");
// Loop on each month
-$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1));
+$nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START - 1) : 0;
for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
{
$mois_modulo = $mois; // ajout
if ($mois > 12) {$mois_modulo = $mois - 12; } // ajout
if ($year_start == $year_end) {
- // If we show only one year or one month, we do not show month before the selected month
- if ($mois < $date_startmonth && $year_start <= $date_startyear) {
- continue;
- }
- // If we show only one year or one month, we do not show month after the selected month
if ($mois > $date_endmonth && $year_end >= $date_endyear) {
break;
}
@@ -340,75 +333,77 @@
if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
{
if ($modecompta == 'CREANCES-DETTES') {
- // Value turnover of month w/o VAT
+ // Valeur CA du mois w/o VAT
print '
';
- if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
- if ($cum_ht[$case]) {
- $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
- print ''.price($cum_ht[$case], 1).' ';
- } else {
- if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
- }
+ if ($cum_ht[$case])
+ {
+ $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
+ print ''.price($cum_ht[$case], 1).' ';
+ }
+ else
+ {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
+ else { print ' '; }
}
print " ";
}
- // Value turnover of month
+ // Valeur CA du mois
print '
';
- if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
- if ($cum[$case]) {
- $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
- if ($modecompta != 'BOOKKEEPING') print '';
- print price($cum[$case], 1);
- if ($modecompta != 'BOOKKEEPING') print ' ';
- } else {
- if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ if ($cum[$case])
+ {
+ $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
+ if ($modecompta != 'BOOKKEEPING') print '';
+ print price($cum[$case], 1);
+ if ($modecompta != 'BOOKKEEPING') print ' ';
+ }
+ else
+ {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
+ else { print ' '; }
+ }
+ print " ";
+
+ // Pourcentage du mois
+ if ($annee_decalage > $minyear && $case <= $casenow)
+ {
+ if ($cum[$caseprev] && $cum[$case])
+ {
+ $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
+ //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
+ print '
'.($percent >= 0 ? "+$percent" : "$percent").'% ';
+ }
+ if ($cum[$caseprev] && !$cum[$case])
+ {
+ print '
-100% ';
+ }
+ if (!$cum[$caseprev] && $cum[$case])
+ {
+ //print '
+Inf% ';
+ print '
- ';
+ }
+ if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case])
+ {
+ print '
+0% ';
+ }
+ if (!isset($cum[$caseprev]) && !$cum[$case])
+ {
+ print '
- ';
}
}
- print "";
-
- // Percentage of month
- print '
';
- //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
- if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
- if ($annee_decalage > $minyear && $case <= $casenow)
- {
- if ($cum[$caseprev] && $cum[$case])
- {
- $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
- //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
- print ($percent >= 0 ? "+$percent" : "$percent").'%';
- }
- if ($cum[$caseprev] && !$cum[$case])
- {
- print '-100%';
- }
- if (!$cum[$caseprev] && $cum[$case])
- {
- //print ' +Inf% ';
- print '-';
- }
- if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case])
- {
- print '+0%';
- }
- if (!isset($cum[$caseprev]) && !$cum[$case])
- {
- print '-';
- }
- } else {
- if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; }
- }
+ else
+ {
+ print '
';
+ if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; }
+ else { print ' '; }
+ print ' ';
}
- print '';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print '
';
}
- if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
- $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
- $total[$annee] += $cum[$case];
- }
+ $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
+ $total[$annee] += $cum[$case];
}
print '';
@@ -479,37 +474,38 @@
}
*/
-// Show total
+// Affiche total
print '
'.$langs->trans("Total").' ';
for ($annee = $year_start; $annee <= $year_end; $annee++)
{
if ($modecompta == 'CREANCES-DETTES') {
// Montant total HT
- if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
- print '';
- print ($total_ht[$annee] ?price($total_ht[$annee]) : "0");
- print " ";
- } else {
+ if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear)))
+ {
+ print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0")." ";
+ }
+ else
+ {
print ' ';
}
}
- // Total amount
- if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
- print '';
- print ($total[$annee] ?price($total[$annee]) : "0");
- print " ";
- } else {
+ // Montant total
+ if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear)))
+ {
+ print ''.($total[$annee] ?price($total[$annee]) : "0")." ";
+ }
+ else
+ {
print ' ';
}
// Pourcentage total
- if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
+ if ($annee > $minyear && $annee <= max($nowyear, $maxyear))
+ {
if ($total[$annee - 1] && $total[$annee]) {
$percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
- print '';
- print ($percent >= 0 ? "+$percent" : "$percent").'%';
- print ' ';
+ print ''.($percent >= 0 ? "+$percent" : "$percent").'% ';
}
if ($total[$annee - 1] && !$total[$annee])
{
@@ -523,9 +519,12 @@
{
print '+0% ';
}
- } else {
+ }
+ else
+ {
print '';
- if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; }
+ if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; }
+ else { print ' '; }
print ' ';
}
--- /tmp/dsg/dolibarr/htdocs/compta/stats/github_supplier_turnover.php
+++ /tmp/dsg/dolibarr/htdocs/compta/stats/client_supplier_turnover.php
@@ -59,7 +59,7 @@
{
// We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1);
- $month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
+ $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (!GETPOST('month'))
{
if (!GETPOST("year") && $month_start > $month_current)
@@ -69,7 +69,8 @@
}
$month_end = $month_start - 1;
if ($month_end < 1) $month_end = 12;
- } else $month_end = $month_start;
+ }
+ else $month_end = $month_start;
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
@@ -113,30 +114,32 @@
{
$name = $langs->trans("PurchaseTurnover");
$calcmode = $langs->trans("CalcModeDebt");
- $calcmode .= ' ('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
- $calcmode = str_replace('{link1}', '', $calcmode);
- $calcmode = str_replace('{link2}', ' ', $calcmode);
+ //$calcmode.=' ('.$langs->trans("SeeReportInInputOutputMode",'',' ').')';
+ $calcmode .= ' ('.$langs->trans("SeeReportInBookkeepingMode", '', ' ').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "".img_previous()." ".img_next()." " : "");
$description = $langs->trans("RulesPurchaseTurnoverDue");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
$name = $langs->trans("PurchaseTurnoverCollected");
$calcmode = $langs->trans("CalcModeEngagement");
+ //$calcmode.=' ('.$langs->trans("SeeReportInDueDebtMode",'',' ').')';
+ //$calcmode.=' ('.$langs->trans("SeeReportInBookkeepingMode",'',' ').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "".img_previous()." ".img_next()." " : "");
$description = $langs->trans("RulesPurchaseTurnoverIn");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "BOOKKEEPING")
+}
+elseif ($modecompta == "BOOKKEEPING")
{
$name = $langs->trans("PurchaseTurnover");
$calcmode = $langs->trans("CalcModeBookkeeping");
- $calcmode .= ' ('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
- $calcmode = str_replace('{link1}', '', $calcmode);
- $calcmode = str_replace('{link2}', ' ', $calcmode);
+ $calcmode .= ' ('.$langs->trans("SeeReportInDueDebtMode", '', ' ').')';
+ //$calcmode.=' ('.$langs->trans("SeeReportInInputOutputMode",'',' ').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "".img_previous()." ".img_next()." " : "");
$description = $langs->trans("RulesPurchaseTurnoverTotalPurchaseJournal");
@@ -150,7 +153,7 @@
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
- print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
+ print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
@@ -162,7 +165,8 @@
$sql .= " AND f.type IN (0,2)";
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
$sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
@@ -172,7 +176,8 @@
$sql .= " AND pf.fk_facturefourn = f.rowid";
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
-} elseif ($modecompta == "BOOKKEEPING")
+}
+elseif ($modecompta == "BOOKKEEPING")
{
$sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj";
@@ -206,7 +211,8 @@
$i++;
}
$db->free($result);
-} else {
+}
+else {
dol_print_error($db);
}
@@ -223,9 +229,9 @@
else print '';
if ($modecompta != 'BOOKKEEPING') print '';
print $annee;
- if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee + 1);
- if ($modecompta != 'BOOKKEEPING') print ' ';
- print ' ';
+ if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee + 1);
+ if ($modecompta != 'BOOKKEEPING') print '';
+ print '';
if ($annee != $year_end) print ' ';
}
print '';
@@ -283,8 +289,11 @@
{
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
print '
'.price($cum_ht[$case], 1).' ';
- } else {
- if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ }
+ else
+ {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
+ else { print ' '; }
}
print "";
}
@@ -297,8 +306,11 @@
if ($modecompta != 'BOOKKEEPING') print '
';
print price($cum[$case], 1);
if ($modecompta != 'BOOKKEEPING') print ' ';
- } else {
- if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; }
+ }
+ else
+ {
+ if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
+ else { print ' '; }
}
print "";
@@ -328,9 +340,12 @@
{
print '
- ';
}
- } else {
+ }
+ else
+ {
print '
';
- if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; }
+ if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; }
+ else { print ' '; }
print ' ';
}
@@ -353,7 +368,9 @@
if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear)))
{
print '
'.($total_ht[$annee] ?price($total_ht[$annee]) : "0")." ";
- } else {
+ }
+ else
+ {
print '
';
}
}
@@ -362,7 +379,9 @@
if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear)))
{
print '
'.($total[$annee] ?price($total[$annee]) : "0")." ";
- } else {
+ }
+ else
+ {
print '
';
}
@@ -385,9 +404,12 @@
{
print '
+0% ';
}
- } else {
+ }
+ else
+ {
print '
';
- if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; }
+ if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; }
+ else { print ' '; }
print ' ';
}
--- /tmp/dsg/dolibarr/htdocs/compta/stats/github_supplier_turnover_by_prodserv.php
+++ /tmp/dsg/dolibarr/htdocs/compta/stats/client_supplier_turnover_by_prodserv.php
@@ -57,9 +57,6 @@
$selected_type = GETPOST('search_type', 'int');
if ($selected_type == '') $selected_type = -1;
-// Hook
-$hookmanager->initHooks(array('supplierturnoverbyprodservlist'));
-
// Date range
$year = GETPOST("year");
$month = GETPOST("month");
@@ -103,7 +100,9 @@
else $year_end++;
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
- } else {
+ }
+ else
+ {
if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
@@ -173,7 +172,8 @@
$description = $langs->trans("RulesPurchaseTurnoverDue");
$builddate = dol_now();
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
$name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByProductsAndServices");
$calcmode = $langs->trans("CalcModeEngagement");
@@ -181,9 +181,11 @@
$description = $langs->trans("RulesPurchaseTurnoverIn");
$builddate = dol_now();
-} elseif ($modecompta == "BOOKKEEPING")
-{
-} elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
+}
+elseif ($modecompta == "BOOKKEEPING")
+{
+}
+elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
{
}
@@ -213,13 +215,14 @@
$sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
$sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
- if ($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
- $sql .= ",".MAIN_DB_PREFIX."facture_fourn_det as l";
+ if ($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
+ $sql .= ",".MAIN_DB_PREFIX."facture_fourn_det as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
if ($selected_cat === -2) // Without any category
{
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
- } elseif ($selected_cat) // Into a specific category
+ }
+ elseif ($selected_cat) // Into a specific category
{
$sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
}
@@ -237,13 +240,14 @@
if ($selected_cat === -2) // Without any category
{
$sql .= " AND cp.fk_product is null";
- } elseif ($selected_cat) { // Into a specific category
+ }
+ elseif ($selected_cat) { // Into a specific category
$sql .= " AND (c.rowid = ".$selected_cat;
if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
$sql .= ")";
$sql .= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
}
- if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
+ if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type";
$sql .= $db->order($sortfield, $sortorder);
@@ -279,10 +283,10 @@
print '
';
}
- $moreforfilter = '';
-
- print '
';
- print '
'."\n";
+ $moreforfilter = '';
+
+ print '';
+ print '
'."\n";
// Category filter
print '';
@@ -295,17 +299,17 @@
print ' checked';
}
print '>';
- // type filter (produit/service)
- print ' ';
- print $langs->trans("Type").': ';
- $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', 1, 1, 1);
-
- //select thirdparty
- print '';
- print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1);
- print '';
-
- print '';
+ // type filter (produit/service)
+ print ' ';
+ print $langs->trans("Type").': ';
+ $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', 1, 1, 1);
+
+ //select thirdparty
+ print '';
+ print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1);
+ print ' ';
+
+ print '';
print ' ';
print ' ';
--- /tmp/dsg/dolibarr/htdocs/compta/stats/github_supplier_turnover_by_thirdparty.php
+++ /tmp/dsg/dolibarr/htdocs/compta/stats/client_supplier_turnover_by_thirdparty.php
@@ -47,11 +47,8 @@
$selected_cat = (int) GETPOST('search_categ', 'int');
$subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') {
- $subcat = true;
-}
-
-// Hook
-$hookmanager->initHooks(array('supplierturnoverbythirdpartylist'));
+ $subcat = true;
+}
// Security check
if ($user->socid > 0) $socid = $user->socid;
@@ -110,7 +107,9 @@
if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
-} else {
+}
+else
+{
// TODO We define q
}
@@ -149,7 +148,7 @@
$tableparams = array_merge($commonparams, $tableparams);
foreach ($allparams as $key => $value) {
- $paramslink .= '&'.$key.'='.$value;
+ $paramslink .= '&'.$key.'='.$value;
}
@@ -176,7 +175,8 @@
$description = $langs->trans("RulesPurchaseTurnoverDue");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "RECETTES-DEPENSES")
+}
+elseif ($modecompta == "RECETTES-DEPENSES")
{
$name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties");
$calcmode = $langs->trans("CalcModeEngagement");
@@ -184,9 +184,11 @@
$description = $langs->trans("RulesPurchaseTurnoverIn");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
-} elseif ($modecompta == "BOOKKEEPING")
-{
-} elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
+}
+elseif ($modecompta == "BOOKKEEPING")
+{
+}
+elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
{
}
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
@@ -197,7 +199,7 @@
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
- print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
+ print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
// Show Array
@@ -212,24 +214,26 @@
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) // Without any category
{
- $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
- } elseif ($selected_cat) // Into a specific category
- {
- $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
+ $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
+ }
+ elseif ($selected_cat) // Into a specific category
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
}
$sql .= " WHERE f.fk_statut in (1,2)";
$sql .= " AND f.type IN (0,2)";
$sql .= " AND f.fk_soc = s.rowid";
if ($date_start && $date_end) {
- $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
+ $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
}
if ($selected_cat === -2) // Without any category
{
- $sql .= " AND cs.fk_soc is null";
- } elseif ($selected_cat) { // Into a specific category
- $sql .= " AND (c.rowid = ".$db->escape($selected_cat);
- if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat);
- $sql .= ")";
+ $sql .= " AND cs.fk_soc is null";
+ }
+ elseif ($selected_cat) { // Into a specific category
+ $sql .= " AND (c.rowid = ".$db->escape($selected_cat);
+ if ($subcat) $sql .= " OR c.fk_parent = ".$db->escape($selected_cat);
+ $sql .= ")";
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
}
} else {
@@ -240,24 +244,26 @@
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) // Without any category
{
- $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
- } elseif ($selected_cat) // Into a specific category
- {
- $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
+ $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
+ }
+ elseif ($selected_cat) // Into a specific category
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs";
}
$sql .= " WHERE p.rowid = pf.fk_paiementfourn";
$sql .= " AND pf.fk_facturefourn = f.rowid";
$sql .= " AND f.fk_soc = s.rowid";
if ($date_start && $date_end) {
- $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
+ $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
}
if ($selected_cat === -2) // Without any category
{
- $sql .= " AND cs.fk_soc is null";
- } elseif ($selected_cat) { // Into a specific category
- $sql .= " AND (c.rowid = ".$selected_cat;
- if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
- $sql .= ")";
+ $sql .= " AND cs.fk_soc is null";
+ }
+ elseif ($selected_cat) { // Into a specific category
+ $sql .= " AND (c.rowid = ".$selected_cat;
+ if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat;
+ $sql .= ")";
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
}
}
@@ -278,15 +284,15 @@
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
- $amount_ht[$obj->socid] = $obj->amount;
- $amount[$obj->socid] = $obj->amount_ttc;
- $name[$obj->socid] = $obj->name.' '.$obj->firstname;
+ $amount_ht[$obj->socid] = $obj->amount;
+ $amount[$obj->socid] = $obj->amount_ttc;
+ $name[$obj->socid] = $obj->name.' '.$obj->firstname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
- $catotal_ht += $obj->amount;
- $catotal += $obj->amount_ttc;
- $i++;
+ $catotal_ht += $obj->amount;
+ $catotal += $obj->amount_ttc;
+ $i++;
}
} else {
dol_print_error($db);
@@ -299,7 +305,7 @@
// Extra parameters management
foreach ($headerparams as $key => $value)
{
- print ' ';
+ print ' ';
}
$moreforfilter = '';
@@ -315,7 +321,7 @@
print $langs->trans("SubCats").'? ';
print ' ';
print '';
@@ -382,18 +388,18 @@
$sortfield, $sortorder
);
if ($modecompta == 'CREANCES-DETTES') {
- print_liste_field_titre(
- $langs->trans('AmountHT'),
- $_SERVER["PHP_SELF"],
- "amount_ht",
- "",
- $paramslink,
- 'class="right"',
- $sortfield,
- $sortorder
- );
+ print_liste_field_titre(
+ $langs->trans('AmountHT'),
+ $_SERVER["PHP_SELF"],
+ "amount_ht",
+ "",
+ $paramslink,
+ 'class="right"',
+ $sortfield,
+ $sortorder
+ );
} else {
- print_liste_field_titre('');
+ print_liste_field_titre('');
}
print_liste_field_titre(
$langs->trans("AmountTTC"),
@@ -438,12 +444,12 @@
$arrayforsort = $name;
}
if ($sortfield == 'amount_ht' && $sortorder == 'asc') {
- asort($amount_ht);
- $arrayforsort = $amount_ht;
+ asort($amount_ht);
+ $arrayforsort = $amount_ht;
}
if ($sortfield == 'amount_ht' && $sortorder == 'desc') {
- arsort($amount_ht);
- $arrayforsort = $amount_ht;
+ arsort($amount_ht);
+ $arrayforsort = $amount_ht;
}
if ($sortfield == 'amount_ttc' && $sortorder == 'asc') {
asort($amount);
@@ -484,10 +490,10 @@
// Third party
$fullname = $name[$key];
if ($key > 0) {
- $thirdparty_static->id = $key;
- $thirdparty_static->name = $fullname;
- $thirdparty_static->client = 1;
- $linkname = $thirdparty_static->getNomUrl(1, 'supplier');
+ $thirdparty_static->id = $key;
+ $thirdparty_static->name = $fullname;
+ $thirdparty_static->client = 1;
+ $linkname = $thirdparty_static->getNomUrl(1, 'supplier');
} else {
$linkname = $langs->trans("PaymentsNotLinkedToInvoice");
}
@@ -508,35 +514,35 @@
// Amount w/o VAT
print ' ';
if ($modecompta != 'CREANCES-DETTES') {
- if ($key > 0) {
- print '';
- } else {
- print ' ';
- }
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
} else {
- if ($key > 0) {
- print ' ';
- } else {
- print ' ';
- }
- print price($amount_ht[$key]);
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
+ print price($amount_ht[$key]);
}
print ' ';
// Amount with VAT
print '';
if ($modecompta != 'CREANCES-DETTES') {
- if ($key > 0) {
- print '';
- } else {
- print ' ';
- }
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
} else {
- if ($key > 0) {
- print ' ';
- } else {
- print ' ';
- }
+ if ($key > 0) {
+ print ' ';
+ } else {
+ print ' ';
+ }
}
print price($amount[$key]);
print ' ';
@@ -545,21 +551,21 @@
// Percent;
print ' '.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').' ';
- // Other stats
- print '';
- if (!empty($conf->supplier_proposal->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("ProposalStats"), "stats").' ';
- }
- if (!empty($conf->fournisseur->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
- }
- if (!empty($conf->fournisseur->enabled) && $key > 0) {
- print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
- }
- print ' ';
- print "\n";
- $i++;
- }
+ // Other stats
+ print '';
+ if (!empty($conf->supplier_proposal->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("ProposalStats"), "stats").' ';
+ }
+ if (!empty($conf->fournisseur->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
+ }
+ if (!empty($conf->fournisseur->enabled) && $key > 0) {
+ print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
+ }
+ print ' ';
+ print "\n";
+ $i++;
+ }
// Total
print '';
@@ -568,9 +574,9 @@
print ' ';
print ' ';
if ($modecompta != 'CREANCES-DETTES') {
- print ' ';
+ print ' ';
} else {
- print ''.price($catotal_ht).' ';
+ print ''.price($catotal_ht).' ';
}
print ''.price($catotal).' ';
print ' ';