mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
fix missing test on method result
This commit is contained in:
@@ -288,7 +288,9 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
$j=1;
|
||||
$sommes = array();
|
||||
$totPerAccount = array();
|
||||
|
||||
if (!is_array($cats) && $cats<0) {
|
||||
setEventMessages(null,$AccCat->errors,'errors');
|
||||
} elseif (is_array($cats) && count($cats)>0) {
|
||||
foreach ($cats as $cat) // Loop on each group
|
||||
{
|
||||
if (!empty($cat['category_type'])) // category calculed
|
||||
@@ -343,10 +345,8 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
$sommes[$code]['N'] += $r;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) >= $date_startmonth)
|
||||
{
|
||||
foreach ($months as $k => $v) {
|
||||
if (($k + 1) >= $date_startmonth) {
|
||||
foreach ($sommes as $code => $det) {
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
@@ -359,10 +359,8 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
$sommes[$code]['M'][$k] += $r;
|
||||
}
|
||||
}
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) < $date_startmonth)
|
||||
{
|
||||
foreach ($months as $k => $v) {
|
||||
if (($k + 1) < $date_startmonth) {
|
||||
foreach ($sommes as $code => $det) {
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
@@ -379,8 +377,7 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
print "</tr>\n";
|
||||
|
||||
//var_dump($sommes);
|
||||
}
|
||||
else // normal category
|
||||
} else // normal category
|
||||
{
|
||||
$code = $cat['code']; // Category code we process
|
||||
|
||||
@@ -388,8 +385,7 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
$totCat['NP'] = 0;
|
||||
$totCat['N'] = 0;
|
||||
$totCat['M'] = array();
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
foreach ($months as $k => $v) {
|
||||
$totCat['M'][$k] = 0;
|
||||
}
|
||||
|
||||
@@ -403,8 +399,7 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
}
|
||||
|
||||
// N-1
|
||||
if (! empty($arrayofaccountforfilter))
|
||||
{
|
||||
if (!empty($arrayofaccountforfilter)) {
|
||||
$return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc'] ? $cat['dc'] : 0);
|
||||
|
||||
if ($return < 0) {
|
||||
@@ -431,11 +426,11 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
|
||||
// Each month
|
||||
$resultN = 0;
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
foreach ($months as $k => $v) {
|
||||
$monthtoprocess = $k + 1; // ($k+1) is month 1, 2, ..., 12
|
||||
$yeartoprocess = $start_year;
|
||||
if (($k+1) < $start_month) $yeartoprocess++;
|
||||
if (($k + 1) < $start_month)
|
||||
$yeartoprocess++;
|
||||
|
||||
//var_dump($monthtoprocess.'_'.$yeartoprocess);
|
||||
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc'] ? $cat['dc'] : 0, 'nofilter', $monthtoprocess, $yeartoprocess);
|
||||
@@ -473,22 +468,20 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
if (count($cpts) > 0) // Show example of 5 first accounting accounts
|
||||
{
|
||||
$i = 0;
|
||||
foreach($cpts as $cpt)
|
||||
{
|
||||
if ($i > 5)
|
||||
{
|
||||
foreach ($cpts as $cpt) {
|
||||
if ($i > 5) {
|
||||
print '...)';
|
||||
break;
|
||||
}
|
||||
if ($i > 0) print ', ';
|
||||
if ($i > 0)
|
||||
print ', ';
|
||||
else print ' (';
|
||||
print $cpt['account_number'];
|
||||
$i++;
|
||||
}
|
||||
if ($i <= 5) print ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($i <= 5)
|
||||
print ')';
|
||||
} else {
|
||||
print ' - <span class="warning">' . $langs->trans("GroupIsEmptyCheckSetup") . '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
@@ -498,24 +491,23 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
|
||||
// Each month
|
||||
foreach ($totCat['M'] as $k => $v) {
|
||||
if (($k+1) >= $date_startmonth) print '<td class="right">' . price($v) . '</td>';
|
||||
if (($k + 1) >= $date_startmonth)
|
||||
print '<td class="right">' . price($v) . '</td>';
|
||||
}
|
||||
foreach ($totCat['M'] as $k => $v) {
|
||||
if (($k+1) < $date_startmonth) print '<td class="right">' . price($v) . '</td>';
|
||||
if (($k + 1) < $date_startmonth)
|
||||
print '<td class="right">' . price($v) . '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Loop on detail of all accounts to output the detail
|
||||
if ($showaccountdetail != 'no')
|
||||
{
|
||||
foreach($cpts as $i => $cpt)
|
||||
{
|
||||
if ($showaccountdetail != 'no') {
|
||||
foreach ($cpts as $i => $cpt) {
|
||||
$resultNP = $totPerAccount[$cpt['account_number']]['NP'];
|
||||
$resultN = $totPerAccount[$cpt['account_number']]['N'];
|
||||
|
||||
if ($showaccountdetail == 'all' || $resultN > 0)
|
||||
{
|
||||
if ($showaccountdetail == 'all' || $resultN > 0) {
|
||||
print '<tr>';
|
||||
print '<td></td>';
|
||||
print '<td class="tdoverflowmax200">';
|
||||
@@ -527,18 +519,14 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
print '<td class="right">' . price($resultN) . '</td>';
|
||||
|
||||
// Make one call for each month
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) >= $date_startmonth)
|
||||
{
|
||||
foreach ($months as $k => $v) {
|
||||
if (($k + 1) >= $date_startmonth) {
|
||||
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td class="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
}
|
||||
foreach($months as $k => $v)
|
||||
{
|
||||
if (($k+1) < $date_startmonth)
|
||||
{
|
||||
foreach ($months as $k => $v) {
|
||||
if (($k + 1) < $date_startmonth) {
|
||||
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td class="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
@@ -550,6 +538,7 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
Reference in New Issue
Block a user