From 987303a6cad94555114331a5c2f840d9a9bbeba8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2017 02:12:37 +0200 Subject: [PATCH 1/6] Nb of sql requests divided by 2 from report per personalized categories --- htdocs/compta/resultat/result.php | 113 ++++++++++++++---------------- 1 file changed, 53 insertions(+), 60 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index aa714cf042f..fb78c6b8485 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -39,16 +39,16 @@ $cat_id = GETPOST('account_category'); $selectcpt = GETPOST('cpt_bk'); $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); -$cancel = GETPOST('cancel'); -$simple_report = GETPOST('simple_report'); +$cancel = GETPOST('cancel','alpha'); +$showaccountdetail = GETPOST('showaccountdetail','aZ09'); -$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'); +$date_startmonth=GETPOST('date_startmonth','int'); +$date_startday=GETPOST('date_startday','int'); +$date_startyear=GETPOST('date_startyear','int'); +$date_endmonth=GETPOST('date_endmonth','int'); +$date_endday=GETPOST('date_endday','int'); +$date_endyear=GETPOST('date_endyear','int'); $nbofyear=1; @@ -181,10 +181,11 @@ else if ($modecompta=="BOOKKEEPING") //$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("DetailByAccount").' '. $form->selectyesno('simple_report',$simple_report,0); + $period.='     '.$langs->trans("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0); $periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ; $exportlink = ''; - $description=$langs->trans("RulesResultBookkeepingPersonalized", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory")); + $description=$langs->trans("RulesResultBookkeepingPersonalized"). + $description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory")).')'; //if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); //else $description.= $langs->trans("DepositsAreIncluded"); $builddate = time(); @@ -224,7 +225,7 @@ print ''; print ''.$langs->trans("PreviousYear").''; print ''.$langs->trans("SelectedPeriod").''; foreach($months as $k => $v){ - print ''.$langs->trans($v).''; + print ''.$langs->trans($v).''; } print ''; @@ -240,9 +241,6 @@ else if ($modecompta=="RECETTES-DEPENSES") } else if ($modecompta=="BOOKKEEPING") { - // TODO - //if (! empty($date_start) && ! empty($date_end)) - // $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; //All categories $cats = $AccCat->getCats(); @@ -250,14 +248,19 @@ else if ($modecompta=="BOOKKEEPING") $j=1; $sommes = array(); + $totPerAccount = array(); foreach ($cats as $cat) // Loop on each group { if (!empty($cat['category_type'])) // category calculed { + // When we enter here, $sommes was filled by group of accounts + $formula = $cat['formula']; print ""; + + // Year NP //print '' . $cat['label'] . ''; print '' . $cat['label'] . ''; @@ -271,11 +274,15 @@ else if ($modecompta=="BOOKKEEPING") $result = strtr($formula, $vars); - - $r = $AccCat->calculate($result); + //var_dump($result); + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1); + //var_dump($r); print '' . price($r) . ''; - $code = $cat['code']; // code categorie de calcule + + // Year N + $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) $sommes[$code]['NP'] += $r; // Current fiscal year (N) @@ -287,18 +294,23 @@ else if ($modecompta=="BOOKKEEPING") $result = strtr($formula, $vars); - $r = $AccCat->calculate($result); + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1); print '' . price($r) . ''; $sommes[$code]['N'] += $r; // Detail by month - foreach($months as $k => $v){ + foreach($months as $k => $v) + { foreach($sommes as $code => $det){ $vars[$code] = $det['M'][$k]; } $result = strtr($formula, $vars); - $r = $AccCat->calculate($result); + + //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1); + print '' . price($r) . ''; $sommes[$code]['M'][$k] += $r; } @@ -306,7 +318,7 @@ else if ($modecompta=="BOOKKEEPING") print "\n"; - + //var_dump($sommes); } else // normal category { @@ -352,7 +364,8 @@ else if ($modecompta=="BOOKKEEPING") $code = $cat['code']; - // Column N Previous and N + // Set value into column NPrevious, N and each month M ($totCat) + // This make 14 calls for each detail of account (NP, N and month m) foreach($cpts as $i => $cpt) { // N-1 @@ -376,6 +389,10 @@ else if ($modecompta=="BOOKKEEPING") $totCat['NP'] += $resultNP; $totCat['N'] += $resultN; + $sommes[$code]['NP'] += $resultNP; + $sommes[$code]['N'] += $resultN; + $totPerAccount[$cpt['account_number']]['NP'] = $resultNP; + $totPerAccount[$cpt['account_number']]['N'] = $resultN; foreach($months as $k => $v) { @@ -387,9 +404,12 @@ else if ($modecompta=="BOOKKEEPING") $resultM=$AccCat->sdc; } $totCat['M'][$k] += $resultM; + $sommes[$code]['M'][$k] += $resultM; + $totPerAccount[$cpt['account_number']]['M'][$k] = $resultM; } } + // Now output columns for row $code ('VTE', 'MAR', ...) print '' . price($totCat['NP']) . ''; print '' . price($totCat['N']) . ''; @@ -398,55 +418,28 @@ else if ($modecompta=="BOOKKEEPING") } print "\n"; - // - foreach($cpts as $i => $cpt) + // Loop on detail of all accounts + // This make 14 calls for each detail of account (NP, N and month m) + if ($showaccountdetail == 'yes') { - // N-1 - $return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']); + foreach($cpts as $i => $cpt) + { + $resultNP=$totPerAccount[$cpt['account_number']]['NP']; + $resultN=$totPerAccount[$cpt['account_number']]['N']; - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultNP=0; - } else { - $resultNP=$AccCat->sdc; - } - - //N - $return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']); - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultN=0; - } else { - $resultN=$AccCat->sdc; - } - - $sommes[$code]['NP'] += $resultNP; - $sommes[$code]['N'] += $resultN; - - if ($simple_report == 'yes') { print ''; print '     ' . length_accountg($cpt['account_number']) . ''; print '' . $cpt['name_cpt'] . ''; print '' . price($resultNP) . ''; print '' . price($resultN) . ''; - } - foreach($months as $k => $v) - { - $return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']); - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultM=0; - } else { - $resultM=$AccCat->sdc; - } - $sommes[$code]['M'][$k] += $resultM; - if ($simple_report == 'yes') { + // Make one call for each month + foreach($months as $k => $v) + { + $resultM=$totPerAccount[$cpt['account_number']]['M'][$k]; print '' . price($resultM) . ''; } - } - if ($simple_report == 'yes') { print "\n"; } } From e1fa37f7ffc992cc59405dda6a559296546974ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2017 02:13:02 +0200 Subject: [PATCH 2/6] Work on reports per date --- htdocs/accountancy/admin/categories_list.php | 2 +- .../class/accountancycategory.class.php | 10 ++- htdocs/compta/resultat/clientfourn.php | 80 ++++++++++++++++--- htdocs/compta/resultat/index.php | 21 +++-- htdocs/langs/en_US/compta.lang | 7 +- 5 files changed, 98 insertions(+), 22 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index d8f93ee1af5..de31b673f12 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -52,7 +52,7 @@ $langs->load("hrm"); $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $confirm=GETPOST('confirm','alpha'); -$id=GETPOST('id','int'); +$id=32; $rowid=GETPOST('rowid','alpha'); $code=GETPOST('code','alpha'); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 819a46d138a..19f34d856ab 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -488,13 +488,19 @@ class AccountancyCategory // calcule + /* I try to replace this with dol_eval() + const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/'; const PARENTHESIS_DEPTH = 10; - public function calculate($input){ + public function calculate($input) + { + global $langs; + if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){ // Remove white spaces and invalid math chars + $input = str_replace($langs->trans("ThousandSeparator"), '', $input); $input = str_replace(',', '.', $input); $input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input); @@ -536,6 +542,8 @@ class AccountancyCategory return 0; } + */ + /** * get cpts of category diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 927774e82d9..524f993ba3b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -37,12 +37,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array('compta','bills','donation','salaries')); -$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'); +$date_startmonth=GETPOST('date_startmonth','int'); +$date_startday=GETPOST('date_startday','int'); +$date_startyear=GETPOST('date_startyear','int'); +$date_endmonth=GETPOST('date_endmonth','int'); +$date_endday=GETPOST('date_endday','int'); +$date_endyear=GETPOST('date_endyear','int'); +$showaccountdetail = GETPOST('showaccountdetail','aZ09'); // Security check $socid = GETPOST('socid','int'); @@ -170,8 +171,10 @@ elseif ($modecompta=="BOOKKEEPING") $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',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); + $period.='     '.$langs->trans("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0); $periodlink=($year_start?"".img_previous()." ".img_next()."":""); - $description=$langs->trans("RulesResultBookkeepingPredefined", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts")); + $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->trans("Chartofaccounts")).')'; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -196,8 +199,8 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear; print ''; print ''; +print_liste_field_titre("Groups", $_SERVER["PHP_SELF"], 's.nom, s.rowid','',$param,'',$sortfield,$sortorder); print_liste_field_titre(''); -print_liste_field_titre("Groups", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); if ($modecompta == 'BOOKKEEPING') { print_liste_field_titre("Amount", $_SERVER["PHP_SELF"],'amount','',$param,'align="right"',$sortfield,$sortorder); @@ -220,7 +223,12 @@ if ($modecompta == 'BOOKKEEPING') $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f"; $sql.= ", ".MAIN_DB_PREFIX."accounting_account as aa"; $sql.= " WHERE f.numero_compte = aa.account_number"; - $sql.= " AND pcg_type in ('EXPENSE','INCOME')"; + //$sql.= " AND fk_statut in (1,2)"; + $sql.= " AND ("; + $sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))"; + $sql.= " OR "; + $sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))"; + $sql.= ")"; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY name, socid, pcg_type, pcg_subtype"; @@ -254,6 +262,60 @@ if ($modecompta == 'BOOKKEEPING') $total_ht += (isset($objp->amount)?$objp->amount:0); $total_ttc += (isset($objp->amount)?$objp->amount:0); + // Loop on detail of all accounts + // This make 14 calls for each detail of account (NP, N and month m) + if ($showaccountdetail == 'yes') + { /* + foreach($cpts as $i => $cpt) + { + // N-1 + $return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']); + + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultNP=0; + } else { + $resultNP=$AccCat->sdc; + } + + //N + $return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultN=0; + } else { + $resultN=$AccCat->sdc; + } + + $sommes[$code]['NP'] += $resultNP; + $sommes[$code]['N'] += $resultN; + + print ''; + print ''; + print ''; + print ''; + print ''; + + foreach($months as $k => $v) + { + $return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']); + if ($return < 0) { + setEventMessages(null, $AccCat->errors, 'errors'); + $resultM=0; + } else { + $resultM=$AccCat->sdc; + } + $sommes[$code]['M'][$k] += $resultM; + if ($showaccountdetail == 'yes') { + print ''; + } + } + + print "\n"; + } + */ + } + $i++; } } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index cf07c7886f9..8bf7a1faaea 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -32,12 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array('compta','bills','donation','salaries')); -$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'); +$date_startmonth=GETPOST('date_startmonth','int'); +$date_startday=GETPOST('date_startday','int'); +$date_startyear=GETPOST('date_startyear','int'); +$date_endmonth=GETPOST('date_endmonth','int'); +$date_endday=GETPOST('date_endday','int'); +$date_endyear=GETPOST('date_endyear','int'); $nbofyear=4; @@ -152,7 +152,8 @@ else if ($modecompta=="BOOKKEEPING") $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); $periodlink=($year_start?"".img_previous()."".img_next()."":""); - $description=$langs->trans("RulesAmountOnInOutBookkeepingRecord", $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory")); + $description=$langs->trans("RulesAmountOnInOutBookkeepingRecord"); + $description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("Chartofaccounts")).')'; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -817,7 +818,11 @@ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_account as aa"; $sql.= " WHERE b.numero_compte = aa.account_number AND b.entity = ".$conf->entity; //$sql.= " AND fk_statut in (1,2)"; - $sql.= " AND pcg_type in ('INCOME', 'EXPENSE')"; + $sql.= " AND ("; + $sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))"; + $sql.= " OR "; + $sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))"; + $sql.= ")"; //$sql.= " AND code_journal in ('VT', 'AC')"; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'"; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 394541e4dd1..8cc98f82def 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -154,9 +154,10 @@ RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whet 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. RulesCADue=- It includes the client's due invoices whether they are paid or not.
- It is based on the validation date of these invoices.
RulesCAIn=- It includes all the effective payments of invoices received from clients.
- It is based on the payment date of these invoices
-RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME" (See %s) -RulesResultBookkeepingPredefined=It includes record in your Ledger with accounting accounts that has the group "EXPENSE" or "INCOME" (See %s) -RulesResultBookkeepingPersonalized=It show record in your Ledger with accounting accounts grouped by personalized groups (See menu %s to define accounting account groups) +RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE/PRODUCT|SERVICE" or "INCOME/PRODUCT|SERVICE" +RulesResultBookkeepingPredefined=It includes record in your Ledger with accounting accounts that has the group "EXPENSE/PRODUCT|SERVICE" or "INCOME/PRODUCT|SERVICE" +RulesResultBookkeepingPersonalized=It show record in your Ledger with accounting accounts grouped by personalized groups +SeePageForSetup=See menu %s for setup. DepositsAreNotIncluded=- Down payment invoices are nor included DepositsAreIncluded=- Down payment invoices are included LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF From c1d31c34cd205237d91126698c394b2ff5698143 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2017 02:26:23 +0200 Subject: [PATCH 3/6] Work on reports per date --- .../class/accountancycategory.class.php | 2 +- htdocs/compta/resultat/clientfourn.php | 52 +++++++++---------- htdocs/compta/resultat/result.php | 31 +++++------ 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 19f34d856ab..8edcd4bca04 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -338,7 +338,7 @@ class AccountancyCategory * @param string $month Specifig month - Can be empty * @param string $date_start Date start * @param string $date_end Date end - * @param int $sens Sens of the account 0: credit - debit 1: debit - credit + * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit * @return integer Result in table */ public function getResult($cpt, $month, $date_start, $date_end, $sens) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 524f993ba3b..67a9f3aec61 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' 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.'/accountancy/class/accountancycategory.class.php'; $langs->loadLangs(array('compta','bills','donation','salaries')); @@ -119,11 +120,29 @@ $modecompta = $conf->global->ACCOUNTING_MODE; if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING'; if (GETPOST("modecompta",'alpha')) $modecompta=GETPOST("modecompta",'alpha'); +$AccCat = new AccountancyCategory($db); + + /* * View */ +$months = array( + $langs->trans("JanuaryMin"), + $langs->trans("FebruaryMin"), + $langs->trans("MarchMin"), + $langs->trans("AprilMin"), + $langs->trans("MayMin"), + $langs->trans("JuneMin"), + $langs->trans("JulyMin"), + $langs->trans("AugustMin"), + $langs->trans("SeptemberMin"), + $langs->trans("OctoberMin"), + $langs->trans("NovemberMin"), + $langs->trans("DecemberMin"), +); + llxHeader(); $form=new Form($db); @@ -265,32 +284,14 @@ if ($modecompta == 'BOOKKEEPING') // Loop on detail of all accounts // This make 14 calls for each detail of account (NP, N and month m) if ($showaccountdetail == 'yes') - { /* + { + // TODO Get list of account for this group/subgroup + $cpts = array(); + foreach($cpts as $i => $cpt) { - // N-1 - $return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']); - - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultNP=0; - } else { - $resultNP=$AccCat->sdc; - } - - //N - $return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']); - if ($return < 0) { - setEventMessages(null, $AccCat->errors, 'errors'); - $resultN=0; - } else { - $resultN=$AccCat->sdc; - } - - $sommes[$code]['NP'] += $resultNP; - $sommes[$code]['N'] += $resultN; - print ''; + print ''; print ''; print ''; @@ -306,14 +307,11 @@ if ($modecompta == 'BOOKKEEPING') $resultM=$AccCat->sdc; } $sommes[$code]['M'][$k] += $resultM; - if ($showaccountdetail == 'yes') { - print ''; - } + print ''; } print "\n"; } - */ } $i++; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index fb78c6b8485..31d56074148 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -26,8 +26,8 @@ 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'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; $langs->loadLangs(array('compta','bills','donation','salaries')); @@ -136,6 +136,21 @@ $AccCat = new AccountancyCategory($db); * View */ +$months = array( + $langs->trans("JanuaryMin"), + $langs->trans("FebruaryMin"), + $langs->trans("MarchMin"), + $langs->trans("AprilMin"), + $langs->trans("MayMin"), + $langs->trans("JuneMin"), + $langs->trans("JulyMin"), + $langs->trans("AugustMin"), + $langs->trans("SeptemberMin"), + $langs->trans("OctoberMin"), + $langs->trans("NovemberMin"), + $langs->trans("DecemberMin"), +); + llxheader('', $langs->trans('ReportInOut')); $formaccounting = new FormAccounting($db); @@ -205,20 +220,6 @@ $moreforfilter=''; print '
'; print '
    ' . length_accountg($cpt['account_number']) . '' . $cpt['name_cpt'] . '' . price($resultNP) . '' . price($resultN) . '' . price($resultM) . '
    ' . length_accountg($cpt['account_number']) . '' . $cpt['name_cpt'] . '' . price($resultNP) . '' . price($resultM) . '' . price($resultM) . '
