Debug accountancy module
This commit is contained in:
parent
ca46ff8eb5
commit
e74718827f
@ -301,9 +301,11 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
||||||
|
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr class="pair">';
|
print '<tr class="pair">';
|
||||||
print '<td width="25%">' . $langs->trans("NumMvts") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||||
print '<td>' . $book->piece_num . '</td>';
|
print '<td>' . $book->piece_num . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr class="impair">';
|
print '<tr class="impair">';
|
||||||
@ -323,14 +325,17 @@ if ($action == 'create') {
|
|||||||
print '<td>' . $book->doc_type . '</td>';
|
print '<td>' . $book->doc_type . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
$result = $book->fetch_all_per_mvt($piece_num);
|
$result = $book->fetch_all_per_mvt($piece_num);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ListeMvts"));
|
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||||
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
|
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
|
||||||
@ -424,7 +429,7 @@ if ($action == 'create') {
|
|||||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '"></td>';
|
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -98,7 +98,7 @@ $formother = new FormOther($db);
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
if (! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction'])) {
|
if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction'])) {
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||||
}
|
}
|
||||||
@ -268,6 +268,7 @@ if ($action == 'export_csv') {
|
|||||||
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||||
|
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -353,16 +354,20 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||||
|
|
||||||
print '<div class="tabsAction">' . "\n";
|
print '<div class="tabsAction">' . "\n";
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./listbyaccount.php">' . $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . strtolower($langs->trans("AccountAccounting")) . '</a></div>';
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" name="button_export_csv" href="'.$_SERVER["PHP_SELF"].'?action=export_csv'.($param?'&'.$param:'').'">' . $langs->trans("Export") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" name="button_export_csv" href="'.$_SERVER["PHP_SELF"].'?action=export_csv'.($param?'&'.$param:'').'">';
|
||||||
|
if (count($filter)) print $langs->trans("ExportFilteredList");
|
||||||
|
else print $langs->trans("ExportList");
|
||||||
|
print '</a></div>';
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
print ' <a href="./listbyaccount.php">' . $langs->trans("GroupByAccountAccounting") . '</a><br><br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
|
|||||||
@ -60,11 +60,23 @@ $search_mvt_label = GETPOST('search_mvt_label', 'alpha');
|
|||||||
$search_direction = GETPOST('search_direction', 'alpha');
|
$search_direction = GETPOST('search_direction', 'alpha');
|
||||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||||
|
|
||||||
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
// Load variable for pagination
|
||||||
if ($page == -1) { $page = 0 ; }
|
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
$offset = $limit * $page ;
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
|
$page = GETPOST('page','int');
|
||||||
|
if ($page < 0) { $page = 0; }
|
||||||
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
|
if ($sortfield == "") $sortfield = "t.rowid";
|
||||||
|
|
||||||
|
if (empty($search_date_start)) {
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||||
|
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
@ -73,18 +85,6 @@ $formother = new FormOther($db);
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
|
||||||
}
|
|
||||||
if ($sortorder == "")
|
|
||||||
$sortorder = "ASC";
|
|
||||||
if ($sortfield == "")
|
|
||||||
$sortfield = "t.rowid";
|
|
||||||
|
|
||||||
|
|
||||||
$options = '';
|
$options = '';
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
|
|
||||||
@ -223,12 +223,15 @@ print '<div class="tabsAction">' . "\n";
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
print ' <a href="./list.php">' . $langs->trans("ViewFlatList") . '</a><br><br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans("AccountAccounting") . '</td>';
|
print '<td>' . $langs->trans("AccountAccounting") . '</td>';
|
||||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||||
print '<td>' . $langs->trans("SuppliersInvoices") . ' / ' . $langs->trans("CustomersInvoices") . '</td>';
|
print_liste_field_titre($langs->trans("SuppliersInvoices") . ' / ' . $langs->trans("CustomersInvoices"));
|
||||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
@ -237,8 +240,9 @@ print "</tr>\n";
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
||||||
print '<td width >' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
|
print '<td>' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td></td>';
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
print $langs->trans('From') . ': ';
|
print $langs->trans('From') . ': ';
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -263,7 +267,7 @@ $total_debit = 0;
|
|||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
$sous_total_debit = 0;
|
$sous_total_debit = 0;
|
||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account_number = "";
|
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
foreach ( $object->lines as $line ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
@ -271,38 +275,47 @@ foreach ( $object->lines as $line ) {
|
|||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
// Permet d'afficher le compte comptable
|
$accountg = length_accountg($line->numero_compte);
|
||||||
if (length_accountg($line->numero_compte) != $displayed_account_number) {
|
//if (empty($accountg)) $accountg = '-';
|
||||||
|
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Is it a break ?
|
||||||
if ($displayed_account_number != "") {
|
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
||||||
print '<tr class="liste_total"><td align="right" colspan="4">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
|
||||||
print "<td> </td>\n";
|
// Affiche un Sous-Total par compte comptable
|
||||||
print '</tr>';
|
if (isset($displayed_account_number)) {
|
||||||
|
print '<tr class="liste_total"><td align="right" colspan="4">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
||||||
|
print "<td> </td>\n";
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the break account
|
||||||
|
$colspan = 9;
|
||||||
|
print "<tr>";
|
||||||
|
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||||
|
if (! empty($line->numero_compte) && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
|
||||||
|
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$displayed_account_number = $accountg;
|
||||||
|
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
||||||
|
$sous_total_debit = 0;
|
||||||
|
$sous_total_credit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche le compte comptable en début de ligne
|
print '<tr '. $bc[$var].'>';
|
||||||
print "<tr>";
|
|
||||||
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$displayed_account_number = length_accountg($line->numero_compte);
|
|
||||||
$sous_total_debit = 0;
|
|
||||||
$sous_total_credit = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr'. $bc[$var].'>';
|
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
print '<td align="right">'.$line->piece_num.'</td>';
|
||||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->doc_ref . '</a></td>';
|
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->doc_ref . '</a></td>';
|
||||||
|
|
||||||
// Affiche un lien vers la facture client/fournisseur
|
// Affiche un lien vers la facture client/fournisseur
|
||||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||||
if ($line->doc_type == 'supplier_invoice')
|
if ($line->doc_type == 'supplier_invoice')
|
||||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td><a href="/fourn/facture/list.php?search_ref_supplier=' . $doc_ref . '">' . $line->label_compte . '</a></td>' : '<td><a href="/fourn/facture/list.php?search_ref_supplier=' . $doc_ref . '">' . $line->label_compte . '</a><br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td><a href="/fourn/facture/list.php?search_ref_supplier=' . $doc_ref . '">' . $line->label_compte . '</a></td>' : '<td><a href="/fourn/facture/list.php?search_ref_supplier=' . $doc_ref . '">' . $line->label_compte . '</a><br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
||||||
elseif ($line->doc_type == 'customer_invoice')
|
elseif ($line->doc_type == 'customer_invoice')
|
||||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td><a href="/compta/facture/list.php?search_ref=' . $doc_ref . '">' . $line->label_compte . '</a></td>' : '<td><a href="/compta/facture/list.php?search_ref=' . $doc_ref . '">' . $line->label_compte . '</a><br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td><a href="/compta/facture/list.php?search_ref=' . $doc_ref . '">' . $line->label_compte . '</a></td>' : '<td><a href="/compta/facture/list.php?search_ref=' . $doc_ref . '">' . $line->label_compte . '</a><br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
||||||
else
|
else
|
||||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td>' . $line->label_compte . '</td>' : '<td>' . $line->label_compte . '<br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td>' . $line->label_compte . '</td>' : '<td>' . $line->label_compte . '<br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -197,7 +197,7 @@ print "<table class=\"noborder\" width=\"100%\">";
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
||||||
@ -269,10 +269,10 @@ $var = True;
|
|||||||
foreach ( $object->lines as $line ) {
|
foreach ( $object->lines as $line ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
print '<tr'. $bc[$var].'>';
|
print '<tr '. $bc[$var].'>';
|
||||||
print '<td>' . $line->piece_num . '</td>' . "\n";
|
print '<td>' . $line->piece_num . '</td>' . "\n";
|
||||||
print '<td>' . $line->doc_type . '</td>' . "\n";
|
print '<td>' . $line->doc_type . '</td>' . "\n";
|
||||||
print '<td>' . dol_print_date($line->doc_date) . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';
|
||||||
print '<td>' . $line->doc_ref . '</td>';
|
print '<td>' . $line->doc_ref . '</td>';
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
||||||
@ -289,4 +289,4 @@ print "</table>";
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -105,10 +105,9 @@ class BookKeeping extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Create object into database
|
* Create object into database
|
||||||
*
|
*
|
||||||
* @param User $user User that creates
|
* @param User $user User that creates
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
*
|
* @return int <0 if KO, Id of created object if OK
|
||||||
* @return int <0 if KO, Id of created object if OK
|
|
||||||
*/
|
*/
|
||||||
public function create(User $user, $notrigger = false) {
|
public function create(User $user, $notrigger = false) {
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
@ -161,6 +160,8 @@ class BookKeeping extends CommonObject
|
|||||||
if (isset($this->piece_num)) {
|
if (isset($this->piece_num)) {
|
||||||
$this->piece_num = trim($this->piece_num);
|
$this->piece_num = trim($this->piece_num);
|
||||||
}
|
}
|
||||||
|
if (empty($this->debit)) $this->debit = 0;
|
||||||
|
if (empty($this->credit)) $this->credit = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->numero_compte))
|
if (empty($this->numero_compte))
|
||||||
@ -321,10 +322,9 @@ class BookKeeping extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Create object into database
|
* Create object into database
|
||||||
*
|
*
|
||||||
* @param User $user User that creates
|
* @param User $user User that creates
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
*
|
* @return int <0 if KO, Id of created object if OK
|
||||||
* @return int <0 if KO, Id of created object if OK
|
|
||||||
*/
|
*/
|
||||||
public function createStd(User $user, $notrigger = false) {
|
public function createStd(User $user, $notrigger = false) {
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
@ -378,6 +378,8 @@ class BookKeeping extends CommonObject
|
|||||||
if (isset($this->piece_num)) {
|
if (isset($this->piece_num)) {
|
||||||
$this->piece_num = trim($this->piece_num);
|
$this->piece_num = trim($this->piece_num);
|
||||||
}
|
}
|
||||||
|
if (empty($this->debit)) $this->debit = 0;
|
||||||
|
if (empty($this->credit)) $this->credit = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -410,9 +412,9 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' ' . (! isset($this->code_tiers) ? 'NULL' : "'" . $this->db->escape($this->code_tiers) . "'") . ',';
|
$sql .= ' ' . (! isset($this->code_tiers) ? 'NULL' : "'" . $this->db->escape($this->code_tiers) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->numero_compte) ? "'NotDefined'" : "'" . $this->db->escape($this->numero_compte) . "'") . ',';
|
$sql .= ' ' . (! isset($this->numero_compte) ? "'NotDefined'" : "'" . $this->db->escape($this->numero_compte) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ',';
|
$sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->debit) ? 'NULL' : "'" . $this->debit . "'") . ',';
|
$sql .= ' ' . (! isset($this->debit) ? 'NULL' : $this->debit ). ',';
|
||||||
$sql .= ' ' . (! isset($this->credit) ? 'NULL' : "'" . $this->credit . "'") . ',';
|
$sql .= ' ' . (! isset($this->credit) ? 'NULL' : $this->credit ). ',';
|
||||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : "'" . $this->montant . "'") . ',';
|
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||||
$sql .= ' ' . $user->id . ',';
|
$sql .= ' ' . $user->id . ',';
|
||||||
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
|
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
|
||||||
@ -1060,8 +1062,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql = "DELETE";
|
$sql = "DELETE";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql.= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";
|
||||||
if ($delyear) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
||||||
if ($journal) $sql.= " AND code_journal = ".$journal;
|
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
|
|||||||
@ -407,9 +407,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->facnumber;
|
$bookkeeping->doc_ref = $objmid->facnumber;
|
||||||
}
|
}
|
||||||
// FIXME Should be
|
|
||||||
//$bookkeeping->code_tiers = $k;
|
|
||||||
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||||
@ -425,13 +422,10 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
||||||
}
|
}
|
||||||
// FIXME Should be
|
|
||||||
//$bookkeeping->code_tiers = $k;
|
|
||||||
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else {
|
} else {
|
||||||
// FIXME Should be a temporary account
|
// FIXME Should be a temporary account ???
|
||||||
$bookkeeping->doc_ref = $k;
|
$bookkeeping->doc_ref = $k;
|
||||||
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->numero_compte = 'CodeNotDef';
|
$bookkeeping->numero_compte = 'CodeNotDef';
|
||||||
@ -666,14 +660,17 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
|
console.log("Set value into form and submit");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
|
console.log("Set value into form and submit");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
@ -758,12 +755,12 @@ if (empty($action) || $action == 'view') {
|
|||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
print "<td><!-- Bank --></td>";
|
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
@ -785,12 +782,12 @@ if (empty($action) || $action == 'view') {
|
|||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($k != 'type') {
|
if ($k != 'type') {
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
print "<td><!-- Thirdparty --></td>";
|
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
@ -806,11 +803,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
} else {
|
} else {
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
print "<td><!-- Wait --></td>";
|
print "<td><!-- Wait bank.rowid=".$key." --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) .
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) .
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $reflabel . "</td>";
|
print "<td>" . $reflabel . "</td>";
|
||||||
print "<td> </td>";
|
print "<td> </td>";
|
||||||
|
|||||||
@ -529,7 +529,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
@ -576,7 +576,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -544,7 +544,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
@ -570,7 +570,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
@ -593,7 +593,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if ($accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,9 @@ Labelcompte=Label account
|
|||||||
Sens=Sens
|
Sens=Sens
|
||||||
Codejournal=Journal
|
Codejournal=Journal
|
||||||
NumPiece=Piece number
|
NumPiece=Piece number
|
||||||
|
TransactionNumShort=Num. transaction
|
||||||
AccountingCategory=Accounting category
|
AccountingCategory=Accounting category
|
||||||
|
GroupByAccountAccounting=Group by accounting account
|
||||||
NotMatch=Not Set
|
NotMatch=Not Set
|
||||||
DeleteMvt=Delete general ledger lines
|
DeleteMvt=Delete general ledger lines
|
||||||
DelYear=Year to delete
|
DelYear=Year to delete
|
||||||
|
|||||||
@ -730,8 +730,12 @@ BackOffice=Back office
|
|||||||
View=View
|
View=View
|
||||||
Export=Export
|
Export=Export
|
||||||
Exports=Exports
|
Exports=Exports
|
||||||
|
ExportFilteredList=Export filtered list
|
||||||
|
ExportList=Export list
|
||||||
Miscellaneous=Miscellaneous
|
Miscellaneous=Miscellaneous
|
||||||
Calendar=Calendar
|
Calendar=Calendar
|
||||||
|
GroupBy=Group by...
|
||||||
|
ViewFlatList=View flat list
|
||||||
# Week day
|
# Week day
|
||||||
Monday=Monday
|
Monday=Monday
|
||||||
Tuesday=Tuesday
|
Tuesday=Tuesday
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user