From 8248bc1c643df0f4bbe26ad9bee777d71c63677b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 31 Aug 2017 15:44:36 +0200 Subject: [PATCH] Uniformize code of accounting report --- htdocs/accountancy/report/index.html | 0 htdocs/compta/journal/purchasesjournal.php | 7 +- htdocs/compta/journal/sellsjournal.php | 6 +- htdocs/compta/localtax/clients.php | 10 +- htdocs/compta/localtax/quadri_detail.php | 6 +- htdocs/compta/resultat/clientfourn.php | 16 +- htdocs/compta/resultat/index.php | 72 +++++++-- .../report => compta/resultat}/result.php | 142 +++++++++++++++--- htdocs/compta/stats/cabyprodserv.php | 34 +++-- htdocs/compta/stats/cabyuser.php | 13 +- htdocs/compta/stats/casoc.php | 10 +- htdocs/compta/stats/index.php | 93 +++++++++--- htdocs/compta/tva/clients.php | 6 +- htdocs/compta/tva/quadri_detail.php | 10 +- htdocs/compta/tva/quarter_report.php | 16 +- htdocs/core/lib/report.lib.php | 8 +- htdocs/core/menus/init_menu_auguria.sql | 4 +- htdocs/core/menus/standard/eldy.lib.php | 4 +- .../install/mysql/migration/6.0.0-7.0.0.sql | 17 +++ htdocs/langs/en_US/compta.lang | 2 + 20 files changed, 340 insertions(+), 136 deletions(-) delete mode 100644 htdocs/accountancy/report/index.html rename htdocs/{accountancy/report => compta/resultat}/result.php (51%) diff --git a/htdocs/accountancy/report/index.html b/htdocs/accountancy/report/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index fbd391ffe2a..1349a7a83cc 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -84,8 +84,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false); } -$nom=$langs->trans("PurchasesJournal"); -$nomlink=''; +$name=$langs->trans("PurchasesJournal"); +$namelink=''; $periodlink=''; $exportlink=''; $builddate=time(); @@ -93,7 +93,8 @@ $description=$langs->trans("DescPurchasesJournal").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); + +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $p[0]; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index fd0c45be7cd..09a73b604a6 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -89,7 +89,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $nom=$langs->trans("SellsJournal"); -$nomlink=''; +$namelink=''; $periodlink=''; $exportlink=''; $builddate=time(); @@ -97,7 +97,7 @@ $description=$langs->trans("DescSellsJournal").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $p[0]; @@ -170,7 +170,7 @@ if ($result) $prev_progress = 0; if ($obj->type==Facture::TYPE_SITUATION) { // Avoid divide by 0 - if ($obj->situation_percent == 0) { + if ($obj->situation_percent == 0) { $situation_ratio = 0; } else { $prev_progress = $line->get_prev_progress($obj->rowid); // id on invoice diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 40a5805f2b3..751a9d00e6e 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -142,7 +142,7 @@ if ($calc==2) // Invoice for goods, payment for services $productsup=$langs->trans("Description"); $amountsup=$langs->trans("AmountHT"); } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); @@ -169,7 +169,7 @@ if($calc ==0 || $calc == 2) $parameters["end"] = $date_end; $parameters["direction"] = 'sell'; $parameters["type"] = 'localtax'.$local; - + // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -183,7 +183,7 @@ if($calc ==0 || $calc == 2) { if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0) { - + $intra = str_replace($find,$replace,$coll->tva_intra); if(empty($intra)) { @@ -247,7 +247,7 @@ if($calc ==0 || $calc == 1){ $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); $parameters["direction"] = 'buy'; $parameters["type"] = 'localtax'.$local; - + $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if (is_array($coll_list)) { @@ -258,7 +258,7 @@ if($calc ==0 || $calc == 1){ { if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0) { - + $intra = str_replace($find,$replace,$coll->tva_intra); if(empty($intra)) { diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index a70066bdb5d..decd447679e 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -177,7 +177,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services $vatsup=$langs->trans("VATPaid"); if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); if($local==1){ @@ -336,7 +336,7 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - + print ''; // Ref @@ -499,7 +499,7 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - + print ''; // Ref diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index a7cf8769711..4994737d3c3 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -64,7 +64,7 @@ if (! $sortfield) $sortfield='s.nom, s.rowid'; if (! $sortorder) $sortorder='ASC'; // Date range -$year=GETPOST("year"); +$year=GETPOST('year','int'); if (empty($year)) { $year_current = strftime("%Y",dol_now()); @@ -77,7 +77,8 @@ if (empty($year)) } $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); -// Quarter + +// 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; @@ -105,11 +106,6 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end 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 -{ - // TODO We define q - -} // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') $modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->ACCOUNTING_MODE); @@ -123,7 +119,7 @@ llxHeader(); $form=new Form($db); -$nomlink=''; +$namelink=''; $periodlink=''; $exportlink=''; @@ -158,9 +154,9 @@ else { $hselected = 'report'; -report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); -if (! empty($conf->accounting->enabled)) +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 6043a7cbec5..c1a352bc969 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -27,17 +27,60 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -$year_start=GETPOST('year_start'); -$year_current = strftime("%Y",time()); +$date_startmonth=GETPOST('date_startmonth'); +$date_startday=GETPOST('date_startday'); +$date_startyear=GETPOST('date_startyear'); +$date_endmonth=GETPOST('date_endmonth'); +$date_endday=GETPOST('date_endday'); +$date_endyear=GETPOST('date_endyear'); + $nbofyear=4; -if (! $year_start) { - $year_start = $year_current - ($nbofyear-1); - $year_end = $year_current; + +// Date range +$year=GETPOST('year','int'); +if (empty($year)) +{ + $year_current = strftime("%Y",dol_now()); + $month_current = strftime("%m",dol_now()); + $year_start = $year_current - ($nbofyear - 1); +} else { + $year_current = $year; + $month_current = strftime("%m",dol_now()); + $year_start = $year - ($nbofyear - 1); } -else { - $year_end=$year_start + ($nbofyear-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; + if ($q==0) + { + // We define date_start and date_end + $year_end=$year_start + ($nbofyear - 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) + { + $year_start--; + $year_end--; + } + $month_end=$month_start-1; + if ($month_end < 1) $month_end=12; + else $year_end++; + } + 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); } + 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); } } // Security check @@ -59,16 +102,16 @@ llxHeader(); $form=new Form($db); -$nomlink=''; +$namelink=''; $exportlink=''; // Affiche en-tete du rapport if ($modecompta == 'CREANCES-DETTES') { - $nom=$langs->trans("AnnualSummaryDueDebtMode"); + $name=$langs->trans("AnnualSummaryDueDebtMode"); $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $period="$year_start - $year_end"; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesAmountWithTaxIncluded"); $description.='
'.$langs->trans("RulesResultDue"); @@ -78,10 +121,10 @@ if ($modecompta == 'CREANCES-DETTES') //$exportlink=$langs->trans("NotYetAvailable"); } else { - $nom=$langs->trans("AnnualSummaryInputOutputMode"); + $name=$langs->trans("AnnualSummaryInputOutputMode"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $period="$year_start - $year_end"; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesAmountWithTaxIncluded"); $description.='
'.$langs->trans("RulesResultInOut"); @@ -91,9 +134,9 @@ else { $hselected='report'; -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); -if (! empty($conf->accounting->enabled)) +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -103,6 +146,7 @@ if (! empty($conf->accounting->enabled)) /* * Factures clients */ + $subtotal_ht = 0; $subtotal_ttc = 0; if ($modecompta == 'CREANCES-DETTES') diff --git a/htdocs/accountancy/report/result.php b/htdocs/compta/resultat/result.php similarity index 51% rename from htdocs/accountancy/report/result.php rename to htdocs/compta/resultat/result.php index fad1fcd4b9b..8bb5c99b1db 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/compta/resultat/result.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Alexandre Spangaro +/* Copyright (C) 2016-2017 Jamal Elbaz + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -17,17 +17,17 @@ */ /** - * \file htdocs/accountancy/report/result.php - * \ingroup Advanced accountancy + * \file htdocs/compta/resultat/result.php + * \ingroup compta, accountancy * \brief Page for accounting result */ -require '../../main.inc.php'; -// Class -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $error = 0; @@ -45,20 +45,68 @@ $cancel = GETPOST('cancel'); $simple_report = GETPOST('simple_report'); -// Filter -$year = GETPOST('year','int'); -if ($year == 0) { - $year_current = strftime("%Y", time()); - $year_start = $year_current; +$date_startmonth=GETPOST('date_startmonth'); +$date_startday=GETPOST('date_startday'); +$date_startyear=GETPOST('date_startyear'); +$date_endmonth=GETPOST('date_endmonth'); +$date_endday=GETPOST('date_endday'); +$date_endyear=GETPOST('date_endyear'); + +$nbofyear=1; + +// Date range +$year=GETPOST('year','int'); +if (empty($year)) +{ + $year_current = strftime("%Y",dol_now()); + $month_current = strftime("%m",dol_now()); + $year_start = $year_current - ($nbofyear - 1); } else { $year_current = $year; - $year_start = $year; + $month_current = strftime("%m",dol_now()); + $year_start = $year - ($nbofyear - 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; + if ($q==0) + { + // We define date_start and date_end + $year_end=$year_start + ($nbofyear - 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) + { + $year_start--; + $year_end--; + } + $month_end=$month_start-1; + if ($month_end < 1) $month_end=12; + else $year_end++; + } + 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); } + 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); } } if($cat_id == 0){ $cat_id = null; } +// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') +$modecompta = $conf->global->ACCOUNTING_MODE; +if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING'; +if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha'); + // Security check if ($user->societe_id > 0) accessforbidden(); @@ -80,14 +128,60 @@ $form = new Form($db); $textprevyear = '' . img_previous() . ''; $textnextyear = ' ' . img_next() . ''; -$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts"); -$nomlink = ''; -$periodlink = ''; -$exportlink = ''; -$builddate = time(); -$description = ''; -$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ; -report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); + + +// Affiche en-tete de rapport +if ($modecompta=="CREANCES-DETTES") +{ + $name=$langs->trans("AnnualByAccountDueDebtMode"); + $calcmode=$langs->trans("CalcModeDebt"); + $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + //$periodlink=''.img_previous().' '.img_next().''; + $description=$langs->trans("RulesResultDue"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); + else $description.= $langs->trans("DepositsAreIncluded"); + $builddate=time(); + //$exportlink=$langs->trans("NotYetAvailable"); +} +else if ($modecompta=="RECETTES-DEPENSES") { + $name=$langs->trans("AnnualByAccountInputOutputMode"); + $calcmode=$langs->trans("CalcModeEngagement"); + $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; + //$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1); + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + //$periodlink=''.img_previous().' '.img_next().''; + $description=$langs->trans("RulesResultInOut"); + $builddate=time(); + //$exportlink=$langs->trans("NotYetAvailable"); +} +else if ($modecompta=="BOOKKEEPING") +{ + $name = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts"); + $calcmode=$langs->trans("CalcModeBookkeeping"); + $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + $nomlink = ''; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $period.='   '.$langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0); + $periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ; + $exportlink = ''; + $description=$langs->trans("RulesResultDue"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); + else $description.= $langs->trans("DepositsAreIncluded"); + $builddate = time(); +} + +report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode); + + +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') +{ + print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); +} + $moreforfilter=''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index ee6e7f1be27..12826002279 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $langs->load("products"); $langs->load("categories"); @@ -143,12 +143,14 @@ foreach($allparams as $key => $value) { /* * View */ + llxHeader(); + $form=new Form($db); $formother = new FormOther($db); // Show report header -$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices"); +$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices"); if ($modecompta=="CREANCES-DETTES") { $calcmode=$langs->trans("CalcModeDebt"); @@ -176,9 +178,9 @@ if ($modecompta=="CREANCES-DETTES") { $builddate=time(); } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); -if (! empty($conf->accounting->enabled)) +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -266,7 +268,7 @@ if ($modecompta == 'CREANCES-DETTES') print '
'; print ''."\n"; - + // Category filter print ''; print ''; - + print ''; - + // Array header print ""; print_liste_field_titre( @@ -357,7 +359,7 @@ if ($modecompta == 'CREANCES-DETTES') if (count($name)) { foreach($name as $key=>$value) { - + print ''; // Product @@ -369,15 +371,15 @@ if ($modecompta == 'CREANCES-DETTES') } print "\n"; - + // Quantity print ''; - + // Percent; print ''; - + // Amount w/o VAT print ''; - + // Amount with VAT print ''; - + // Percent; print ''; - + // TODO: statistics? - + print "\n"; $i++; } @@ -423,7 +425,7 @@ if ($modecompta == 'CREANCES-DETTES') } print "
'; @@ -283,11 +285,11 @@ if ($modecompta == 'CREANCES-DETTES') print $langs->trans("Type"). ': '; $form->select_type_of_lines(isset($selected_type)?$selected_type:-1,'search_type',1,1,1); print ''; print ''; print '
".$linkname."'; print $qty[$key]; print ''.($qtytotal > 0 ? round(100 * $qty[$key] / $qtytotal, 2).'%' : ' ').''; /*if ($key > 0) { @@ -388,7 +390,7 @@ if ($modecompta == 'CREANCES-DETTES') print price($amount_ht[$key]); //print ''; print ''; /*if ($key > 0) { @@ -399,12 +401,12 @@ if ($modecompta == 'CREANCES-DETTES') print price($amount[$key]); //print ''; print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').'
"; print '
'; - + print ''; } else { // $modecompta != 'CREANCES-DETTES' diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index ad9a8fbd346..07c35b60c50 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -131,12 +131,11 @@ foreach($allparams as $key => $value) { llxHeader(); - $form=new Form($db); // Show report header if ($modecompta=="CREANCES-DETTES") { - $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); + $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -147,7 +146,7 @@ if ($modecompta=="CREANCES-DETTES") { $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } else { - $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); + $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -160,9 +159,9 @@ if ($modecompta=="CREANCES-DETTES") { $moreparam=array(); if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); -if (! empty($conf->accounting->enabled)) +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -350,9 +349,9 @@ if (count($amount)) { } $i = 0; - + foreach($arrayforsort as $key => $value) { - + print ''; // Third party diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index fdba026ac6f..f4beaf0b157 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $langs->load("companies"); $langs->load("categories"); @@ -165,7 +165,7 @@ $formother = new FormOther($db); // Show report header if ($modecompta=="CREANCES-DETTES") { - $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); + $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -176,7 +176,7 @@ if ($modecompta=="CREANCES-DETTES") $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } else { - $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); + $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -187,9 +187,9 @@ if ($modecompta=="CREANCES-DETTES") //$exportlink=$langs->trans("NotYetAvailable"); } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); -if (! empty($conf->accounting->enabled)) +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 1735033cab7..e3f0e36186a 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -25,21 +25,68 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + +$date_startmonth=GETPOST('date_startmonth'); +$date_startday=GETPOST('date_startday'); +$date_startyear=GETPOST('date_startyear'); +$date_endmonth=GETPOST('date_endmonth'); +$date_endday=GETPOST('date_endday'); +$date_endyear=GETPOST('date_endyear'); -$year_start=GETPOST("year_start"); -$year_current = strftime("%Y",time()); $nbofyear=4; -if (! $year_start) { - $year_start = $year_current - ($nbofyear-1); - $year_end = $year_current; + +// Date range +$year=GETPOST('year','int'); +if (empty($year)) +{ + $year_current = strftime("%Y",dol_now()); + $month_current = strftime("%m",dol_now()); + $year_start = $year_current - ($nbofyear - 1); +} else { + $year_current = $year; + $month_current = strftime("%m",dol_now()); + $year_start = $year - ($nbofyear - 1); } -else { - $year_end=$year_start + ($nbofyear-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; + if ($q==0) + { + // We define date_start and date_end + $year_end=$year_start + ($nbofyear - 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) + { + $year_start--; + $year_end--; + } + $month_end=$month_start-1; + if ($month_end < 1) $month_end=12; + else $year_end++; + } + 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); } + 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); } } + $userid=GETPOST('userid','int'); $socid = GETPOST('socid','int'); -// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') + +// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; +if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING'; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha'); // Security check @@ -55,16 +102,17 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin */ llxHeader(); + $form=new Form($db); // Affiche en-tete du rapport if ($modecompta=="CREANCES-DETTES") { - $nom=$langs->trans("SalesTurnover"); + $name=$langs->trans("SalesTurnover"); $calcmode=$langs->trans("CalcModeDebt"); $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period="$year_start - $year_end"; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); @@ -74,11 +122,11 @@ if ($modecompta=="CREANCES-DETTES") } else if ($modecompta=="RECETTES-DEPENSES") { - $nom=$langs->trans("SalesTurnover"); + $name=$langs->trans("SalesTurnover"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; - $period="$year_start - $year_end"; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); @@ -87,23 +135,24 @@ else if ($modecompta=="RECETTES-DEPENSES") } else if ($modecompta=="BOOKKEEPING") { - $nom=$langs->trans("BookkeepingTurnover"); + $name=$langs->trans("SalesTurnover"); $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $period="$year_start - $year_end"; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); - $description=$langs->trans("RulesCABookkeeping"); - $description.= $langs->trans("DepositsAreIncluded"); + $description=$langs->trans("RulesCADue"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); + else $description.= $langs->trans("DepositsAreIncluded"); $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } $moreparam=array(); if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); -if (! empty($conf->accounting->enabled)) +if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -252,7 +301,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $mois_modulo = $mois;// ajout if($mois>12){$mois_modulo = $mois-12;} // ajout - + print ''; print "".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B").""; @@ -342,7 +391,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) /* for ($mois = 1 ; $mois < 13 ; $mois++) { - + print ''; print "".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B").""; @@ -510,7 +559,7 @@ print ''; $totalam_Rac += $obj->am; $i++; } - + print "Facture a encaisser : ".price($total_ttc_Rac)."<-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es"; } $db->free($resql); @@ -560,7 +609,7 @@ print ''; $total_pr += $obj->total_ttc-$obj->tot_fttc; $i++; } - + print "Signe et non facture:".price($total_pr)."<-- bug ici, ca devrait exclure le deja facture"; } $db->free($resql); diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 0ede7fa091e..b41d23303cf 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -220,7 +220,7 @@ if ($modetax==0) { // Invoice for goods, payment for services $vatsup.=' ('.$langs->trans("ToGetBack").')'; } } -report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); @@ -260,7 +260,7 @@ if (is_array($coll_list)) { $i = 1; foreach ($coll_list as $coll) { if ($min == 0 or ($min > 0 && $coll->amount > $min)) { - + $intra = str_replace($find,$replace,$coll->tva_intra); if(empty($intra)) { if($coll->assuj == '1') { @@ -340,7 +340,7 @@ if (is_array($coll_list)) { $i = 1; foreach ($coll_list as $coll) { if ($min == 0 or ($min > 0 && $coll->amount > $min)) { - + $intra = str_replace($find,$replace,$coll->tva_intra); if (empty($intra)) { if ($coll->assuj == '1') { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 513eb25ff7e..a92e79b81a3 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -133,7 +133,7 @@ $fsearch.=' '; // Affiche en-tete du rapport if ($modetax==1) // Calculate on invoice for goods and services { - $nom=$langs->trans("VATReportByQuartersInDueDebtMode"); + $name=$langs->trans("VATReportByQuartersInDueDebtMode"); $calcmode=$langs->trans("CalcModeVATDebt"); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -172,7 +172,7 @@ if ($modetax==1) // Calculate on invoice for goods and services } if ($modetax==0) // Invoice for goods, payment for services { - $nom=$langs->trans("VATReportByQuartersInInputOutputMode"); + $name=$langs->trans("VATReportByQuartersInInputOutputMode"); $calcmode=$langs->trans("CalcModeVATEngagement"); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); @@ -396,7 +396,7 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - + print ''; // Ref @@ -553,7 +553,7 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - + print ''; // Ref diff --git a/htdocs/compta/tva/quarter_report.php b/htdocs/compta/tva/quarter_report.php index a3d902ed3f3..2f35e5f10ba 100644 --- a/htdocs/compta/tva/quarter_report.php +++ b/htdocs/compta/tva/quarter_report.php @@ -146,7 +146,7 @@ $fsearch.=' '; // Affiche en-tete du rapport if ($modetax==1) { // Calculate on invoice for goods and services - $nom=$langs->trans("VATReportByQuartersInDueDebtMode"); + $name=$langs->trans("VATReportByQuartersInDueDebtMode"); $calcmode=$langs->trans("CalcModeVATDebt"); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -195,7 +195,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services } } if ($modetax==0) { // Invoice for goods, payment for services - $nom=$langs->trans("VATReportByQuartersInInputOutputMode"); + $name=$langs->trans("VATReportByQuartersInInputOutputMode"); $calcmode=$langs->trans("CalcModeVATEngagement"); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); @@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services $vatsup.=' ('.$langs->trans("ToGetBack").')'; } } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); @@ -373,18 +373,18 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print ''.$langs->trans("AmountHTVATRealReceived").''; print ''.$vatcust.''; print ''; - + $action = "tvadetail"; $parameters["mode"] = $modetax; $parameters["start"] = $date_start; $parameters["end"] = $date_end; $parameters["type"] = 'vat'; - + $object = array(&$x_coll, &$x_paye, &$x_both); // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - + foreach (array_keys($x_coll) as $rate) { $subtot_coll_total_ht = 0; $subtot_coll_vat = 0; @@ -408,7 +408,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $type=1; } - + print ''; // Ref @@ -576,7 +576,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $type=1; } - + print ''; // Ref diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 2c13485d0e9..1b80a4bc2ec 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -35,7 +35,7 @@ * @param string $exportlink Link for export or '' * @param array $moreparam Array with list of params to add into form * @param string $calcmode Calculation mode - * @param string $varlink Add a variable into the address of the page + * @param string $varlink Add a variable into the address of the page * @return void */ function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='') @@ -43,9 +43,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat global $langs; if (empty($hselected)) $hselected='report'; - + print "\n\n\n"; - + if(! empty($varlink)) $varlink = '?'.$varlink; $h=0; @@ -116,7 +116,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat print ''; dol_fiche_end(); - + print "\n\n\n"; } diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index a4b6bfaa3bd..26215ab99ad 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -249,9 +249,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Balance insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Reports - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8d22592fd14..b9182542c18 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1118,10 +1118,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Reports $langs->load("compta"); - $newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); + $newmenu->add("/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 83525cd1e6b..d9aa1541b76 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -209,3 +209,20 @@ UPDATE llx_const set name = 'ONLINE_PAYMENT_NEWFORMTEXT' where name = 'PAYPAL_NE UPDATE llx_const set name = 'ONLINE_PAYMENT_LOGO' where name = 'PAYPAL_LOGO'; + +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_stock_mouvement MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_lot MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product_batch MODIFY batch VARCHAR(30) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci; + + diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index d49256e7c32..3a1d8bb9c5f 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -134,6 +134,7 @@ CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. CalcModeDebt=Mode %sClaims-Debts%s said Commitment accounting. CalcModeEngagement=Mode %sIncomes-Expenses%s said cash accounting +CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s CalcModeLT1Debt=Mode %sRE on customer invoices%s CalcModeLT1Rec= Mode %sRE on suppliers invoices%s @@ -146,6 +147,7 @@ AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third par AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode %sIncomes-Expenses%s said cash accounting. SeeReportInInputOutputMode=See report %sIncomes-Expenses%s said cash accounting for a calculation on actual payments made SeeReportInDueDebtMode=See report %sClaims-Debts%s said commitment accounting for a calculation on issued invoices +SeeReportInBookkeepingMode=See report %sBookeeping%s for a calculation on bookkeeping table analysis RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.
- It is based on the validation date of invoices and VAT and on the due date for expenses. For salaries defined with Salary module, the value date of payment is used. RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries.
- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation.