Merge pull request #11101 from aspangaro/9.0_lettering
FIX Massive debug in lettering function
This commit is contained in:
commit
e694d0b2c2
@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
|
||||
@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
@ -53,26 +54,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year", 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (! empty($lettering)) {
|
||||
$action = $lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_year = '';
|
||||
$search_doc_type = '';
|
||||
/*
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
}
|
||||
*/
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", 'int');
|
||||
@ -102,6 +108,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@ -111,9 +118,9 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@ -136,19 +143,17 @@ dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'n
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||
/*
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )";
|
||||
}
|
||||
*/
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -190,83 +195,110 @@ if ($resql) {
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
||||
//$letteringbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=lettering" value="lettering" name="lettering" id="lettering"><span class="valignmiddle">' . $langs->trans("Lettering") . '</span></a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "","",'','',"",$sortfield,$sortorder,'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="5"> </td>';
|
||||
print '<td align="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td align="right">' . price($obj->debit) . '</td>';
|
||||
print '<td align="right">' . price($obj->credit) . '</td>';
|
||||
print '<td align="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td align="center">' . $obj->code_journal . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td align="center">' . $obj->lettering_code . '</td>';
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td align="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td align="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettering">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
|
||||
@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
@ -53,27 +54,31 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "")
|
||||
$sortorder = "DESC";
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "bk.doc_date";
|
||||
|
||||
$search_year = GETPOST("search_year",'int');
|
||||
$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||
/*
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
//$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||
*/
|
||||
|
||||
$lettering = GETPOST('lettering', 'alpha');
|
||||
if (!empty($lettering)) {
|
||||
$action=$lettering;
|
||||
}
|
||||
|
||||
// Did we click on purge search criteria ?
|
||||
// All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha'))
|
||||
/*
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_year='';
|
||||
$search_doc_type='';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
//$search_doc_type='';
|
||||
$search_doc_ref='';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Security check
|
||||
@ -103,6 +108,7 @@ if ($action == 'lettering') {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $lettering->letteringThirdparty($socid);
|
||||
@ -112,7 +118,7 @@ if ($action == 'autolettrage') {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -143,10 +149,8 @@ $sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.l
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
|
||||
}
|
||||
|
||||
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
||||
@ -193,31 +197,51 @@ if ($resql) {
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>\';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
|
||||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Piece
|
||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
||||
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td class="right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td colspan="6"> </td>';
|
||||
print '<td align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("", "","",'','',"",$sortfield,$sortorder,'maxwidthsearch center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
@ -228,48 +252,53 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
} else {
|
||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td align="right">' . price($obj->debit) . '</td>';
|
||||
print '<td align="right">' . price($obj->credit) . '</td>';
|
||||
print '<td align="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td align="center">' . $obj->code_journal . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$obj->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $obj->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
|
||||
if (empty($obj->lettering_code)) {
|
||||
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
} else
|
||||
print '<td align="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a></td>' . "\n";
|
||||
} else {
|
||||
print '<td class="center">' . $obj->lettering_code . '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td align="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td align="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="5"></td>';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td align="right" colspan="4">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="' . $langs->trans('AccountancyLettering') . '" name="lettering" id="lettering">';
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print $letteringbutton;
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -66,13 +66,13 @@ class Lettering extends BookKeeping
|
||||
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE ( ";
|
||||
$sql .= " WHERE ( ";
|
||||
if (! empty($object->code_compta))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
if (! empty($object->code_compta_fournisseur))
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||
@ -128,15 +128,15 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND facf.entity = ".$conf->entity;
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
$sql .= ") ";
|
||||
|
||||
$resql2 = $this->db->query($sql);
|
||||
if ($resql2) {
|
||||
@ -253,7 +253,7 @@ class Lettering extends BookKeeping
|
||||
$error++;
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -161,6 +161,7 @@ LabelAccount=Label account
|
||||
LabelOperation=Label operation
|
||||
Sens=Sens
|
||||
LetteringCode=Lettering code
|
||||
Lettering=Lettering
|
||||
Codejournal=Journal
|
||||
NumPiece=Piece number
|
||||
TransactionNumShort=Num. transaction
|
||||
|
||||
Loading…
Reference in New Issue
Block a user