'."\n"; -$months = array( $langs->trans("JanuaryMin"), - $langs->trans("FebruaryMin"), - $langs->trans("MarchMin"), - $langs->trans("AprilMin"), - $langs->trans("MayMin"), - $langs->trans("JuneMin"), - $langs->trans("JulyMin"), - $langs->trans("AugustMin"), - $langs->trans("SeptemberMin"), - $langs->trans("OctoberMin"), - $langs->trans("NovemberMin"), - $langs->trans("DecemberMin"), - ); - print ''; print ''; print ''; From 4b1133292734fe13be9d3387880fce5838ce07a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2017 09:42:05 +0200 Subject: [PATCH 4/6] Debug edit accounting groups --- htdocs/accountancy/admin/categories_list.php | 67 +++++++------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index de31b673f12..6cdb19b3fb5 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -1,16 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand - * Copyright (C) 2011 Remy Younes - * Copyright (C) 2012-2015 Marcos García - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2016 Alexandre Spangaro - * Copyright (C) 2015 Ferran Marcet - * Copyright (C) 2016 Raphaël Doursenaud +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2011-2017 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 @@ -108,11 +98,11 @@ $tabsqlsort[32]="position ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); -$tabfield[32]= "code,label,range_account,category_type,formula,position,country_id,country"; +$tabfield[32]= "code,label,range_account,category_type,formula,position,country"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); -$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country"; +$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); @@ -168,7 +158,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) foreach ($listfield as $f => $value) { if ($value == 'formula' && empty($_POST['formula'])) continue; - if (! isset($_POST[$value]) || $_POST[$value]=='') + if ($value == 'country') continue; // country_id required but not country + if (! isset($_POST[$value]) || $_POST[$value]=='') { $ok=0; $fieldnamekey=$listfield[$f]; @@ -183,11 +174,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } } - // Other checks - if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) { - $ok=0; - setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); - } if (isset($_POST["code"])) { if ($_POST["code"]=='0') @@ -201,17 +187,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; }*/ } - if (isset($_POST["country"]) && ($_POST["country"]=='0')) + if (isset($_POST["country"]) && ($_POST["country"] <= 0)) { - if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries - { - $_POST["country"]=''; - } - else - { - $ok=0; - setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors'); - } + $ok=0; + setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors'); } // Clean some parameters @@ -301,8 +280,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); + if ($field == 'fk_country' && $_POST['country'] > 0) { + $_POST[$listfieldvalue[$i]] = $_POST['country']; } else if ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; @@ -531,12 +510,10 @@ if ($id) { $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } + if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); } if ($fieldlist[$field]=='country') { - if (in_array('region_id',$fieldlist)) { print '
'; continue; } // For region page, we do not show the country input $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } @@ -735,6 +712,7 @@ if ($id) print '
'; print ''; print ''; + print ''; } else { @@ -844,8 +822,8 @@ if ($id) print ''.$langs->trans("Setup").''; } print ''; - print "\n"; } + print "\n"; $i++; } } @@ -891,16 +869,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex { if ($fieldlist[$field] == 'country') { - if (in_array('region_id',$fieldlist)) - { - print ''; - continue; - } // For state page, we do not show the country input (we link to region, not country) print ''; } elseif ($fieldlist[$field] == 'country_id') From a0cdf784dafc038dcf7c0dd2ca7ad66f00548dd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2017 09:43:22 +0200 Subject: [PATCH 5/6] Standardize code --- htdocs/accountancy/journal/bankjournal.php | 2 +- .../journal/expensereportsjournal.php | 2 +- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/compta/journal/purchasesjournal.php | 2 +- htdocs/compta/journal/sellsjournal.php | 2 +- htdocs/compta/localtax/clients.php | 4 ++-- htdocs/compta/localtax/quadri_detail.php | 4 ++-- htdocs/compta/resultat/clientfourn.php | 8 +++---- htdocs/compta/resultat/index.php | 10 ++++---- htdocs/compta/resultat/result.php | 24 ++++++++++++------- htdocs/compta/stats/cabyprodserv.php | 4 ++-- htdocs/compta/stats/cabyuser.php | 4 ++-- htdocs/compta/stats/casoc.php | 4 ++-- htdocs/compta/stats/index.php | 6 ++--- htdocs/compta/tva/clients.php | 4 ++-- htdocs/compta/tva/quadri_detail.php | 4 ++-- htdocs/compta/tva/quarter_report.php | 4 ++-- htdocs/core/lib/functions.lib.php | 5 ++-- htdocs/core/lib/report.lib.php | 2 +- htdocs/langs/en_US/accountancy.lang | 8 +++---- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/compta.lang | 6 ++--- htdocs/langs/en_US/main.lang | 2 ++ .../accountancy/export-thirdpartyaccount.php | 2 +- 25 files changed, 62 insertions(+), 57 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 0fbb60c2e2d..f5982acdf14 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -724,7 +724,7 @@ if (empty($action) || $action == 'view') { llxHeader('', $langs->trans("FinanceJournal")); $nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1); - $builddate = time(); + $builddate=dol_now(); //$description = $langs->trans("DescFinanceJournal") . '
'; $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 3862bc4ec63..7b90ff82a95 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -498,7 +498,7 @@ if (empty($action) || $action == 'view') { $nomlink = ''; $periodlink = ''; $exportlink = ''; - $builddate = time(); + $builddate=dol_now(); $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; $listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger")); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index ceacabd57e9..d3551decf86 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -514,7 +514,7 @@ if (empty($action) || $action == 'view') { $nomlink = ''; $periodlink = ''; $exportlink = ''; - $builddate = time(); + $builddate=dol_now(); $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 51493942516..fbcc12f054e 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -535,7 +535,7 @@ if (empty($action) || $action == 'view') { $nomlink = ''; $periodlink = ''; $exportlink = ''; - $builddate = time(); + $builddate=dol_now(); $description.= $langs->trans("DescJournalOnlyBindedVisible").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 1349a7a83cc..efd5abc5a82 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -88,7 +88,7 @@ $name=$langs->trans("PurchasesJournal"); $namelink=''; $periodlink=''; $exportlink=''; -$builddate=time(); +$builddate=dol_now(); $description=$langs->trans("DescPurchasesJournal").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 09a73b604a6..cc5b7472d88 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -92,7 +92,7 @@ $nom=$langs->trans("SellsJournal"); $namelink=''; $periodlink=''; $exportlink=''; -$builddate=time(); +$builddate=dol_now(); $description=$langs->trans("DescSellsJournal").'
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 751a9d00e6e..c5226aa3055 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -115,7 +115,7 @@ if ($calc==0 || $calc==1) // Calculate on invoice for goods and services if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; - $builddate=time(); + $builddate=dol_now(); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("Description"); @@ -133,7 +133,7 @@ if ($calc==2) // Invoice for goods, payment for services if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; - $builddate=time(); + $builddate=dol_now(); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("Description"); diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index decd447679e..0053a152633 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -136,7 +136,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); else $description.='
'.$langs->trans("DepositsAreIncluded"); $description.=$fsearch; - $builddate=time(); + $builddate=dol_now(); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); @@ -164,7 +164,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded"); $description.=$fsearch; - $builddate=time(); + $builddate=dol_now(); $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 67a9f3aec61..05290fee1e9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -166,7 +166,7 @@ if ($modecompta=="CREANCES-DETTES") $description=$langs->trans("RulesResultDue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta=="RECETTES-DEPENSES") @@ -179,7 +179,7 @@ elseif ($modecompta=="RECETTES-DEPENSES") $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("RulesResultInOut"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta=="BOOKKEEPING") @@ -194,7 +194,7 @@ elseif ($modecompta=="BOOKKEEPING") $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->trans("Chartofaccounts")).')'; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -218,7 +218,7 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear; print '
'.$langs->trans("AccountingCategory").' 
'; - //print join(',',$fieldlist); - print ''; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + if ($context == 'add') + { + $fieldname='country_id'; + print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + } + else + { + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + } print '
'; print ''; -print_liste_field_titre("Groups", $_SERVER["PHP_SELF"], 's.nom, s.rowid','',$param,'',$sortfield,$sortorder); +print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 's.nom, s.rowid','',$param,'',$sortfield,$sortorder,'width200 '); print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 8bf7a1faaea..40ab4f9e752 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -129,7 +129,7 @@ if ($modecompta == 'CREANCES-DETTES') $description.='
'.$langs->trans("RulesResultDue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.="
".$langs->trans("DepositsAreNotIncluded"); else $description.="
".$langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="RECETTES-DEPENSES") { @@ -141,7 +141,7 @@ else if ($modecompta=="RECETTES-DEPENSES") { $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesAmountWithTaxIncluded"); $description.='
'.$langs->trans("RulesResultInOut"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="BOOKKEEPING") @@ -154,7 +154,7 @@ else if ($modecompta=="BOOKKEEPING") $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesAmountOnInOutBookkeepingRecord"); $description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("Chartofaccounts")).')'; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -806,7 +806,7 @@ elseif ($modecompta == 'BOOKKEEPING') { /* - * Donation get dunning paiement + * Request in mode BOOKKEEPING */ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) @@ -830,7 +830,7 @@ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) //print $sql; - dol_syslog("get donation payments"); + dol_syslog("get bookkeeping record"); $result=$db->query($sql); if ($result) { diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 31d56074148..3a8752219f9 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; -$langs->loadLangs(array('compta','bills','donation','salaries')); +$langs->loadLangs(array('compta','bills','donation','salaries','accountancy')); $error = 0; @@ -173,7 +173,7 @@ if ($modecompta=="CREANCES-DETTES") $description=$langs->trans("RulesResultDue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="RECETTES-DEPENSES") { @@ -185,7 +185,7 @@ else if ($modecompta=="RECETTES-DEPENSES") { $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(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="BOOKKEEPING") @@ -203,7 +203,7 @@ else if ($modecompta=="BOOKKEEPING") $description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory")).')'; //if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); //else $description.= $langs->trans("DepositsAreIncluded"); - $builddate = time(); + $builddate=dol_now(); } report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode); @@ -223,7 +223,7 @@ print '
'; print ''; print ''; -print ''; +print ''; print ''; foreach($months as $k => $v){ print ''; @@ -262,8 +262,11 @@ else if ($modecompta=="BOOKKEEPING") print ""; // Year NP - //print ''; - print ''; + print ''; $vars = array(); @@ -338,7 +341,9 @@ else if ($modecompta=="BOOKKEEPING") print ""; // Column group - print ''; - print ''; + print ''; + print '     ' . length_accountg($cpt['account_number']) . ''; print ''; print ''; print ''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 70293076fd8..f367f8ee436 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -165,7 +165,7 @@ if ($modecompta=="CREANCES-DETTES") { $description.= $langs->trans("DepositsAreIncluded"); } - $builddate=time(); + $builddate=dol_now(); } else { $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; @@ -175,7 +175,7 @@ if ($modecompta=="CREANCES-DETTES") { $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); } report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 37d9119685b..4904f1ee5ca 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -143,7 +143,7 @@ if ($modecompta=="CREANCES-DETTES") { $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else { $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); @@ -153,7 +153,7 @@ if ($modecompta=="CREANCES-DETTES") { //$periodlink="".img_previous()."".img_next().""; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } $moreparam=array(); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 191a6f48284..f59b6fc454f 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -173,7 +173,7 @@ if ($modecompta=="CREANCES-DETTES") $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else { $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); @@ -183,7 +183,7 @@ if ($modecompta=="CREANCES-DETTES") //$periodlink=''.img_previous().''.img_next().''; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index a6e8064f1a9..335cf581740 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -118,7 +118,7 @@ if ($modecompta=="CREANCES-DETTES") $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="RECETTES-DEPENSES") @@ -131,7 +131,7 @@ else if ($modecompta=="RECETTES-DEPENSES") $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="BOOKKEEPING") @@ -145,7 +145,7 @@ else if ($modecompta=="BOOKKEEPING") $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index b41d23303cf..ae6b178f8dd 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -160,7 +160,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services . $langs->trans('AddExtraReport') . '' . '
'; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); @@ -204,7 +204,7 @@ if ($modetax==0) { // Invoice for goods, payment for services . $langs->trans('AddExtraReport') . '' . '
'; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index a92e79b81a3..bb42298f577 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -152,7 +152,7 @@ if ($modetax==1) // Calculate on invoice for goods and services if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); else $description.='
'.$langs->trans("DepositsAreIncluded"); $description.=$fsearch; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); // Customers invoices @@ -192,7 +192,7 @@ if ($modetax==0) // Invoice for goods, payment for services //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); // Customers invoices diff --git a/htdocs/compta/tva/quarter_report.php b/htdocs/compta/tva/quarter_report.php index 2f35e5f10ba..209e38e2a53 100644 --- a/htdocs/compta/tva/quarter_report.php +++ b/htdocs/compta/tva/quarter_report.php @@ -174,7 +174,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services $description.='
'.$langs->trans("DepositsAreIncluded"); } $description.=$fsearch; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); @@ -224,7 +224,7 @@ if ($modetax==0) { // Invoice for goods, payment for services //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; - $builddate=time(); + $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); $elementcust=$langs->trans("CustomersInvoices"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9b643efa086..8443e077b30 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3316,10 +3316,10 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar * @param string $field Field to use for new sorting. Empty if this field is not sortable. * @param string $begin ("" by defaut) * @param string $moreparam Add more parameters on sort url links ("" by default) - * @param string $moreattrib Add more attributes on th ("" by defaut). To add more css class, use param $prefix. + * @param string $moreattrib Add more attributes on th ("" by defaut, example: 'align="center"'). To add more css class, use param $prefix. * @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id') * @param string $sortorder Current sort order (Ex: 'asc,desc') - * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. + * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '. * @param string $disablesortlink 1=Disable sort link * @param string $tooltip Tooltip * @return string @@ -3342,7 +3342,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $field1=trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1); - // If field is used as sort criteria we use a specific css class liste_titre_sel // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./","",$field1))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>'; diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 1b80a4bc2ec..b84b8d77e47 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -106,7 +106,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat print ''; if (! $exportlink) print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 1362fd71b81..7712386d30a 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -31,8 +31,6 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account JournalizationInLedgerStatus=Status of journalization AlreadyInGeneralLedger=Already journalized in ledgers NotYetInGeneralLedger=Not yet journalized in ledgers -PreviousYear=Previous year -SelectedPeriod=Selected period GroupIsEmptyCheckSetup=Group is empty, check setup of the accounting group DetailByAccount=Show detail by account @@ -152,7 +150,7 @@ Sens=Sens Codejournal=Journal NumPiece=Piece number TransactionNumShort=Num. transaction -AccountingCategory=Accounting account groups +AccountingCategory=Personalized groups GroupByAccountAccounting=Group by accounting account AccountingAccountGroupsDesc=You can define here some groups of accounting account. It will be used in the report %s to show your income/expense with data grouped according to these groups. ByAccounts=By accounts @@ -263,7 +261,7 @@ OptionModeProductSellDesc=Show all products with accounting account for sales. OptionModeProductBuyDesc=Show all products with accounting account for purchases. CleanFixHistory=Remove accountancy code from lines that not exists into charts of account CleanHistory=Reset all bindings for selected year - +PredefinedGroups=Predefined groups WithoutValidAccount=Without valid dedicated account WithValidAccount=With valid dedicated account ValueNotIntoChartOfAccount=This value of accounting account does not exist into chart of account @@ -282,4 +280,4 @@ NoJournalDefined=No journal defined Binded=Lines bound ToBind=Lines to bind -WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. It will be replaced by a more complete report in a next version. +WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate. diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 89b6f045e4e..5369f0d4451 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -883,7 +883,7 @@ DictionaryStaff=Staff DictionaryAvailability=Delivery delay DictionaryOrderMethods=Ordering methods DictionarySource=Origin of proposals/orders -DictionaryAccountancyCategory=Accounting account groups +DictionaryAccountancyCategory=Personalized groups DictionaryAccountancysystem=Models for chart of accounts DictionaryAccountancyJournal=Accounting journals DictionaryEMailTemplates=Emails templates diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 8cc98f82def..521618fcd65 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -147,8 +147,8 @@ AnnualByCompanies=Income / Expenses, By predefined groups of account AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode %sClaims-Debts%s said Commitment accounting. AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, 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 +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. @@ -157,7 +157,7 @@ RulesCAIn=- It includes all the effective payments of invoices received from cli RulesAmountOnInOutBookkeepingRecord=It includes record in your Ledger with accounting accounts that has the group "EXPENSE/PRODUCT|SERVICE" or "INCOME/PRODUCT|SERVICE" RulesResultBookkeepingPredefined=It includes record in your Ledger with accounting accounts that has the group "EXPENSE/PRODUCT|SERVICE" or "INCOME/PRODUCT|SERVICE" RulesResultBookkeepingPersonalized=It show record in your Ledger with accounting accounts grouped by personalized groups -SeePageForSetup=See menu %s for setup. +SeePageForSetup=See menu %s for setup DepositsAreNotIncluded=- Down payment invoices are nor included DepositsAreIncluded=- Down payment invoices are included LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2acced5495c..9b9c92636d5 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -129,6 +129,8 @@ Never=Never Under=under Period=Period PeriodEndDate=End date for period +SelectedPeriod=Selected period +PreviousPeriod=Previous period Activate=Activate Activated=Activated Closed=Closed diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index cfc43113eda..e5ba6bad702 100755 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -104,7 +104,7 @@ $exportlink = ''; $nom = $langs->trans("ReportThirdParty"); $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); $description = $langs->trans("DescThirdPartyReport"); -$builddate = time(); +$builddate=dol_now(); $moreparam=array('action' => ''); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam); From f23a681dc0895b14b38b149381854cd1902b2691 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2017 10:16:08 +0200 Subject: [PATCH 6/6] Clean code --- htdocs/accountancy/admin/categories_list.php | 7 +-- htdocs/compta/journal/purchasesjournal.php | 3 +- htdocs/compta/journal/sellsjournal.php | 3 +- htdocs/compta/localtax/clients.php | 2 +- htdocs/compta/localtax/quadri_detail.php | 2 +- htdocs/compta/resultat/clientfourn.php | 3 +- htdocs/compta/resultat/index.php | 3 +- htdocs/compta/resultat/result.php | 13 +++-- htdocs/compta/tva/clients.php | 2 +- htdocs/compta/tva/quadri_detail.php | 2 +- htdocs/compta/tva/quarter_report.php | 2 +- htdocs/core/lib/report.lib.php | 53 +++++++++++--------- htdocs/langs/en_US/accountancy.lang | 2 +- 13 files changed, 46 insertions(+), 51 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 6cdb19b3fb5..218af698be1 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -232,14 +232,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i=0; foreach ($listfieldinsert as $f => $value) { - if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); - } - else if ($value == 'entity') { + if ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql.=","; - if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' + if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = '' else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; $i++; } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index efd5abc5a82..5934ca71afb 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -85,7 +85,6 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $name=$langs->trans("PurchasesJournal"); -$namelink=''; $periodlink=''; $exportlink=''; $builddate=dol_now(); @@ -94,7 +93,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $ 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($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($name,'',$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 cc5b7472d88..f4b027b5016 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -89,7 +89,6 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $nom=$langs->trans("SellsJournal"); -$namelink=''; $periodlink=''; $exportlink=''; $builddate=dol_now(); @@ -97,7 +96,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($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $idpays = $p[0]; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index c5226aa3055..70d52c3d9d3 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($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 0053a152633..5e18c786c18 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($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); if($local==1){ diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 05290fee1e9..4c5be71ff88 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -147,7 +147,6 @@ llxHeader(); $form=new Form($db); -$namelink=''; $periodlink=''; $exportlink=''; @@ -200,7 +199,7 @@ elseif ($modecompta=="BOOKKEEPING") $hselected = 'report'; -report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 40ab4f9e752..0e058513571 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -113,7 +113,6 @@ llxHeader(); $form=new Form($db); -$namelink=''; $exportlink=''; // Affiche en-tete du rapport @@ -160,7 +159,7 @@ else if ($modecompta=="BOOKKEEPING") $hselected='report'; -report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 3a8752219f9..b59466e5239 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -194,7 +194,6 @@ else if ($modecompta=="BOOKKEEPING") $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("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0); $periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ; @@ -206,7 +205,7 @@ else if ($modecompta=="BOOKKEEPING") $builddate=dol_now(); } -report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode); +report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode); if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') @@ -259,10 +258,10 @@ else if ($modecompta=="BOOKKEEPING") $formula = $cat['formula']; - print "
"; + print ''; // Year NP - print ''; + print ''; // Year N $code = $cat['code']; // code of categorie ('VTE', 'MAR', ...) @@ -301,7 +300,7 @@ else if ($modecompta=="BOOKKEEPING") //$r = $AccCat->calculate($result); $r = dol_eval($result, 1); - print ''; + print ''; $sommes[$code]['N'] += $r; // Detail by month @@ -315,7 +314,7 @@ else if ($modecompta=="BOOKKEEPING") //$r = $AccCat->calculate($result); $r = dol_eval($result, 1); - print ''; + print ''; $sommes[$code]['M'][$k] += $r; } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index ae6b178f8dd..276f801d05b 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,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index bb42298f577..c622881d273 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; } -report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); diff --git a/htdocs/compta/tva/quarter_report.php b/htdocs/compta/tva/quarter_report.php index 209e38e2a53..4c054923837 100644 --- a/htdocs/compta/tva/quarter_report.php +++ b/htdocs/compta/tva/quarter_report.php @@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services $vatsup.=' ('.$langs->trans("ToGetBack").')'; } } -report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); +report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index b84b8d77e47..475fbaa48d5 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -24,10 +24,10 @@ /** - * Show header of a VAT report + * Show header of a report * - * @param string $nom Name of report - * @param string $variante Link for alternate report + * @param string $reportname Name of report + * @param string $notused Not used * @param string $period Period of report * @param string $periodlink Link to switch period * @param string $description Description @@ -38,13 +38,13 @@ * @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='') +function report_header($reportname,$notused,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='') { global $langs; if (empty($hselected)) $hselected='report'; - print "\n\n\n"; + print "\n\n\n"; if(! empty($varlink)) $varlink = '?'.$varlink; @@ -53,23 +53,25 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat $head[$h][1] = $langs->trans("Report"); $head[$h][2] = 'report'; + print ''; + dol_fiche_head($head, 'report'); - print ''; foreach($moreparam as $key => $value) { print ''; } print '
'.$langs->trans("AccountingCategory").''.$langs->trans("PreviousYear").''.$langs->trans("PreviousPeriod").''.$langs->trans("SelectedPeriod").''.$langs->trans($v).'
' . $cat['label'] . '' . $cat['label'] . ''; + print $cat['code']; + print ''; + print $cat['label']; + print '
'; + print ''; + print $cat['code']; + print ''; print $cat['label']; if (count($cpts) > 0) { @@ -429,7 +434,8 @@ else if ($modecompta=="BOOKKEEPING") $resultN=$totPerAccount[$cpt['account_number']]['N']; print '
    ' . length_accountg($cpt['account_number']) . '' . $cpt['name_cpt'] . '' . price($resultNP) . '' . price($resultN) . ' '.$langs->trans("GeneratedOn").''; else print ''; - print dol_print_date($builddate); + print dol_print_date($builddate, 'dayhour'); if ($exportlink) print ''.$langs->trans("Export").''.$exportlink; print '
