Merge pull request #14706 from aspangaro/12.0p9
FIX - Accountancy balance Error SQL on entity
This commit is contained in:
commit
ec13d3811e
@ -267,8 +267,12 @@ if ($action != 'export_csv')
|
|||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account = "";
|
$displayed_account = "";
|
||||||
|
|
||||||
$sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity;
|
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
||||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
||||||
|
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features
|
||||||
|
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'";
|
||||||
|
$sql .= " GROUP BY t.numero_compte";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nrows = $resql->num_rows;
|
$nrows = $resql->num_rows;
|
||||||
$opening_balances = array();
|
$opening_balances = array();
|
||||||
@ -289,10 +293,10 @@ if ($action != 'export_csv')
|
|||||||
}
|
}
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Permet d'afficher le compte comptable
|
// Display the accounting account
|
||||||
if (empty($displayed_account) || $root_account_description != $displayed_account)
|
if (empty($displayed_account) || $root_account_description != $displayed_account)
|
||||||
{
|
{
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Display a sub-total per account
|
||||||
if ($displayed_account != "") {
|
if ($displayed_account != "") {
|
||||||
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
|
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
@ -321,7 +325,7 @@ if ($action != 'export_csv')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Comptabilise le sous-total
|
// Records the sub-total
|
||||||
$sous_total_debit += $line->debit;
|
$sous_total_debit += $line->debit;
|
||||||
$sous_total_credit += $line->credit;
|
$sous_total_credit += $line->credit;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user