Debug Lettering

This commit is contained in:
Alexandre SPANGARO
2018-10-20 08:26:30 +02:00
parent d3856d9289
commit 5cbcef4465
4 changed files with 78 additions and 97 deletions

View File

@@ -23,10 +23,9 @@
/**
* \file accountancy/bookkeeping/thirdparty_lettering_customer.php
* \ingroup Advanced accountancy
* \brief Onglet de gestion de parametrages des ventilations
* \brief Tab to manage customer lettering
*/
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';
@@ -34,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta"));
$langs->loadLangs(array("compta","accountancy"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
@@ -79,6 +78,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$socid = GETPOST("socid", 'int');
// if ($user->societe_id) $socid=$user->societe_id;
$lettering = new lettering($db);
$object = new Societe($db);
$object->id = $socid;
$result = $object->fetch($socid);
@@ -87,39 +87,40 @@ if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
$form = new Form($db);
$BookKeeping = new lettering($db);
$formaccounting = new FormAccounting($db);
/*
* Action
*/
if ($action == 'lettering') {
$result = $BookKeeping->updateLettrage($toselect);
$result = $lettering->updateLettrage($toselect);
if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors');
setEventMessages('', $lettering->errors, 'errors');
$error ++;
}
}
if ($action == 'autolettrage') {
$result = $BookKeeping->lettering_thirdparty($socid);
$result = $lettering->lettering_thirdparty($socid);
if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors');
setEventMessages('', $lettering->errors, 'errors');
$error ++;
}
}
llxHeader('', 'Compta - Grand Livre');
/*
* Affichage onglets
* View
*/
$form = new Form($db);
$formaccounting = new FormAccounting($db);
$title=$object->name." - ".$langs->trans('TabLetteringCustomer');
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
$head = societe_prepare_head($object);
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
@@ -192,21 +193,19 @@ if ($resql) {
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("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte", "", $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("Amount", $_SERVER["PHP_SELF"], "bk.montant", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens", "", $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("Solde", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
print '<td></td>';
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>';
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="7">&nbsp;</td>';
print '<td colspan="5">&nbsp;</td>';
print '<td align="right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
@@ -236,38 +235,36 @@ if ($resql) {
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . $obj->label_compte . '</td>';
print '<td>' . price($obj->debit) . '</td>';
print '<td>' . price($obj->credit) . '</td>';
print '<td>' . price($obj->montant) . '</td>';
print '<td>' . $obj->sens . '</td>';
print '<td>' . $obj->code_journal . '</td>';
print '<td>' . round($solde, 2) . '</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>';
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>' . $obj->lettering_code . '</td>';
print '<td align="center">' . $obj->lettering_code . '</td>';
print "</tr>\n";
}
print '<tr class="oddeven">';
print '<td colspan="4">Mouvement totaux</td>' . "\n";
print '<td><strong>' . price($debit) . '</strong></td>';
print '<td><strong>' . price($credit) . '</strong></td>';
print '<td 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 "</tr>\n";
print '<tr class="oddeven">';
print '<td colspan="9">Solde Comptable</td>' . "\n";
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
print '<td colspan="5"></td>';
print '<td colspan="6">'.$langs->trans("Balancing").':</td>' . "\n";
print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
print '<td colspan="3"></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=autolettrage">' . $langs->trans('AccountancyAutoLettering') . '</a>';
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettering">' . $langs->trans('AccountancyAutoLettering') . '</a>';
print "</form>";
$db->free($resql);
} else {

View File

@@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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>
*
* 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
@@ -21,14 +21,11 @@
*/
/**
* \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php
* \ingroup Advanced accountancy
* \brief Tab to setup lettering
* \file accountancy/bookkeeping/thirdparty_lettering_supplier.php
* \ingroup Advanced accountancy
* \brief Tab to setup lettering
*/
// Dolibarr environment
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';
@@ -36,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta"));
$langs->loadLangs(array("compta","accountancy"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
@@ -83,6 +80,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$socid = GETPOST("socid", 'int');
// if ($user->societe_id) $socid=$user->societe_id;
$lettering = new lettering($db);
$object = new Societe($db);
$object->id = $socid;
$result = $object->fetch($socid);
@@ -91,51 +89,39 @@ if ($result<0)
setEventMessages($object->error, $object->errors, 'errors');
}
$form = new Form($db);
$BookKeeping = new lettering($db);
$formaccounting = new FormAccounting($db);
/*
* Action
*/
if ($action == 'lettering') {
$result = $BookKeeping->updateLettrage($toselect);
$result = $lettering->updateLettrage($toselect);
// var_dump($result);
if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors');
setEventMessages('', $lettering->errors, 'errors');
$error ++;
}
}
if ($action == 'autolettrage') {
$result = $BookKeeping->lettering_thirdparty($socid);
$result = $lettering->lettering_thirdparty($socid);
if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors');
setEventMessages('', $lettering->errors, 'errors');
$error ++;
}
}
$title = 'AccountancyLettrage';
llxHeader('', $title);
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (!empty($search_year)) $param.='&search_year='.$search_year;
if (!empty($socid)) $param.='&socid='.$socid;
if (!empty($search_doc_type)) $param.='&search_doc_type='.$search_doc_type;
if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref;
/*
* Display tabs
* View
*/
$form = new Form($db);
$formaccounting = new FormAccounting($db);
$title=$object->name." - ".$langs->trans('TabLetteringSupplier');
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
$head = societe_prepare_head($object);
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
@@ -210,21 +196,19 @@ if ($resql) {
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("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte","",$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("Amount", $_SERVER["PHP_SELF"], "bk.montant","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens","",$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("Solde", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
print '<td></td>';
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>';
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="7">&nbsp;</td>';
print '<td colspan="6">&nbsp;</td>';
print '<td align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
@@ -254,39 +238,36 @@ if ($resql) {
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . $obj->label_compte . '</td>';
print '<td>' . price($obj->debit) . '</td>';
print '<td>' . price($obj->credit) . '</td>';
print '<td>' . price($obj->montant) . '</td>';
print '<td>' . $obj->sens . '</td>';
print '<td>' . $obj->code_journal . '</td>';
print '<td>' . round($solde, 2) . '</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>';
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>' . $obj->lettering_code . '</td>';
print '<td align="center">' . $obj->lettering_code . '</td>';
print "</tr>\n";
}
print '<tr class="oddeven">';
print '<td colspan="4">Mouvement totaux</td>' . "\n";
print '<td><strong>' . price($debit) . '</strong></td>';
print '<td><strong>' . price($credit) . '</strong></td>';
print '<td 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 "</tr>\n";
print '<tr class="oddeven">';
print '<td colspan="9">Solde Comptable</td>' . "\n";
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
print '<td colspan="5"></td>';
print '<td colspan="6">'.$langs->trans("Balancing").':</td>' . "\n";
print '<td align="right"><strong>' . price($credit - $debit) . '</strong></td>';
print '<td colspan="3"></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=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
print "</form>";
$db->free($resql);
} else {

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
*/
/**
* \file htdocs/accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy
* \brief File of class to manage Ledger (General Ledger and Subledger)
* \file htdocs/accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy
* \brief File of class to manage Ledger (General Ledger and Subledger)
*/
// Class
@@ -862,6 +862,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.montant,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
@@ -934,6 +935,7 @@ class BookKeeping extends CommonObject
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;

View File

@@ -226,6 +226,7 @@ AutomaticBindingDone=Automatic binding done
ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used
MvtNotCorrectlyBalanced=Movement not correctly balanced. Debit = %s | Credit = %s
Balancing=Balancing
FicheVentilation=Binding card
GeneralLedgerIsWritten=Transactions are written in the Ledger
GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be journalized. If there is no other error message, this is probably because they were already journalized.