'; + print ''; print $cat['code']; print ''; print $cat['label']; @@ -283,7 +282,7 @@ else if ($modecompta=="BOOKKEEPING") $r = dol_eval($result, 1); //var_dump($r); - print '' . price($r) . '' . price($r) . '' . price($r) . '' . price($r) . '' . price($r) . '' . price($r) . '
'; + $variante = ($periodlink || $exportlink); + // Ligne de titre print ''; print ''; - if (! $variantexxx) print ''; + if ($variante) print ''; print ''; // Calculation mode @@ -77,10 +79,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat { print ''; print ''; - if (! $variante) print ''; print ''; print ''; } @@ -88,35 +89,37 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat // Ligne de la periode d'analyse du rapport print ''; print ''; - if (! $periodlink) print ''; print ''; print ''; // Ligne de description print ''; print ''; - print ''; + print ''; + if ($variante) print ''; print ''; // Ligne d'export print ''; print ''; - if (! $exportlink) print ''; + print ''; + if ($variante) print ''; + print ''; print '
'.$langs->trans("ReportName").''; - else print ''; - print $nom; - if ($variantexxx) print ''.$variantexxx; + print ''; + print $reportname; print '
'.$langs->trans("CalculationMode").''; - else print ''; + print ''; print $calcmode; - if ($variante) print ''.$variante; + if ($variante) print '
'.$langs->trans("ReportPeriod").''; - else print ''; + print ''; if ($period) print $period; - if ($periodlink) print ''.$periodlink; + if ($variante) print ''.$periodlink.'
'.$langs->trans("ReportDescription").''.$description.''.$description.'
'.$langs->trans("GeneratedOn").''; - else print ''; + print ''; print dol_print_date($builddate, 'dayhour'); - if ($exportlink) print ''.$langs->trans("Export").''.$exportlink; - print '
'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'
'; - print '
'; - print ''; - dol_fiche_end(); - print "\n\n\n"; + print '
'; + + print ''; + print '
'; + + print "\n\n\n"; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 7712386d30a..0d4b95c319a 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -31,7 +31,7 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account JournalizationInLedgerStatus=Status of journalization AlreadyInGeneralLedger=Already journalized in ledgers NotYetInGeneralLedger=Not yet journalized in ledgers -GroupIsEmptyCheckSetup=Group is empty, check setup of the accounting group +GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group DetailByAccount=Show detail by account MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup