|
@@ -53,8 +53,7 @@ if ($user->socid > 0) {
|
|
|
|
|
|
$nowyear = strftime("%Y", dol_now());
|
|
|
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
|
|
-//$startyear=$year-2;
|
|
|
-$startyear = $year - 1;
|
|
|
+$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
|
|
$endyear = $year;
|
|
|
|
|
|
// Load translation files required by the page
|
|
@@ -254,56 +253,56 @@ print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
|
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
|
|
|
|
|
|
|
|
-//if (empty($socid))
|
|
|
-//{
|
|
|
- // Show filter box
|
|
|
- print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
- print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
- print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
|
-
|
|
|
- print '<table class="noborder centpercent">';
|
|
|
- print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
|
|
- // Company
|
|
|
- print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
|
|
|
- $filter = 's.client IN (1,2,3)';
|
|
|
- print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, '', 'style="width: 95%"');
|
|
|
- print '</td></tr>';
|
|
|
- // ThirdParty Type
|
|
|
- print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
|
|
|
- $sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
|
|
|
- print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
|
|
|
+// Show filter box
|
|
|
+print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
+print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
+print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
|
+
|
|
|
+print '<table class="noborder centpercent">';
|
|
|
+print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
|
|
+// Company
|
|
|
+print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
|
|
|
+$filter = 's.client IN (1,2,3)';
|
|
|
+print img_picto('', 'company', 'class="pictofixedwidth"');
|
|
|
+print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
|
|
|
+print '</td></tr>';
|
|
|
+// ThirdParty Type
|
|
|
+print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
|
|
|
+$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
|
|
|
+print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
|
|
|
if ($user->admin) {
|
|
|
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
|
|
}
|
|
|
- print '</td></tr>';
|
|
|
- // Category
|
|
|
- print '<tr><td>'.$cat_label.'</td><td>';
|
|
|
- print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
|
|
|
- print '</td></tr>';
|
|
|
- // User
|
|
|
- print '<tr><td class="left">'.$langs->trans("CreatedBy").'</td><td class="left">';
|
|
|
- print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
|
|
- print '</td></tr>';
|
|
|
- // Status
|
|
|
- print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
|
|
|
- $formpropal->selectProposalStatus(($object_status != '' ? $object_status : -1), 0, 0, 1, $mode, 'object_status');
|
|
|
- print '</td></tr>';
|
|
|
- // Year
|
|
|
- print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
|
|
|
+print '</td></tr>';
|
|
|
+// Category
|
|
|
+print '<tr><td>'.$cat_label.'</td><td>';
|
|
|
+print img_picto('', 'category', 'class="pictofixedwidth"');
|
|
|
+print $formother->select_categories($cat_type, $categ_id, 'categ_id', 0, 1, 'widthcentpercentminusx maxwidth300');
|
|
|
+print '</td></tr>';
|
|
|
+// User
|
|
|
+print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
|
|
|
+print img_picto('', 'user', 'class="pictofixedwidth"');
|
|
|
+print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
|
|
|
+print '</td></tr>';
|
|
|
+// Status
|
|
|
+print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
|
|
+$formpropal->selectProposalStatus(($object_status != '' ? $object_status : -1), 0, 0, 1, $mode, 'object_status');
|
|
|
+print '</td></tr>';
|
|
|
+// Year
|
|
|
+print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
|
|
if (!in_array($year, $arrayyears)) {
|
|
|
$arrayyears[$year] = $year;
|
|
|
}
|
|
|
if (!in_array($nowyear, $arrayyears)) {
|
|
|
$arrayyears[$nowyear] = $nowyear;
|
|
|
}
|
|
|
- arsort($arrayyears);
|
|
|
- print $form->selectarray('year', $arrayyears, $year, 0);
|
|
|
- print '</td></tr>';
|
|
|
- print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
|
|
- print '</table>';
|
|
|
- print '</form>';
|
|
|
- print '<br><br>';
|
|
|
-//}
|
|
|
+arsort($arrayyears);
|
|
|
+print $form->selectarray('year', $arrayyears, $year, 0);
|
|
|
+print '</td></tr>';
|
|
|
+print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
|
|
+print '</table>';
|
|
|
+print '</form>';
|
|
|
+print '<br><br>';
|
|
|
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
print '<table class="noborder centpercent">';
|
|
@@ -336,11 +335,11 @@ foreach ($data as $val) {
|
|
|
print '<tr class="oddeven" height="24">';
|
|
|
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
|
|
|
print '<td class="right">'.$val['nb'].'</td>';
|
|
|
- print '<td class="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['nb_diff']).'</td>';
|
|
|
+ print '<td class="right opacitylow" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['nb_diff']).'%</td>';
|
|
|
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
|
|
|
- print '<td class="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['total_diff']).'</td>';
|
|
|
+ print '<td class="right opacitylow" style="'.(($val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['total_diff']).'%</td>';
|
|
|
print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
|
|
|
- print '<td class="right" style="'.(($val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['avg_diff']).'</td>';
|
|
|
+ print '<td class="right opacitylow" style="'.(($val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['avg_diff']).'%</td>';
|
|
|
print '</tr>';
|
|
|
$oldyear = $year;
|
|
|
}
|