Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 13.0
Conflicts: htdocs/accountancy/bookkeeping/balance.php
This commit is contained in:
commit
057ed201a7
@ -238,18 +238,18 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
|
||||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Category
|
||||||
|
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
@ -300,18 +300,18 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
|
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Category
|
|
||||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Chart of accounts type
|
// Chart of accounts type
|
||||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Category
|
||||||
|
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|||||||
@ -78,7 +78,7 @@ $form = new Form($db);
|
|||||||
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
|
||||||
$sql .= $db->plimit(1);
|
$sql .= $db->plimit(1);
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
if ($res->num_rows > 0) {
|
if ($res->num_rows > 0) {
|
||||||
@ -242,10 +242,12 @@ if ($action != 'export_csv')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
|
||||||
|
|
||||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre" colspan="5">';
|
print '<td class="liste_titre" colspan="'.$colspan.'">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -261,7 +263,7 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||||
@ -278,22 +280,30 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
$accountingaccountstatic = new AccountingAccount($db);
|
$accountingaccountstatic = new AccountingAccount($db);
|
||||||
|
|
||||||
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
// TODO Debug - This feature is dangerous, it takes all the entries and adds all the accounts
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
// without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal.
|
||||||
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'";
|
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
|
||||||
$sql .= " 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();
|
||||||
for ($i = 0; $i < $nrows; $i++) {
|
for ($i = 0; $i < $nrows; $i++) {
|
||||||
$arr = $resql->fetch_array();
|
$arr = $resql->fetch_array();
|
||||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
$opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($object->lines as $line)
|
foreach ($object->lines as $line)
|
||||||
{
|
{
|
||||||
|
// reset before the fetch (in case of the fetch fails)
|
||||||
|
$accountingaccountstatic->id = 0;
|
||||||
|
$accountingaccountstatic->account_number = '';
|
||||||
|
|
||||||
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
|
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
|
||||||
if (!empty($accountingaccountstatic->account_number)) {
|
if (!empty($accountingaccountstatic->account_number)) {
|
||||||
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
|
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
|
||||||
@ -311,8 +321,8 @@ if ($action != 'export_csv')
|
|||||||
$root_account_description = $tmparrayforrootaccount['label'];
|
$root_account_description = $tmparrayforrootaccount['label'];
|
||||||
$root_account_number = $tmparrayforrootaccount['account_number'];
|
$root_account_number = $tmparrayforrootaccount['account_number'];
|
||||||
|
|
||||||
if (empty($accountingaccountstatic->account_number)) {
|
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
|
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($show_subgroup))
|
if (!empty($show_subgroup))
|
||||||
@ -322,17 +332,22 @@ if ($action != 'export_csv')
|
|||||||
// Show subtotal per accounting account
|
// Show subtotal per accounting account
|
||||||
if ($displayed_account != "") {
|
if ($displayed_account != "") {
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td class="right" colspan="2">'.$langs->trans("SubTotal").':</td>';
|
print '<td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
|
||||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||||
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_credit - $sous_total_debit)).'</td>';
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit)).'</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||||
|
}
|
||||||
print "<td></td>\n";
|
print "<td></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show first line of a break
|
// Show first line of a break
|
||||||
print '<tr class="trforbreak">';
|
print '<tr class="trforbreak">';
|
||||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account = $root_account_number;
|
$displayed_account = $root_account_number;
|
||||||
@ -344,10 +359,14 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$accounting_account.'</td>';
|
print '<td>'.$accounting_account.'</td>';
|
||||||
print '<td class="nowraponall right">'.price($opening_balance).'</td>';
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
||||||
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||||
|
}
|
||||||
print '<td class="center">'.$link;
|
print '<td class="center">'.$link;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -360,12 +379,28 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
if (!empty($show_subgroup))
|
if (!empty($show_subgroup))
|
||||||
{
|
{
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$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_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')).'</td>';
|
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||||
|
}
|
||||||
print "<td></td>\n";
|
print "<td></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')).'</td>';
|
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($total_debit).'</td>';
|
||||||
|
print '<td class="nowrap right">'.price($total_credit).'</td>';
|
||||||
|
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td class="nowrap right">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
|
||||||
|
}
|
||||||
print "<td></td>\n";
|
print "<td></td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -251,7 +251,7 @@ PaymentsNotLinkedToProduct=Payment not linked to any product / service
|
|||||||
OpeningBalance=Opening balance
|
OpeningBalance=Opening balance
|
||||||
ShowOpeningBalance=Show opening balance
|
ShowOpeningBalance=Show opening balance
|
||||||
HideOpeningBalance=Hide opening balance
|
HideOpeningBalance=Hide opening balance
|
||||||
ShowSubtotalByGroup=Show subtotal by group
|
ShowSubtotalByGroup=Show subtotal by level
|
||||||
|
|
||||||
Pcgtype=Group of account
|
Pcgtype=Group of account
|
||||||
PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report.
|
PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user