2004-10-19 22:35:36 +02:00
< ? php
2006-12-07 09:33:19 +01:00
/* Copyright ( C ) 2001 - 2006 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2011-06-13 13:10:43 +02:00
* Copyright ( C ) 2004 - 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2005 - 2009 Regis Houssin < regis . houssin @ capnetworks . com >
2013-09-10 16:43:06 +02:00
* Copyright ( C ) 2013 Cédric Salvador < csalvador @ gpcsolutions . fr >
2017-08-01 06:21:19 +02:00
* Copyright ( C ) 2015 Jean - François Ferry < jfefe @ aternatik . fr >
2015-10-03 16:58:46 +02:00
* Copyright ( C ) 2015 Juanjo Menent < jmenent @ 2 byte . es >
2017-07-28 07:18:41 +02:00
* Copyright ( C ) 2017 Alexandre Spangaro < aspangaro @ zendsi . com >
2018-04-20 10:38:16 +02:00
* Copyright ( C ) 2018 Ferran Marcet < fmarcet @ 2 byte . es >
2004-02-10 16:33:28 +01:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2004-02-10 16:33:28 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-03 02:45:22 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2004-02-10 16:33:28 +01:00
*/
2009-04-09 22:22:51 +02:00
2005-02-01 22:02:13 +01:00
/**
2014-09-18 20:33:37 +02:00
* \file htdocs / compta / paiement / list . php
2008-11-16 23:26:47 +01:00
* \ingroup compta
* \brief Page liste des paiements des factures clients
*/
2005-02-01 22:02:13 +01:00
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
2015-08-24 15:40:33 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
2017-08-01 06:26:35 +02:00
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php' ;
2005-02-01 22:02:13 +01:00
2018-05-27 09:27:09 +02:00
// Load translation files required by the page
$langs -> loadLangs ( array ( 'bills' , 'compta' ));
2005-06-26 00:54:02 +02:00
2008-02-25 17:30:43 +01:00
// Security check
2017-08-01 06:21:19 +02:00
$facid = GETPOST ( 'facid' , 'int' );
$socid = GETPOST ( 'socid' , 'int' );
$userid = GETPOST ( 'userid' , 'int' );
2015-08-24 15:40:33 +02:00
$day = GETPOST ( 'day' , 'int' );
$month = GETPOST ( 'month' , 'int' );
$year = GETPOST ( 'year' , 'int' );
2008-02-25 21:03:21 +01:00
if ( $user -> societe_id ) $socid = $user -> societe_id ;
2008-03-01 02:26:41 +01:00
$result = restrictedArea ( $user , 'facture' , $facid , '' );
2005-10-08 21:13:58 +02:00
2007-01-05 21:30:34 +01:00
$paymentstatic = new Paiement ( $db );
$accountstatic = new Account ( $db );
2007-06-21 00:25:42 +02:00
$companystatic = new Societe ( $db );
2007-01-05 21:30:34 +01:00
2016-06-19 16:07:34 +02:00
$search_ref = GETPOST ( " search_ref " , " alpha " );
2014-11-02 14:41:19 +01:00
$search_account = GETPOST ( " search_account " , " int " );
$search_paymenttype = GETPOST ( " search_paymenttype " );
2016-02-03 02:29:19 +01:00
$search_amount = GETPOST ( " search_amount " , 'alpha' ); // alpha because we must be able to search on "< x"
$search_company = GETPOST ( " search_company " , 'alpha' );
$search_payment_num = GETPOST ( 'search_payment_num' , 'alpha' );
2016-02-07 14:41:06 +01:00
2018-04-21 12:16:12 +02:00
$limit = GETPOST ( 'limit' , 'int' ) ? GETPOST ( 'limit' , 'int' ) : $conf -> liste_limit ;
2010-11-20 14:08:44 +01:00
$sortfield = GETPOST ( " sortfield " , 'alpha' );
$sortorder = GETPOST ( " sortorder " , 'alpha' );
$page = GETPOST ( " page " , 'int' );
2017-06-06 10:53:53 +02:00
if ( empty ( $page ) || $page == - 1 ) { $page = 0 ; } // If $page is not defined, or '' or -1
2015-12-16 19:38:40 +01:00
$offset = $limit * $page ;
2010-11-20 14:08:44 +01:00
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2005-02-01 22:02:13 +01:00
if ( ! $sortorder ) $sortorder = " DESC " ;
if ( ! $sortfield ) $sortfield = " p.rowid " ;
2009-04-09 22:22:51 +02:00
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2016-02-07 14:41:06 +01:00
$hookmanager -> initHooks ( array ( 'paymentlist' ));
$extrafields = new ExtraFields ( $db );
/*
* Actions
*/
2017-07-13 00:35:10 +02:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) // Both test are required to be compatible with all browsers
2014-11-02 14:41:19 +01:00
{
$search_ref = " " ;
$search_account = " " ;
$search_amount = " " ;
$search_paymenttype = " " ;
2016-02-03 02:29:19 +01:00
$search_payment_num = " " ;
2014-11-02 14:41:19 +01:00
$search_company = " " ;
2015-08-24 15:40:33 +02:00
$day = '' ;
$year = '' ;
$month = '' ;
2014-11-02 14:41:19 +01:00
}
2010-05-01 17:33:00 +02:00
2015-06-30 14:32:17 +02:00
2010-05-01 17:33:00 +02:00
/*
2010-08-29 23:11:42 +02:00
* View
*/
2010-05-01 17:33:00 +02:00
2014-03-17 21:47:06 +01:00
llxHeader ( '' , $langs -> trans ( 'ListPayment' ));
2010-05-01 17:33:00 +02:00
2010-08-29 23:11:42 +02:00
$form = new Form ( $db );
2015-08-24 15:40:33 +02:00
$formother = new FormOther ( $db );
2010-08-29 23:11:42 +02:00
2011-06-13 13:10:43 +02:00
if ( GETPOST ( " orphelins " ))
2005-08-16 21:13:38 +02:00
{
2010-08-29 23:11:42 +02:00
// Paiements lies a aucune facture (pour aide au diagnostic)
2015-10-03 16:58:46 +02:00
$sql = " SELECT p.rowid, p.ref, p.datep as dp, p.amount, " ;
2010-08-29 23:11:42 +02:00
$sql .= " p.statut, p.num_paiement, " ;
2011-06-13 13:10:43 +02:00
$sql .= " c.code as paiement_code " ;
2015-06-30 14:32:17 +02:00
// Add fields for extrafields
foreach ( $extrafields -> attribute_list as $key => $val ) $sql .= " ,ef. " . $key . ' as options_' . $key ;
// Add fields from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListSelect' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2017-11-23 15:06:16 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " paiement as p LEFT JOIN " . MAIN_DB_PREFIX . " c_paiement as c ON p.fk_paiement = c.id " ;
2011-06-13 13:10:43 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " paiement_facture as pf ON p.rowid = pf.fk_paiement " ;
2017-11-23 15:06:16 +01:00
$sql .= " WHERE p.entity IN ( " . getEntity ( 'facture' ) . " ) " ;
2011-06-13 13:10:43 +02:00
$sql .= " AND pf.fk_facture IS NULL " ;
2015-06-30 14:32:17 +02:00
// Add where from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2011-06-13 13:10:43 +02:00
}
else
{
2015-10-03 16:58:46 +02:00
$sql = " SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount, " ; // DISTINCT is to avoid duplicate when there is a link to sales representatives
2011-06-13 13:10:43 +02:00
$sql .= " p.statut, p.num_paiement, " ;
2010-08-29 23:11:42 +02:00
$sql .= " c.code as paiement_code, " ;
2017-07-28 07:18:41 +02:00
$sql .= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal, " ;
2014-10-04 17:20:17 +02:00
$sql .= " s.rowid as socid, s.nom as name " ;
2015-06-30 14:32:17 +02:00
// Add fields for extrafields
foreach ( $extrafields -> attribute_list as $key => $val ) $sql .= " ,ef. " . $key . ' as options_' . $key ;
// Add fields from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListSelect' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2017-11-23 15:06:16 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " paiement as p " ;
2018-03-07 17:32:57 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_paiement as c ON p.fk_paiement = c.id " ;
2011-06-13 13:10:43 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " bank as b ON p.fk_bank = b.rowid " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " bank_account as ba ON b.fk_account = ba.rowid " ;
2010-08-29 23:11:42 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " paiement_facture as pf ON p.rowid = pf.fk_paiement " ;
2011-06-13 13:10:43 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " facture as f ON pf.fk_facture = f.rowid " ;
2012-02-01 11:32:55 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe as s ON f.fk_soc = s.rowid " ;
2011-06-13 13:10:43 +02:00
if ( ! $user -> rights -> societe -> client -> voir && ! $socid )
{
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe_commerciaux as sc ON s.rowid = sc.fk_soc " ;
}
2017-12-03 11:59:16 +01:00
$sql .= " WHERE p.entity IN ( " . getEntity ( 'facture' ) . " ) " ;
2012-02-01 11:32:55 +01:00
if ( ! $user -> rights -> societe -> client -> voir && ! $socid )
2011-06-13 13:10:43 +02:00
{
$sql .= " AND sc.fk_user = " . $user -> id ;
}
if ( $socid > 0 ) $sql .= " AND f.fk_soc = " . $socid ;
2011-06-13 15:07:10 +02:00
if ( $userid )
{
if ( $userid == - 1 ) $sql .= " AND f.fk_user_author IS NULL " ;
else $sql .= " AND f.fk_user_author = " . $userid ;
}
2011-06-13 13:10:43 +02:00
// Search criteria
2015-08-24 15:40:33 +02:00
if ( $month > 0 )
{
if ( $year > 0 && empty ( $day ))
$sql .= " AND p.datep BETWEEN ' " . $db -> idate ( dol_get_first_day ( $year , $month , false )) . " ' AND ' " . $db -> idate ( dol_get_last_day ( $year , $month , false )) . " ' " ;
else if ( $year > 0 && ! empty ( $day ))
$sql .= " AND p.datep BETWEEN ' " . $db -> idate ( dol_mktime ( 0 , 0 , 0 , $month , $day , $year )) . " ' AND ' " . $db -> idate ( dol_mktime ( 23 , 59 , 59 , $month , $day , $year )) . " ' " ;
else
$sql .= " AND date_format(p.datep, '%m') = ' " . $month . " ' " ;
}
else if ( $year > 0 )
{
$sql .= " AND p.datep BETWEEN ' " . $db -> idate ( dol_get_first_day ( $year , 1 , false )) . " ' AND ' " . $db -> idate ( dol_get_last_day ( $year , 12 , false )) . " ' " ;
}
2016-02-07 14:41:06 +01:00
if ( $search_ref ) $sql .= natural_search ( 'p.ref' , $search_ref );
2014-11-02 14:41:19 +01:00
if ( $search_account > 0 ) $sql .= " AND b.fk_account= " . $search_account ;
2015-02-10 21:33:43 +01:00
if ( $search_paymenttype != " " ) $sql .= " AND c.code=' " . $db -> escape ( $search_paymenttype ) . " ' " ;
2016-02-07 14:41:06 +01:00
if ( $search_payment_num != '' ) $sql .= natural_search ( 'p.num_paiement' , $search_payment_num );
2017-06-09 09:25:15 +02:00
if ( $search_amount ) $sql .= natural_search ( 'p.amount' , $search_amount , 1 );
2014-11-02 14:41:19 +01:00
if ( $search_company ) $sql .= natural_search ( 's.nom' , $search_company );
2015-06-30 14:32:17 +02:00
// Add where from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2005-05-07 04:11:33 +02:00
}
2016-02-11 20:24:15 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2016-01-19 12:18:29 +01:00
2017-01-15 20:49:20 +01:00
$nbtotalofrecords = '' ;
2016-01-19 12:18:29 +01:00
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST ))
{
$result = $db -> query ( $sql );
$nbtotalofrecords = $db -> num_rows ( $result );
2018-04-24 11:37:57 +02:00
if (( $page * $limit ) > $nbtotalofrecords ) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0 ;
$offset = 0 ;
}
2016-01-19 12:18:29 +01:00
}
2012-03-18 19:23:01 +01:00
$sql .= $db -> plimit ( $limit + 1 , $offset );
2005-05-07 04:11:33 +02:00
//print "$sql";
2004-02-10 16:33:28 +01:00
2005-04-04 13:56:26 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
2004-02-10 16:33:28 +01:00
{
2010-08-29 23:11:42 +02:00
$num = $db -> num_rows ( $resql );
$i = 0 ;
2016-05-17 02:41:06 +02:00
$param = '' ;
2016-06-07 14:06:00 +02:00
if ( ! empty ( $contextpage ) && $contextpage != $_SERVER [ " PHP_SELF " ]) $param .= '&contextpage=' . $contextpage ;
2016-05-17 02:41:06 +02:00
if ( $limit > 0 && $limit != $conf -> liste_limit ) $param .= '&limit=' . $limit ;
$param .= ( GETPOST ( " orphelins " ) ? " &orphelins=1 " : " " );
$param .= ( $search_ref ? " &search_ref= " . urlencode ( $search_ref ) : " " );
$param .= ( $search_company ? " &search_company= " . urlencode ( $search_company ) : " " );
$param .= ( $search_amount ? " &search_amount= " . urlencode ( $search_amount ) : " " );
$param .= ( $search_payment_num ? " &search_payment_num= " . urlencode ( $search_payment_num ) : " " );
if ( $optioncss != '' ) $param .= '&optioncss=' . urlencode ( $optioncss );
2017-06-09 09:25:15 +02:00
2016-02-11 20:24:15 +01:00
print '<form method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '">' ;
if ( $optioncss != '' ) print '<input type="hidden" name="optioncss" value="' . $optioncss . '">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
2017-05-21 02:43:51 +02:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2016-02-11 20:24:15 +01:00
print '<input type="hidden" name="viewstatut" value="' . $viewstatut . '">' ;
2017-06-09 09:25:15 +02:00
2016-05-17 02:41:06 +02:00
print_barre_liste ( $langs -> trans ( " ReceivedCustomersPayments " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , '' , $num , $nbtotalofrecords , 'title_accountancy.png' , 0 , '' , '' , $limit );
2017-06-09 09:25:15 +02:00
2016-11-27 13:49:46 +01:00
print '<div class="div-table-responsive">' ;
print '<table class="tagtable liste' . ( $moreforfilter ? " listwithfilterbefore " : " " ) . '">' . " \n " ;
2010-08-29 23:11:42 +02:00
// Lines for filters fields
2017-04-01 12:46:47 +02:00
print '<tr class="liste_titre_filter">' ;
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre" align="left">' ;
2018-04-29 19:52:14 +02:00
print '<input class="flat" type="text" size="4" name="search_ref" value="' . dol_escape_htmltag ( $search_ref ) . '">' ;
2010-08-29 23:11:42 +02:00
print '</td>' ;
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre" align="center">' ;
2018-04-29 19:52:14 +02:00
if ( ! empty ( $conf -> global -> MAIN_LIST_FILTER_ON_DAY )) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="' . dol_escape_htmltag ( $day ) . '">' ;
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="' . dol_escape_htmltag ( $month ) . '">' ;
2015-08-24 15:40:33 +02:00
$formother -> select_year ( $year ? $year :- 1 , 'year' , 1 , 20 , 5 );
print '</td>' ;
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre" align="left">' ;
2018-04-29 19:52:14 +02:00
print '<input class="flat" type="text" size="6" name="search_company" value="' . dol_escape_htmltag ( $search_company ) . '">' ;
2010-08-29 23:11:42 +02:00
print '</td>' ;
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre">' ;
2014-11-02 14:41:19 +01:00
$form -> select_types_paiements ( $search_paymenttype , 'search_paymenttype' , '' , 2 , 1 , 1 );
2010-08-29 23:11:42 +02:00
print '</td>' ;
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre" align="left">' ;
2018-04-29 19:52:14 +02:00
print '<input class="flat" type="text" size="4" name="search_payment_num" value="' . dol_escape_htmltag ( $search_payment_num ) . '">' ;
2016-02-03 02:29:19 +01:00
print '</td>' ;
2016-08-11 18:18:03 +02:00
if ( ! empty ( $conf -> banque -> enabled ))
{
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre">' ;
2016-08-11 18:18:03 +02:00
$form -> select_comptes ( $search_account , 'search_account' , 0 , '' , 1 );
print '</td>' ;
}
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre" align="right">' ;
2018-04-29 19:52:14 +02:00
print '<input class="flat" type="text" size="4" name="search_amount" value="' . dol_escape_htmltag ( $search_amount ) . '">' ;
2016-02-07 15:50:48 +01:00
print '</td>' ;
print '<td class="liste_titre" align="right">' ;
2017-05-14 21:06:33 +02:00
$searchpicto = $form -> showFilterAndCheckAddButtons ( 0 );
print $searchpicto ;
2010-08-29 23:11:42 +02:00
print '</td>' ;
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> global -> BILL_ADD_PAYMENT_VALIDATION ))
2010-08-29 23:11:42 +02:00
{
2016-12-11 16:11:42 +01:00
print '<td class="liste_titre" align="right">' ;
2010-08-29 23:11:42 +02:00
print '</td>' ;
}
print " </tr> \n " ;
2017-04-01 12:46:47 +02:00
print '<tr class="liste_titre">' ;
2017-08-02 13:31:53 +02:00
print_liste_field_titre ( " RefPayment " , $_SERVER [ " PHP_SELF " ], " p.rowid " , " " , $param , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Date " , $_SERVER [ " PHP_SELF " ], " dp " , " " , $param , 'align="center"' , $sortfield , $sortorder );
print_liste_field_titre ( " ThirdParty " , $_SERVER [ " PHP_SELF " ], " s.nom " , " " , $param , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Type " , $_SERVER [ " PHP_SELF " ], " c.libelle " , " " , $param , " " , $sortfield , $sortorder );
print_liste_field_titre ( " Numero " , $_SERVER [ " PHP_SELF " ], " p.num_paiement " , " " , $param , " " , $sortfield , $sortorder );
2017-04-01 12:46:47 +02:00
if ( ! empty ( $conf -> banque -> enabled ))
{
2017-08-02 13:31:53 +02:00
print_liste_field_titre ( " Account " , $_SERVER [ " PHP_SELF " ], " ba.label " , " " , $param , " " , $sortfield , $sortorder );
2017-04-01 12:46:47 +02:00
}
2017-08-02 13:31:53 +02:00
print_liste_field_titre ( " Amount " , $_SERVER [ " PHP_SELF " ], " p.amount " , " " , $param , 'align="right"' , $sortfield , $sortorder );
//print_liste_field_titre("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
2017-06-09 09:25:15 +02:00
2018-04-20 10:38:16 +02:00
$parameters = array ( 'arrayfields' => $arrayfields , 'param' => $param , 'sortfield' => $sortfield , 'sortorder' => $sortorder );
2017-04-01 12:46:47 +02:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2017-06-09 09:25:15 +02:00
2017-08-02 13:31:53 +02:00
if ( ! empty ( $conf -> global -> BILL_ADD_PAYMENT_VALIDATION )) print_liste_field_titre ( " Status " , $_SERVER [ " PHP_SELF " ], " p.statut " , " " , $param , 'align="right"' , $sortfield , $sortorder );
2017-04-01 12:46:47 +02:00
print_liste_field_titre ( '' , $_SERVER [ " PHP_SELF " ], " " , '' , '' , '' , $sortfield , $sortorder , 'maxwidthsearch ' );
print " </tr> \n " ;
2017-06-09 09:25:15 +02:00
2010-08-29 23:11:42 +02:00
while ( $i < min ( $num , $limit ))
{
$objp = $db -> fetch_object ( $resql );
2017-04-01 12:46:47 +02:00
print '<tr class="oddeven">' ;
2010-08-29 23:11:42 +02:00
2015-06-30 14:32:17 +02:00
print '<td>' ;
2010-08-29 23:11:42 +02:00
$paymentstatic -> id = $objp -> rowid ;
2015-10-03 16:58:46 +02:00
$paymentstatic -> ref = $objp -> ref ;
2010-08-29 23:11:42 +02:00
print $paymentstatic -> getNomUrl ( 1 );
print '</td>' ;
2016-02-07 14:41:06 +01:00
// Date
2010-08-29 23:11:42 +02:00
print '<td align="center">' . dol_print_date ( $db -> jdate ( $objp -> dp ), 'day' ) . '</td>' ;
2016-02-07 14:41:06 +01:00
// Thirdparty
2010-08-29 23:11:42 +02:00
print '<td>' ;
if ( $objp -> socid )
{
$companystatic -> id = $objp -> socid ;
2014-10-04 17:20:17 +02:00
$companystatic -> name = $objp -> name ;
2010-08-29 23:11:42 +02:00
print $companystatic -> getNomUrl ( 1 , '' , 24 );
}
else print ' ' ;
print '</td>' ;
2016-02-07 14:41:06 +01:00
// Type
print '<td>' . $langs -> trans ( " PaymentTypeShort " . $objp -> paiement_code ) . '</td>' ;
2017-06-09 09:25:15 +02:00
2016-02-07 14:41:06 +01:00
// Payment number
print '<td>' . $objp -> num_paiement . '</td>' ;
2016-08-11 18:18:03 +02:00
// Account
if ( ! empty ( $conf -> banque -> enabled ))
{
print '<td>' ;
2016-11-27 13:49:46 +01:00
if ( $objp -> bid > 0 )
2016-08-11 18:18:03 +02:00
{
$accountstatic -> id = $objp -> bid ;
2016-11-27 13:49:46 +01:00
$accountstatic -> ref = $objp -> bref ;
$accountstatic -> label = $objp -> blabel ;
$accountstatic -> number = $objp -> number ;
$accountstatic -> account_number = $objp -> account_number ;
2017-07-28 07:18:41 +02:00
$accountingjournal = new AccountingJournal ( $db );
$accountingjournal -> fetch ( $objp -> accountancy_journal );
2017-08-04 15:17:30 +02:00
$accountstatic -> accountancy_journal = $accountingjournal -> code ;
2017-07-28 07:18:41 +02:00
2016-08-11 18:18:03 +02:00
print $accountstatic -> getNomUrl ( 1 );
}
else print ' ' ;
print '</td>' ;
}
// Amount
2010-08-29 23:11:42 +02:00
print '<td align="right">' . price ( $objp -> amount ) . '</td>' ;
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> global -> BILL_ADD_PAYMENT_VALIDATION ))
2010-08-29 23:11:42 +02:00
{
print '<td align="right">' ;
2014-09-18 21:18:25 +02:00
if ( $objp -> statut == 0 ) print '<a href="card.php?id=' . $objp -> rowid . '&action=valide">' ;
2010-08-29 23:11:42 +02:00
print $paymentstatic -> LibStatut ( $objp -> statut , 5 );
if ( $objp -> statut == 0 ) print '</a>' ;
print '</td>' ;
}
2014-11-02 14:41:19 +01:00
print '<td> </td>' ;
2010-08-29 23:11:42 +02:00
print '</tr>' ;
$i ++ ;
}
print " </table> \n " ;
2016-11-27 13:49:46 +01:00
print " </div> " ;
2010-08-29 23:11:42 +02:00
print " </form> \n " ;
2004-02-10 16:33:28 +01:00
}
2005-07-07 17:21:47 +02:00
else
{
2010-08-29 23:11:42 +02:00
dol_print_error ( $db );
2005-05-07 04:11:33 +02:00
}
2004-02-10 16:33:28 +01:00
2011-08-27 16:24:16 +02:00
llxFooter ();
2015-10-09 12:30:16 +02:00
$db -> close ();