diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index f5feef4a0f2..3a1944b3cf4 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -119,6 +119,7 @@ if (isModEnabled('accounting')) { print "
\n"; print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; if ($user->hasRight('accounting', 'chartofaccount')) { + print '
'; print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print '
'; print "
\n"; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 6d4a04102f0..beda62520d9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -70,36 +70,34 @@ if (!$sortorder) { } // Date range -$year = GETPOST('year', 'int'); +$year = GETPOST('year', 'int'); // this is used for navigation previous/next. It is the last year to show in filter if (empty($year)) { $year_current = dol_print_date(dol_now(), "%Y"); $month_current = dol_print_date(dol_now(), "%m"); - $year_start = $year_current; + $year_start = $year_current - ($nbofyear - 1); } else { $year_current = $year; $month_current = dol_print_date(dol_now(), "%m"); - $year_start = $year; + $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); } $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); // 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", 'int') : 0; if ($q == 0) { // We define date_start and date_end - $year_end = $year_start; - $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); + $month_start = GETPOST("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!GETPOST('month')) { - if (!GETPOST("year") && $month_start > $month_current) { + if (!$year && $month_start > $month_current) { $year_start--; $year_end--; } $month_end = $month_start - 1; if ($month_end < 1) { $month_end = 12; - } else { - $year_end++; } } else { $month_end = $month_start; @@ -157,6 +155,7 @@ if (isModEnabled('accounting')) { } $hookmanager->initHooks(['customersupplierreportlist']); + /* * View */ @@ -174,13 +173,6 @@ $total_ttc = 0; // Affiche en-tete de rapport if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); - $calcmode = $langs->trans("CalcModeDebt"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (isModEnabled('accounting')) { - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - } $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("RulesResultDue"); @@ -196,13 +188,6 @@ if ($modecompta == "CREANCES-DETTES") { //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); - $calcmode = $langs->trans("CalcModeEngagement"); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (isModEnabled('accounting')) { - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - } $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("RulesResultInOut"); @@ -210,14 +195,9 @@ if ($modecompta == "CREANCES-DETTES") { //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); - $calcmode = $langs->trans("CalcModeBookkeeping"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); - $period .= '     '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); + $period .= '     '.$langs->trans("DetailBy").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesResultBookkeepingPredefined"); $description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts")).')'; @@ -225,7 +205,23 @@ if ($modecompta == "CREANCES-DETTES") { //$exportlink=$langs->trans("NotYetAvailable"); } -$hselected = 'report'; +// Define $calcmode line +$calcmode = ''; +if (isModEnabled('accounting')) { + $calcmode .= ''; + $calcmode .= '
'; +} +$calcmode .= ''; +$calcmode .= '
'; + report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 0d2958da7df..686f5ff42f7 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -36,11 +36,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'bills', 'donation', 'salaries')); -$date_startmonth = GETPOST('date_startmonth', 'int'); $date_startday = GETPOST('date_startday', 'int'); +$date_startmonth = GETPOST('date_startmonth', 'int'); $date_startyear = GETPOST('date_startyear', 'int'); -$date_endmonth = GETPOST('date_endmonth', 'int'); $date_endday = GETPOST('date_endday', 'int'); +$date_endmonth = GETPOST('date_endmonth', 'int'); $date_endyear = GETPOST('date_endyear', 'int'); $nbofyear = 4; @@ -60,8 +60,8 @@ if (empty($year)) { $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); } -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); +$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); +$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end @@ -151,13 +151,6 @@ $decaiss_ttc = array(); // Affiche en-tete du rapport if ($modecompta == 'CREANCES-DETTES') { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); - $calcmode = $langs->trans("CalcModeDebt"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (isModEnabled('accounting')) { - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - } $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("RulesAmountWithTaxExcluded"); @@ -174,13 +167,6 @@ if ($modecompta == 'CREANCES-DETTES') { //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); - $calcmode = $langs->trans("CalcModeEngagement"); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (isModEnabled('accounting')) { - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - } $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("RulesAmountWithTaxIncluded"); @@ -189,11 +175,6 @@ if ($modecompta == 'CREANCES-DETTES') { //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); - $calcmode = $langs->trans("CalcModeBookkeeping"); - $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; - $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); $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("RulesAmountOnInOutBookkeepingRecord"); @@ -202,8 +183,25 @@ if ($modecompta == 'CREANCES-DETTES') { //$exportlink=$langs->trans("NotYetAvailable"); } +// Define $calcmode line +$calcmode = ''; +if (isModEnabled('accounting')) { + $calcmode .= ''; + $calcmode .= '
'; +} +$calcmode .= ''; +$calcmode .= '
'; -report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta), $calcmode); + +report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); @@ -1006,7 +1004,7 @@ print ' '; for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) { print ''; - print ''; + print ''; print $annee; if (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1) { print '-'.($annee + 1); diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index b80189bc00b..8fb4310692e 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -63,11 +63,11 @@ $nbofyear = 1; $year = GETPOST('year', 'int'); // year with current month, is the month of the period we must show if (empty($year)) { $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); - $month_current = strftime("%m", dol_now()); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year_current - ($nbofyear - 1); } else { $year_current = $year; - $month_current = strftime("%m", dol_now()); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year - ($nbofyear - 1); } $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); @@ -75,14 +75,14 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); // 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", 'int') : 0; if ($q == 0) { // We define date_start and date_end $year_end = $year_start + ($nbofyear - 1); $month_start = GETPOST("month", 'int') ?GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $date_startmonth = $month_start; if (!GETPOST('month')) { - if (!GETPOST("year") && $month_start > $month_current) { + if (!$year && $month_start > $month_current) { $year_start--; $year_end--; } @@ -144,7 +144,7 @@ $modecompta = $conf->global->ACCOUNTING_MODE; if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } -if (GETPOST("modecompta")) { +if (GETPOST("modecompta", 'alpha')) { $modecompta = GETPOST("modecompta", 'alpha'); } @@ -231,8 +231,8 @@ if ($modecompta == "CREANCES-DETTES") { //$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); - $arraylist = array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); - $period .= '     '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); + $arraylist = array('no'=>$langs->trans("None"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); + $period .= '     '.$langs->trans("DetailBy").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $periodlink = $textprevyear.$textnextyear; $exportlink = ''; $description = $langs->trans("RulesResultBookkeepingPersonalized"); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 7d70bc10527..f578e6a2ec9 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -50,28 +50,26 @@ if (empty($year)) { } else { $year_current = $year; $month_current = dol_print_date(dol_now(), "%m"); - $year_start = $year - ($nbofyear - 1); + $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); } -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); +$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere +$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere // 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; 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); + $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); + $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!GETPOST('month')) { - if (!GETPOST("year") && $month_start > $month_current) { + if (!$year && $month_start > $month_current) { $year_start--; $year_end--; } $month_end = $month_start - 1; if ($month_end < 1) { $month_end = 12; - } else { - $year_end++; } } else { $month_end = $month_start; @@ -97,9 +95,6 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } } -$userid = GETPOST('userid', 'int'); -$socid = GETPOST('socid', 'int'); - $tmps = dol_getdate($date_start); $mothn_start = $tmps['mon']; $year_start = $tmps['year']; @@ -113,11 +108,14 @@ $modecompta = $conf->global->ACCOUNTING_MODE; if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } -if (GETPOST("modecompta")) { +if (GETPOST("modecompta", 'alpha')) { $modecompta = GETPOST("modecompta", 'alpha'); } +$userid = GETPOST('userid', 'int'); + // Security check +$socid = GETPOST('socid', 'int'); if ($user->socid > 0) { $socid = $user->socid; } @@ -147,18 +145,13 @@ llxHeader(); $form = new Form($db); -$exportlink=""; -$namelink=""; +$exportlink = ''; +$namelink = ''; +$builddate = dol_now(); + // Affiche en-tete du rapport if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("Turnover"); - $calcmode = $langs->trans("CalcModeDebt"); - //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - if (isModEnabled('accounting')) { - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; - $calcmode = str_replace('{link1}', '', $calcmode); - $calcmode = str_replace('{link2}', '', $calcmode); - } $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesCADue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -166,30 +159,17 @@ if ($modecompta == "CREANCES-DETTES") { } else { $description .= $langs->trans("DepositsAreIncluded"); } - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected"); - $calcmode = $langs->trans("CalcModeEngagement"); - //$calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //if (isModEnabled('accounting')) { - //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - //} $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesCAIn"); $description .= $langs->trans("DepositsAreIncluded"); - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } 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("SeeReportInInputOutputMode",'','').')'; $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesSalesTurnoverOfIncomeAccounts"); - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); @@ -200,6 +180,31 @@ $moreparam = array(); if (!empty($modecompta)) { $moreparam['modecompta'] = $modecompta; } + +// Define $calcmode line +$calcmode = ''; +if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEINGCOLLECTED") { + /*if (isModEnabled('accounting')) { + $calcmode .= ''; + $calcmode .= '
'; + }*/ + $calcmode .= ''; +} else { + if (isModEnabled('accounting')) { + $calcmode .= ''; + $calcmode .= '
'; + } + $calcmode .= ''; +} + report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index 7e673c05f75..db6cec39cab 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -46,7 +46,7 @@ if (empty($year)) { } else { $year_current = $year; $month_current = dol_print_date(dol_now(), "%m"); - $year_start = $year - ($nbofyear - 1); + $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); } $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere @@ -56,18 +56,16 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1); + $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (!GETPOST('month')) { - if (!GETPOST("year") && $month_start > $month_current) { + if (!$year && $month_start > $month_current) { $year_start--; $year_end--; } $month_end = $month_start - 1; if ($month_end < 1) { $month_end = 12; - } else { - $year_end++; } } else { $month_end = $month_start; @@ -107,7 +105,7 @@ $modecompta = $conf->global->ACCOUNTING_MODE; if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } -if (GETPOST("modecompta")) { +if (GETPOST("modecompta", 'alpha')) { $modecompta = GETPOST("modecompta", 'alpha'); } @@ -131,10 +129,14 @@ llxHeader(); $form = new Form($db); +$exportlink = ''; +$namelink = ''; +$builddate = dol_now(); + // TODO Report from bookkeeping not yet available, so we switch on report on business events -if ($modecompta == "BOOKKEEPING") { +/*if ($modecompta == "BOOKKEEPING") { $modecompta = "CREANCES-DETTES"; -} +}*/ if ($modecompta == "BOOKKEEPINGCOLLECTED") { $modecompta = "RECETTES-DEPENSES"; } @@ -142,42 +144,26 @@ if ($modecompta == "BOOKKEEPINGCOLLECTED") { // Affiche en-tete du rapport if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("PurchaseTurnover"); - $calcmode = $langs->trans("CalcModeDebt"); - if (isModEnabled('accounting')) { - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; - $calcmode = str_replace('{link1}', '', $calcmode); - $calcmode = str_replace('{link2}', '', $calcmode); - } $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverDue"); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected"); - $calcmode = $langs->trans("CalcModeEngagement"); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverIn"); //$exportlink=$langs->trans("NotYetAvailable"); } 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); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts"); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { $name = $langs->trans("PurchaseTurnoverCollected"); - $calcmode = $langs->trans("CalcModeBookkeeping"); - $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')'; - $calcmode = str_replace('{link1}', '', $calcmode); - $calcmode = str_replace('{link2}', '', $calcmode); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts"); //$exportlink=$langs->trans("NotYetAvailable"); } -$builddate = dol_now(); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $period .= ' - '; $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); @@ -187,9 +173,32 @@ if (!empty($modecompta)) { $moreparam['modecompta'] = $modecompta; } -$exportlink = ''; +// Define $calcmode line +$calcmode = ''; +if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED") { + /*if (isModEnabled('accounting')) { + $calcmode .= ''; + $calcmode .= '
'; + }*/ + $calcmode .= ''; +} else { + if (isModEnabled('accounting')) { + $calcmode .= ''; + $calcmode .= '
'; + } + $calcmode .= ''; +} -report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); + +report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); @@ -242,14 +251,19 @@ $sql .= " ORDER BY dm"; $minyearmonth = $maxyearmonth = 0; +$cum = array(); +$cum_ht = array(); +$total_ht = array(); +$total = array(); + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); - $cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0; - $cum[$obj->dm] = $obj->amount_ttc; + $cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount; + $cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc; if ($obj->amount_ttc) { $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm); @@ -348,7 +362,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { 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') { - // Valeur CA du mois w/o VAT + // Value turnover of month w/o VAT print ''; if (!empty($cum_ht[$case])) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. @@ -363,7 +377,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { print ""; } - // Valeur CA du mois + // Value turnover of month print ''; if (!empty($cum[$case])) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. @@ -383,7 +397,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { } print ""; - // Pourcentage du mois + // Percentage of month if ($annee_decalage > $minyear && $case <= $casenow) { if (!empty($cum[$caseprev]) && !empty($cum[$case])) { $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100); @@ -439,7 +453,9 @@ 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 ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; + print ''; + print ($total_ht[$annee] ?price($total_ht[$annee]) : "0"); + print ""; } else { print ' '; } @@ -456,20 +472,22 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { 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 ''.($percent >= 0 ? "+$percent" : "$percent").'%'; + print ''; + print ($percent >= 0 ? "+$percent" : "$percent").'%'; + print ''; } - if ($total[$annee - 1] && !$total[$annee]) { + if (!empty($total[$annee - 1]) && empty($total[$annee])) { print '-100%'; } - if (!$total[$annee - 1] && $total[$annee]) { + if (empty($total[$annee - 1]) && !empty($total[$annee])) { print '+'.$langs->trans('Inf').'%'; } - if (!$total[$annee - 1] && !$total[$annee]) { + if (empty($total[$annee - 1]) && empty($total[$annee])) { print '+0%'; } } else { print ''; - if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { + if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index a5176383d69..2c72878d40e 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -41,6 +41,7 @@ AlreadyInGeneralLedger=Already transferred to accounting journals and ledger NotYetInGeneralLedger=Not yet transferred to accouting journals and ledger GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group DetailByAccount=Show detail by account +DetailBy=Detail by AccountWithNonZeroValues=Accounts with non-zero values ListOfAccounts=List of accounts CountriesInEEC=Countries in EEC diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 0d286fb3104..1112d4647bb 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -159,9 +159,10 @@ ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. -CalcModeDebt=Analysis of known recorded documents even if they are not yet accounted in ledger. -CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger. +CalcModeDebt=Analysis of known recorded documents +CalcModeEngagement=Analysis of known recorded payments CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table. +CalcModeNoBookKeeping=Even if they are not yet accounted in Ledger CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s CalcModeLT1Debt=Mode %sRE on customer invoices%s CalcModeLT1Rec= Mode %sRE on suppliers invoices%s