NEW The "Show detail by account" accepts 3 values: yes, no, if non zero
This commit is contained in:
parent
627dd15b44
commit
d0a0bf57b6
@ -157,7 +157,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("fiscalmonthstart",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
@ -547,8 +547,8 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="fiscalmonthstart">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '</td></tr>';
|
||||
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'SOCIETE_FISCAL_MONTH_START',0,1) . '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -189,7 +189,8 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$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);
|
||||
$arraylist=array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$period.=' '.$langs->trans("DetailByAccount").' '. $form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year']-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year']+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$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")).')';
|
||||
@ -291,7 +292,7 @@ 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')
|
||||
if ($showaccountdetail != 'no')
|
||||
{
|
||||
$tmppredefinedgroupwhere="pcg_type = '".$db->escape($objp->pcg_type)."' AND pcg_subtype = '".$db->escape($objp->pcg_subtype)."'";
|
||||
$tmppredefinedgroupwhere.= " AND fk_pcg_version = '".$charofaccountstring."'";
|
||||
@ -310,7 +311,8 @@ if ($modecompta == 'BOOKKEEPING')
|
||||
$resultN=$AccCat->sdc;
|
||||
}
|
||||
|
||||
if ($resultN > 0)
|
||||
|
||||
if ($showaccountdetail == 'all' || $resultN > 0)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td></td>';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016-2017 Jamal Elbaz <jamelbaz@gmail.com>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2018 Laurent Destailleur <eldy@destailleur.fr>
|
||||
*
|
||||
* 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
|
||||
@ -56,12 +57,12 @@ $nbofyear=1;
|
||||
$year=GETPOST('year','int');
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$month_current = strftime("%m",dol_now());
|
||||
$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());
|
||||
$month_current = strftime("%m", dol_now());
|
||||
$year_start = $year - ($nbofyear - 1);
|
||||
}
|
||||
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
@ -76,6 +77,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
// 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);
|
||||
$date_startmonth = $month_start;
|
||||
if (! GETPOST('month'))
|
||||
{
|
||||
if (! GETPOST("year") && $month_start > $month_current)
|
||||
@ -195,7 +197,8 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$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);
|
||||
$arraylist=array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$period.=' '.$langs->trans("DetailByAccount").' '. $form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
|
||||
$periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ;
|
||||
$exportlink = '';
|
||||
$description=$langs->trans("RulesResultBookkeepingPersonalized").
|
||||
@ -225,7 +228,16 @@ print '<th class="liste_titre"></th>';
|
||||
print '<th class="liste_titre" align="right">'.$langs->trans("PreviousPeriod").'</th>';
|
||||
print '<th class="liste_titre" align="right">'.$langs->trans("SelectedPeriod").'</th>';
|
||||
foreach($months as $k => $v){
|
||||
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>';
|
||||
if (($k+1) >= $date_startmonth)
|
||||
{
|
||||
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>';
|
||||
}
|
||||
}
|
||||
foreach($months as $k => $v){
|
||||
if (($k+1) < $date_startmonth)
|
||||
{
|
||||
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@ -306,16 +318,35 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
// Detail by month
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
if (($k+1) >= $date_startmonth)
|
||||
{
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1);
|
||||
|
||||
print '<td class="liste_total right">' . price($r) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $r;
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
}
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) < $date_startmonth)
|
||||
{
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1);
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1);
|
||||
|
||||
print '<td class="liste_total right">' . price($r) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $r;
|
||||
print '<td class="liste_total right">' . price($r) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -418,38 +449,57 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
print '<td align="right">' . price($totCat['NP']) . '</td>';
|
||||
print '<td align="right">' . price($totCat['N']) . '</td>';
|
||||
|
||||
// Each month
|
||||
foreach($totCat['M'] as $k => $v){
|
||||
print '<td align="right">' . price($v) . '</td>';
|
||||
if (($k+1) >= $date_startmonth) print '<td align="right">' . price($v) . '</td>';
|
||||
}
|
||||
foreach($totCat['M'] as $k => $v){
|
||||
if (($k+1) < $date_startmonth) print '<td align="right">' . price($v) . '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Loop on detail of all accounts
|
||||
// This make 14 calls for each detail of account (NP, N and month m)
|
||||
if ($showaccountdetail == 'yes')
|
||||
if ($showaccountdetail != 'no')
|
||||
{
|
||||
foreach($cpts as $i => $cpt)
|
||||
{
|
||||
$resultNP=$totPerAccount[$cpt['account_number']]['NP'];
|
||||
$resultN=$totPerAccount[$cpt['account_number']]['N'];
|
||||
|
||||
print '<tr>';
|
||||
print '<td></td>';
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print ' ' . length_accountg($cpt['account_number']);
|
||||
print ' - ';
|
||||
print $cpt['account_label'];
|
||||
print '</td>';
|
||||
print '<td align="right">' . price($resultNP) . '</td>';
|
||||
print '<td align="right">' . price($resultN) . '</td>';
|
||||
|
||||
// Make one call for each month
|
||||
foreach($months as $k => $v)
|
||||
if ($showaccountdetail == 'all' || $resultN > 0)
|
||||
{
|
||||
$resultM=$totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td></td>';
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print ' ' . length_accountg($cpt['account_number']);
|
||||
print ' - ';
|
||||
print $cpt['account_label'];
|
||||
print '</td>';
|
||||
print '<td align="right">' . price($resultNP) . '</td>';
|
||||
print '<td align="right">' . price($resultN) . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
// Make one call for each month
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) >= $date_startmonth)
|
||||
{
|
||||
$resultM=$totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
}
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) < $date_startmonth)
|
||||
{
|
||||
$resultM=$totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ AlreadyInGeneralLedger=Already journalized in ledgers
|
||||
NotYetInGeneralLedger=Not yet journalized in ledgers
|
||||
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
|
||||
DetailByAccount=Show detail by account
|
||||
AccountWithNonZeroValues=Accounts with non zero values
|
||||
|
||||
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
|
||||
MainAccountForSuppliersNotDefined=Main accounting account for suppliers not defined in setup
|
||||
|
||||
Loading…
Reference in New Issue
Block a user