diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 92ce582e8dd..3925c288bcd 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -27,8 +27,9 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php'; /** * @var Conf $conf @@ -48,10 +49,27 @@ if ($user->socid > 0) { $socid = $user->socid; } - // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('supplierbalencelist', 'globalcard')); +// Load variable for pagination +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); +if (empty($page) || $page == -1) { + $page = 0; +} // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = "f.datef,f.rowid"; // Set here default search field +} +if (!$sortorder) { + $sortorder = "DESC"; +} + /* * View */ @@ -78,37 +96,39 @@ if ($socid > 0) { // Invoice list print load_fiche_titre($langs->trans("SupplierPreview")); - print '
| ' . $langs->trans("Element") . ' | '; + print '' . $langs->trans("Status") . ' | '; + print '' . $langs->trans("Debit") . ' | '; + print '' . $langs->trans("Credit") . ' | '; + print '' . $langs->trans("Balance") . ' | '; + print '' . $langs->trans("Author") . ' | '; + print '|
| '.$langs->trans("Date").' | '; - print ''; - print ' | '.$langs->trans("Status").' | '; - print ''.$langs->trans("Debit").' | '; - print ''.$langs->trans("Credit").' | '; - print ''.$langs->trans("Balance").' | '; - print ''; - print ' |
| '.$langs->trans("NoInvoice").' | ||||||
| '.dol_print_date($fac->date)." | \n"; - print "id\">".img_object($langs->trans("ShowBill"), "bill")." ".$fac->ref." | \n"; + $values = array( + 'fk_facture' => $objf->facid, + 'date' => $fac->date, + 'datefieldforsort' => $fac->date . '-' . $fac->ref, + 'link' => $fac->getNomUrl(1), + 'status' => $fac->getLibStatut(2, $totalpaid), + 'amount' => $fac->total_ttc, + 'author' => $userstatic->getLoginUrl(1) + ); - print ''.$fac->getLibStatut(2, $totalpaid).' | '; - print ''.price($fac->total_ttc)." | \n"; - $solde += $fac->total_ttc; - - print ''; - print ' | '.price($solde)." | \n"; - - // Author - print ''.img_object($langs->trans("ShowUser"), 'user').' '.$objf->login.' | '; - - print "
| '.dol_print_date($db->jdate($objp->dp))." | \n"; - print ''; - print ' '; // Decalage - print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$langs->trans("Payment").' '.$objp->rowid.' | '; - print "\n"; - print " | \n"; - print ' | '.price($objp->amount).' | '; - $solde -= $objp->amount; - print ''.price($solde)." | \n"; - // Auteur - print ''.img_object($langs->trans("ShowUser"), 'user').' '.$objp->login.' | '; + $paymentstatic = new PaiementFourn($db); + $paymentstatic->id = $objp->rowid; - print '
| ' . $langs->trans("NoInvoice") . ' | ||||||
| '; + print dol_print_date($data['date'], 'day'); + print " | \n"; + + print '' . $data['link'] . " | \n"; + + print '' . $data['status'] . ' | '; + + print '' . (($data['amount'] > 0) ? price(abs($data['amount'])) : '') . " | \n"; + + $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; + + print '' . (($data['amount'] > 0) ? '' : price(abs($data['amount']))) . " | \n"; + $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); + + // Balance + print '' . price($data['balance']) . " | \n"; + + // Author + print ''; + print $data['author']; + print ' | '; + + print "
| '; + print ' | ' . price($totalDebit) . ' | '; + print '' . price($totalCredit) . ' | '; + print '' . price(price2num($totalDebit - $totalCredit, 'MT')) . ' | '; + print ''; + print " | ||