diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index cc4629e4ff9..93968644a8f 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2016 Laurent Destailleur +/* Copyright (C) 2013-2016 Olivier Geffroy + * Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2016-2017 Laurent Destailleur * * 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 @@ -16,7 +16,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -455,7 +454,10 @@ print "\n"; $total_debit = 0; $total_credit = 0; -foreach ($object->lines as $line ) { +$i=0; +while ($i < min($num, $limit)) +{ + $line = $object->lines[$i]; $total_debit += $line->debit; $total_credit += $line->credit; @@ -481,6 +483,8 @@ foreach ($object->lines as $line ) { print '' . img_delete() . ''; print ''; print "\n"; + + $i++; } print ''; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 861db728de5..1f43964bd0a 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -92,7 +92,7 @@ if (! empty($search_doc_date)) { } -if (!GETPOST('button_removefilter_x','alpha') && !GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers +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 { if (! empty($search_accountancy_code_start)) { $filter['t.numero_compte'] = $search_accountancy_code_start; @@ -160,7 +160,6 @@ $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By" llxHeader('', $title_page); // List - $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); @@ -173,7 +172,9 @@ $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $f if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } -$nbtotalofrecords = $result; + +$num=count($object->lines); + if ($action == 'delmouv') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); @@ -204,7 +205,7 @@ if ($action == 'delbookkeepingyear') { -print '
'; +print ''; $viewflat = ' ' . $langs->trans("ViewFlatList") . ''; @@ -263,7 +264,10 @@ $sous_total_debit = 0; $sous_total_credit = 0; $displayed_account_number = null; // Start with undefined to be able to distinguish with empty -foreach ( $object->lines as $line ) { +$i=0; +while ($i < min($num, $limit)) +{ + $line = $object->lines[$i]; $total_debit += $line->debit; $total_credit += $line->credit; @@ -323,10 +327,11 @@ foreach ( $object->lines as $line ) { print ''; print "\n"; - // Comptabilise le sous-total - $sous_total_debit += $line->debit; - $sous_total_credit += $line->credit; + // Comptabilise le sous-total + $sous_total_debit += $line->debit; + $sous_total_credit += $line->credit; + $i++; } // Affiche un Sous-Total du dernier compte comptable affiché diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 9970e4672ac..1431df9f8a2 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -803,7 +803,7 @@ class BookKeeping extends CommonObject if (! empty($limit)) { $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } - $this->lines = array (); + $this->lines = array(); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 916a902d573..d5746eb63e5 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1,4 +1,6 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent @@ -51,6 +53,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/paymentvarious.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; $langs->loadLangs(array("companies","other","compta","banks",'bills','donations',"accountancy","trips","salaries","hrm")); @@ -99,7 +102,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $idpays = $mysoc->country_id; -$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,"; $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,"; $sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,"; $sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop"; @@ -125,6 +128,7 @@ $paymentstatic = new Paiement($db); $paymentsupplierstatic = new PaiementFourn($db); $societestatic = new Societe($db); $userstatic = new User($db); +$bankaccountstatic = new Account($db); $chargestatic = new ChargeSociales($db); $paymentdonstatic = new PaymentDonation($db); $paymentvatstatic = new TVA($db); @@ -198,6 +202,7 @@ if ($result) { $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ... $tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later $tabpay[$obj->rowid]["fk_bank"] = $obj->rowid; + $tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account; if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) { $tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]); } else { @@ -318,6 +323,8 @@ if ($result) { } else if ($links[$key]['type'] == 'banktransfert') { $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer"); $tabtp[$obj->rowid][$account_transfer] += $obj->amount; + $bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']); + $tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2); } } } @@ -774,7 +781,7 @@ if (empty($action) || $action == 'view') { print "" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")"; print "" . $langs->trans("AccountAccounting") . ""; print "" . $langs->trans("SubledgerAccount") . ""; - print "" . $langs->trans("Type") . ""; + print "" . $langs->trans("Label") . ""; print "" . $langs->trans("PaymentMode") . ""; print "" . $langs->trans("Debit") . ""; print "" . $langs->trans("Credit") . ""; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index a58068c8798..9ab5f93e8ed 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -290,11 +290,11 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); } - if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1')) + /*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors'); $error++; - } + }*/ if (! $error) { @@ -666,12 +666,12 @@ if ($resql) print ''.$langs->trans("Description").''; print ''.$langs->trans("Debit").''; print ''.$langs->trans("Credit").''; - if (! empty($conf->accounting->enabled)) + /*if (! empty($conf->accounting->enabled)) { print ''; print $langs->trans("AccountAccounting"); print ''; - } + }*/ print ' '; print ''; @@ -692,16 +692,17 @@ if ($resql) print ''; print ''; print ''; - if (! empty($conf->accounting->enabled)) + /*if (! empty($conf->accounting->enabled)) { print ''; print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print ''; - } + }*/ print ''; print '
'; print ''; print ''; + print ''; print '
'; }