2004-10-19 22:35:36 +02:00
< ? php
2005-08-21 17:22:46 +02:00
/* Copyright ( C ) 2001 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2013-03-07 22:39:57 +01:00
* Copyright ( C ) 2004 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
2010-11-02 23:26:02 +01:00
* Copyright ( C ) 2010 Juanjo Menent < jmenent @ 2 byte . es >
2002-06-18 18:36:02 +02: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
2002-06-18 18:36:02 +02: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-01 00:21:57 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2002-05-11 20:53:13 +02:00
*/
2004-10-09 15:53:14 +02:00
2005-04-09 02:52:36 +02:00
/**
2009-01-09 20:53:26 +01:00
* \file htdocs / compta / bank / rappro . php
* \ingroup banque
2010-06-16 22:06:18 +02:00
* \brief Page to reconciliate bank transactions
2009-01-09 20:53:26 +01:00
*/
2004-10-09 15:53:14 +02:00
2013-04-15 13:11:29 +02:00
require ( '../../main.inc.php' );
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/sociales/class/chargesociales.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php' ;
2013-06-05 16:24:32 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
$langs -> load ( " banks " );
$langs -> load ( " categories " );
2007-05-27 21:17:34 +02:00
$langs -> load ( " bills " );
2005-05-08 18:42:05 +02:00
2007-05-27 21:17:34 +02:00
if ( ! $user -> rights -> banque -> consolidate ) accessforbidden ();
2003-11-05 10:59:16 +01:00
2012-10-13 10:39:16 +02:00
$action = GETPOST ( 'action' , 'alpha' );
$id = GETPOST ( 'account' , 'int' );
2004-10-09 15:53:14 +02:00
2004-06-05 01:09:27 +02:00
/*
2008-10-11 00:48:47 +02:00
* Actions
2004-06-05 01:09:27 +02:00
*/
2008-10-11 00:48:47 +02:00
// Conciliation
2012-10-13 10:39:16 +02:00
if ( $action == 'rappro' && $user -> rights -> banque -> consolidate )
2003-08-26 12:10:42 +02:00
{
2013-03-07 22:39:57 +01:00
$error = 0 ;
2006-03-10 00:53:04 +01:00
// Definition, nettoyage parametres
$num_releve = trim ( $_POST [ " num_releve " ]);
2009-04-20 22:53:08 +02:00
2006-03-10 00:53:04 +01:00
if ( $num_releve )
2005-05-08 22:35:07 +02:00
{
2009-01-09 20:53:26 +01:00
$bankline = new AccountLine ( $db );
2009-04-20 22:53:08 +02:00
2013-03-07 22:39:57 +01:00
if ( isset ( $_POST [ 'rowid' ]) && is_array ( $_POST [ 'rowid' ]))
2012-02-15 12:16:33 +01:00
{
2013-03-07 22:39:57 +01:00
foreach ( $_POST [ 'rowid' ] as $row )
2012-02-15 12:16:33 +01:00
{
if ( $row > 0 )
{
$result = $bankline -> fetch ( $row );
$bankline -> num_releve = $num_releve ; //$_POST["num_releve"];
$result = $bankline -> update_conciliation ( $user , $_POST [ " cat " ]);
2013-03-07 22:39:57 +01:00
if ( $result < 0 )
{
$mesg .= $bankline -> error ;
$error ++ ;
break ;
}
2012-02-15 12:16:33 +01:00
}
}
}
2005-05-08 18:42:05 +02:00
}
2009-04-20 22:53:08 +02:00
else
2009-01-09 20:53:26 +01:00
{
2013-03-07 22:39:57 +01:00
$error ++ ;
2009-01-09 20:53:26 +01:00
$langs -> load ( " errors " );
$mesg = '<div class="error">' . $langs -> trans ( " ErrorPleaseTypeBankTransactionReportName " ) . '</div>' ;
2005-05-08 22:35:07 +02:00
}
2013-03-07 22:39:57 +01:00
if ( ! $error )
{
2013-03-23 19:08:02 +01:00
header ( 'Location: ' . DOL_URL_ROOT . '/compta/bank/rappro.php?account=' . $id ); // To avoid to submit twice and allow back
2013-03-07 22:39:57 +01:00
exit ;
}
2005-05-08 22:35:07 +02:00
}
2004-08-03 22:16:27 +02:00
2005-05-08 22:35:07 +02:00
/*
2006-03-10 00:53:04 +01:00
* Action suppression ecriture
*/
2012-10-13 10:39:16 +02:00
if ( $action == 'del' )
2006-03-10 00:53:04 +01:00
{
2013-03-07 22:39:57 +01:00
$bankline = new AccountLine ( $db );
$bankline -> fetch ( $_GET [ " rowid " ]);
$result = $bankline -> delete ( $user );
2007-06-01 22:32:35 +02:00
if ( $result < 0 )
{
2013-03-07 22:39:57 +01:00
dol_print_error ( $db , $bankline -> error );
2002-05-11 20:53:13 +02:00
}
2005-05-08 22:35:07 +02:00
}
2006-03-10 00:53:04 +01:00
2012-02-15 12:16:33 +01:00
// Load bank groups
2005-05-08 22:35:07 +02:00
$sql = " SELECT rowid, label FROM " . MAIN_DB_PREFIX . " bank_categ ORDER BY label " ;
2005-08-21 17:22:46 +02:00
$resql = $db -> query ( $sql );
2005-05-08 22:35:07 +02:00
$options = " " ;
2012-02-15 12:16:33 +01:00
if ( $resql )
{
2005-05-08 22:35:07 +02:00
$var = True ;
2005-08-21 17:22:46 +02:00
$num = $db -> num_rows ( $resql );
2012-02-15 12:16:33 +01:00
if ( $num > 0 ) $options .= '<option value="0"' . ( GETPOST ( 'cat' ) ? '' : ' selected="true"' ) . '> </option>' ;
2005-05-08 22:35:07 +02:00
$i = 0 ;
2012-02-15 12:16:33 +01:00
while ( $i < $num )
{
2005-08-21 17:22:46 +02:00
$obj = $db -> fetch_object ( $resql );
2012-02-15 12:16:33 +01:00
$options .= '<option value="' . $obj -> rowid . '"' . ( GETPOST ( 'cat' ) == $obj -> rowid ? ' selected="true"' : '' ) . '>' . $obj -> label . '</option>' . " \n " ;
$i ++ ;
2005-05-08 22:35:07 +02:00
}
2005-08-21 17:22:46 +02:00
$db -> free ( $resql );
2012-02-15 12:16:33 +01:00
//print $options;
2005-05-08 22:35:07 +02:00
}
2012-02-15 12:16:33 +01:00
else dol_print_error ( $db );
2004-06-05 01:09:27 +02:00
2002-05-11 20:53:13 +02:00
2008-10-11 00:48:47 +02:00
/*
* View
*/
2009-01-09 20:53:26 +01:00
2008-10-11 00:48:47 +02:00
$form = new Form ( $db );
2006-03-10 00:53:04 +01:00
llxHeader ();
2009-04-20 22:53:08 +02:00
$societestatic = new Societe ( $db );
$chargestatic = new ChargeSociales ( $db );
$memberstatic = new Adherent ( $db );
$paymentstatic = new Paiement ( $db );
$paymentsupplierstatic = new PaiementFourn ( $db );
$paymentvatstatic = new TVA ( $db );
2005-05-08 22:35:07 +02:00
$acct = new Account ( $db );
2012-10-13 10:39:16 +02:00
$acct -> fetch ( $id );
2004-06-05 01:09:27 +02:00
2010-06-16 22:06:18 +02:00
$now = dol_now ();
2010-05-08 21:21:57 +02:00
$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 as type " ;
2005-10-12 00:39:05 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " bank as b " ;
2012-10-13 10:39:16 +02:00
$sql .= " WHERE rappro=0 AND fk_account= " . $acct -> id ;
2007-12-21 20:36:29 +01:00
$sql .= " ORDER BY dateo ASC " ;
2008-10-11 00:48:47 +02:00
$sql .= " LIMIT 1000 " ; // Limit to avoid page overload
2005-05-08 18:42:05 +02:00
2012-02-15 12:16:33 +01:00
/// ajax adjust value date
print '
< script type = " text/javascript " >
$ ( function () {
$ ( " a.ajax " ) . each ( function (){
var current = $ ( this );
current . click ( function ()
{
$ . get ( " '.DOL_URL_ROOT.'/core/ajax/bankconciliate.php? " + current . attr ( " href " ) . split ( " ? " )[ 1 ], function ( data )
{
current . parent () . prev () . replaceWith ( data );
});
return false ;
});
});
});
</ script >
' ;
2005-08-21 17:22:46 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
2005-05-08 22:35:07 +02:00
{
2005-10-12 00:39:05 +02:00
$var = True ;
$num = $db -> num_rows ( $resql );
2012-10-13 10:39:16 +02:00
print_fiche_titre ( $langs -> trans ( " Reconciliation " ) . ': <a href="account.php?account=' . $acct -> id . '">' . $acct -> label . '</a>' );
2005-10-12 00:39:05 +02:00
print '<br>' ;
2012-01-14 01:13:24 +01:00
dol_htmloutput_mesg ( $mesg );
2005-10-12 00:39:05 +02:00
2010-12-05 21:34:34 +01:00
// Show last bank receipts
2005-10-12 00:39:05 +02:00
$nbmax = 5 ;
$liste = " " ;
2011-07-20 21:03:31 +02:00
$sql = " SELECT DISTINCT num_releve FROM " . MAIN_DB_PREFIX . " bank " ;
2012-10-13 10:39:16 +02:00
$sql .= " WHERE fk_account= " . $acct -> id . " AND num_releve IS NOT NULL " ;
2011-07-20 21:03:31 +02:00
$sql .= $db -> order ( " num_releve " , " DESC " );
$sql .= $db -> plimit ( $nbmax + 1 );
2005-10-12 00:39:05 +02:00
print $langs -> trans ( " LastAccountStatements " ) . ' : ' ;
$resqlr = $db -> query ( $sql );
if ( $resqlr )
2005-05-08 22:35:07 +02:00
{
2005-10-12 00:39:05 +02:00
$numr = $db -> num_rows ( $resqlr );
$i = 0 ;
while (( $i < $numr ) && ( $i < $nbmax ))
2011-07-27 01:16:47 +02:00
{
2005-10-12 00:39:05 +02:00
$objr = $db -> fetch_object ( $resqlr );
$last_releve = $objr -> num_releve ;
$i ++ ;
2012-10-13 10:39:16 +02:00
$liste = '<a href="' . DOL_URL_ROOT . '/compta/bank/releve.php?account=' . $acct -> id . '&num=' . $objr -> num_releve . '">' . $objr -> num_releve . '</a> ' . $liste ;
2005-05-08 22:35:07 +02:00
}
2010-12-05 21:34:34 +01:00
if ( $numr >= $nbmax ) $liste = " ... " . $liste ;
2009-01-09 20:53:26 +01:00
print $liste ;
2010-12-05 21:34:34 +01:00
if ( $numr > 0 ) print '<br><br>' ;
2011-07-20 21:03:31 +02:00
else print '<b>' . $langs -> trans ( " None " ) . '</b><br><br>' ;
2005-10-12 00:39:05 +02:00
}
else
2005-08-21 17:22:46 +02:00
{
2009-02-20 23:53:15 +01:00
dol_print_error ( $db );
2005-05-08 22:35:07 +02:00
}
2005-10-12 00:39:05 +02:00
2012-02-15 12:16:33 +01:00
2013-03-07 22:39:57 +01:00
print '<form method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '?account=' . $acct -> id . '">' ;
2012-02-15 12:16:33 +01:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print " <input type= \" hidden \" name= \" action \" value= \" rappro \" > " ;
2012-10-13 10:39:16 +02:00
print " <input type= \" hidden \" name= \" account \" value= \" " . $acct -> id . " \" > " ;
2012-02-15 12:16:33 +01:00
print $langs -> trans ( " InputReceiptNumber " ) . ': ' ;
print '<input class="flat" name="num_releve" type="text" value="' . ( GETPOST ( 'num_releve' ) ? GETPOST ( 'num_releve' ) : $objp -> num_releve ) . '" size="10">' ;
print '<br>' ;
if ( $options )
{
print $langs -> trans ( " EventualyAddCategory " ) . ': <select class="flat" name="cat">' . $options . '</select><br>' ;
}
2013-03-07 22:39:57 +01:00
print '<br>' . $langs -> trans ( " ThenCheckLinesAndConciliate " ) . ' "' . $langs -> trans ( " Conciliate " ) . '"<br>' ;
2012-02-15 12:16:33 +01:00
print '<br>' ;
2011-07-20 21:03:31 +02:00
print '<table class="liste" width="100%">' ;
2012-02-15 12:16:33 +01:00
print '<tr class="liste_titre">' . " \n " ;
2005-11-10 22:04:45 +01:00
print '<td align="center">' . $langs -> trans ( " DateOperationShort " ) . '</td>' ;
print '<td align="center">' . $langs -> trans ( " DateValueShort " ) . '</td>' ;
2005-10-12 00:39:05 +02:00
print '<td>' . $langs -> trans ( " Type " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Description " ) . '</td>' ;
2013-04-25 01:13:13 +02:00
print '<td align="right" width="60" class="nowrap">' . $langs -> trans ( " Debit " ) . '</td>' ;
print '<td align="right" width="60" class="nowrap">' . $langs -> trans ( " Credit " ) . '</td>' ;
2012-02-15 12:16:33 +01:00
print '<td align="center" width="80">' . $langs -> trans ( " Action " ) . '</td>' ;
2013-04-25 01:13:13 +02:00
print '<td align="center" width="60" class="nowrap">' . $langs -> trans ( " ToConciliate " ) . '</td>' ;
2005-10-12 00:39:05 +02:00
print " </tr> \n " ;
$i = 0 ;
while ( $i < $num )
2005-05-08 22:35:07 +02:00
{
2005-10-12 00:39:05 +02:00
$objp = $db -> fetch_object ( $resql );
$var =! $var ;
2012-02-15 12:16:33 +01:00
print " <tr " . $bc [ $var ] . " > " ;
// print '<form method="post" action="rappro.php?account='.$_GET["account"].'">';
// print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// print "<input type=\"hidden\" name=\"rowid\" value=\"".$objp->rowid."\">";
2005-10-12 00:39:05 +02:00
2008-10-11 00:48:47 +02:00
// Date op
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' . dol_print_date ( $db -> jdate ( $objp -> do ), " day " ) . '</td>' ;
2009-04-20 22:53:08 +02:00
2008-10-11 00:48:47 +02:00
// Date value
if ( ! $objp -> rappro && ( $user -> rights -> banque -> modifier || $user -> rights -> banque -> consolidate ))
{
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' ;
2012-02-15 12:16:33 +01:00
print '<span id="datevalue_' . $objp -> rowid . '">' . dol_print_date ( $db -> jdate ( $objp -> dv ), " day " ) . " </span> " ;
print ' <span> ' ;
2012-10-13 10:39:16 +02:00
print '<a class="ajax" href="' . $_SERVER [ 'PHP_SELF' ] . '?action=dvprev&account=' . $acct -> id . '&rowid=' . $objp -> rowid . '">' ;
2008-10-11 00:48:47 +02:00
print img_edit_remove () . " </a> " ;
2012-10-13 10:39:16 +02:00
print '<a class="ajax" href="' . $_SERVER [ 'PHP_SELF' ] . '?action=dvnext&account=' . $acct -> id . '&rowid=' . $objp -> rowid . '">' ;
2012-02-15 12:16:33 +01:00
print img_edit_add () . " </a></span> " ;
2008-10-11 00:48:47 +02:00
print '</td>' ;
}
else
{
print '<td align="center">' ;
2010-05-08 21:21:57 +02:00
print dol_print_date ( $db -> jdate ( $objp -> dv ), " day " );
2008-10-11 00:48:47 +02:00
print '</td>' ;
}
2009-04-20 22:53:08 +02:00
2013-03-07 22:39:57 +01:00
// Type + Number
2010-07-25 23:23:57 +02:00
$label = ( $langs -> trans ( " PaymentType " . $objp -> type ) != " PaymentType " . $objp -> type ) ? $langs -> trans ( " PaymentType " . $objp -> type ) : $objp -> type ; // $objp->type is a code
if ( $label == 'SOLD' ) $label = '' ;
2013-04-25 01:13:13 +02:00
print '<td class="nowrap">' . $label . ( $objp -> num_chq ? ' ' . $objp -> num_chq : '' ) . '</td>' ;
2006-06-25 21:24:25 +02:00
// Description
print '<td valign="center"><a href="' . DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=' . $objp -> rowid . '&account=' . $acct -> id . '">' ;
$reg = array ();
2010-12-30 18:07:15 +01:00
preg_match ( '/\((.+)\)/i' , $objp -> label , $reg ); // Si texte entoure de parentheses on tente recherche de traduction
2006-06-25 21:24:25 +02:00
if ( $reg [ 1 ] && $langs -> trans ( $reg [ 1 ]) != $reg [ 1 ]) print $langs -> trans ( $reg [ 1 ]);
else print $objp -> label ;
print '</a>' ;
2009-04-20 22:53:08 +02:00
2005-10-12 00:39:05 +02:00
/*
2005-11-10 22:04:45 +01:00
* Ajout les liens ( societe , company ... )
2005-10-12 00:39:05 +02:00
*/
2005-11-10 22:04:45 +01:00
$newline = 1 ;
2005-10-12 00:39:05 +02:00
$links = $acct -> get_url ( $objp -> rowid );
foreach ( $links as $key => $val )
{
2012-01-14 01:13:24 +01:00
if ( $newline == 0 ) print ' - ' ;
else if ( $newline == 1 ) print '<br>' ;
2005-11-10 22:04:45 +01:00
if ( $links [ $key ][ 'type' ] == 'payment' ) {
2009-04-20 22:53:08 +02:00
$paymentstatic -> id = $links [ $key ][ 'url_id' ];
print ' ' . $paymentstatic -> getNomUrl ( 2 );
2005-11-10 22:04:45 +01:00
$newline = 0 ;
}
2007-05-27 21:17:34 +02:00
elseif ( $links [ $key ][ 'type' ] == 'payment_supplier' ) {
2009-04-20 22:53:08 +02:00
$paymentsupplierstatic -> id = $links [ $key ][ 'url_id' ];
$paymentsupplierstatic -> ref = $links [ $key ][ 'label' ];
print ' ' . $paymentsupplierstatic -> getNomUrl ( 1 );
2007-05-27 21:17:34 +02:00
$newline = 0 ;
}
2005-11-10 22:04:45 +01:00
elseif ( $links [ $key ][ 'type' ] == 'company' ) {
2012-01-14 01:13:24 +01:00
$societestatic -> id = $links [ $key ][ 'url_id' ];
$societestatic -> name = $links [ $key ][ 'label' ];
print $societestatic -> getNomUrl ( 1 , '' , 24 );
2005-11-10 22:04:45 +01:00
$newline = 0 ;
}
2007-10-30 00:42:30 +01:00
else if ( $links [ $key ][ 'type' ] == 'sc' ) {
2009-04-20 22:53:08 +02:00
$chargestatic -> id = $links [ $key ][ 'url_id' ];
$chargestatic -> ref = $links [ $key ][ 'url_id' ];
$chargestatic -> lib = $langs -> trans ( " SocialContribution " );
print ' ' . $chargestatic -> getNomUrl ( 1 );
2007-10-30 00:42:30 +01:00
}
2009-04-20 22:53:08 +02:00
else if ( $links [ $key ][ 'type' ] == 'payment_sc' )
{
2012-01-14 01:13:24 +01:00
// We don't show anything because there is 1 payment for 1 social contribution and we already show link to social contribution
/* print '<a href="' . DOL_URL_ROOT . '/compta/payment_sc/fiche.php?id=' . $links [ $key ][ 'url_id' ] . '">' ;
print img_object ( $langs -> trans ( 'ShowPayment' ), 'payment' ) . ' ' ;
2007-10-30 00:42:30 +01:00
print $langs -> trans ( " SocialContributionPayment " );
2012-01-14 01:13:24 +01:00
print '</a>' ; */
$newline = 2 ;
2007-10-30 00:42:30 +01:00
}
2009-04-20 22:53:08 +02:00
else if ( $links [ $key ][ 'type' ] == 'payment_vat' )
{
$paymentvatstatic -> id = $links [ $key ][ 'url_id' ];
$paymentvatstatic -> ref = $links [ $key ][ 'url_id' ];
$paymentvatstatic -> ref = $langs -> trans ( " VATPayment " );
print ' ' . $paymentvatstatic -> getNomUrl ( 1 );
2007-10-30 00:42:30 +01:00
}
else if ( $links [ $key ][ 'type' ] == 'banktransfert' ) {
print '<a href="' . DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=' . $links [ $key ][ 'url_id' ] . '">' ;
print img_object ( $langs -> trans ( 'ShowTransaction' ), 'payment' ) . ' ' ;
print $langs -> trans ( " TransactionOnTheOtherAccount " );
print '</a>' ;
}
2009-04-20 22:53:08 +02:00
else if ( $links [ $key ][ 'type' ] == 'member' ) {
print '<a href="' . DOL_URL_ROOT . '/adherents/fiche.php?rowid=' . $links [ $key ][ 'url_id' ] . '">' ;
print img_object ( $langs -> trans ( 'ShowMember' ), 'user' ) . ' ' ;
print $links [ $key ][ 'label' ];
print '</a>' ;
}
else {
//print ' - ';
print '<a href="' . $links [ $key ][ 'url' ] . $links [ $key ][ 'url_id' ] . '">' ;
2009-10-22 17:09:04 +02:00
if ( preg_match ( '/^\((.*)\)$/i' , $links [ $key ][ 'label' ], $reg ))
2009-04-20 22:53:08 +02:00
{
2009-10-22 17:09:04 +02:00
// Label generique car entre parentheses. On l'affiche en le traduisant
2009-04-20 22:53:08 +02:00
if ( $reg [ 1 ] == 'paiement' ) $reg [ 1 ] = 'Payment' ;
print $langs -> trans ( $reg [ 1 ]);
}
else
{
print $links [ $key ][ 'label' ];
}
print '</a>' ;
2005-11-10 22:04:45 +01:00
$newline = 0 ;
}
2005-10-12 00:39:05 +02:00
}
print '</td>' ;
if ( $objp -> amount < 0 )
2005-05-08 22:35:07 +02:00
{
2005-10-12 00:39:05 +02:00
print " <td align= \" right \" nowrap> " . price ( $objp -> amount * - 1 ) . " </td><td> </td> \n " ;
2005-05-08 22:35:07 +02:00
}
2005-10-12 00:39:05 +02:00
else
2005-05-08 22:35:07 +02:00
{
2005-10-12 00:39:05 +02:00
print " <td> </td><td align= \" right \" nowrap> " . price ( $objp -> amount ) . " </td> \n " ;
2005-05-08 22:35:07 +02:00
}
2005-10-12 00:39:05 +02:00
if ( $objp -> rappro )
2005-05-08 22:35:07 +02:00
{
2010-06-16 22:06:18 +02:00
// If line already reconciliated, we show receipt
2005-11-10 22:04:45 +01:00
print " <td align= \" center \" nowrap= \" nowrap \" ><a href= \" releve.php?num= $objp->num_releve &account= $acct->id\ " > $objp -> num_releve </ a ></ td > " ;
2005-05-08 22:35:07 +02:00
}
2005-10-12 00:39:05 +02:00
else
2005-05-08 22:35:07 +02:00
{
2010-06-16 22:06:18 +02:00
// If not already reconciliated
2005-10-11 23:14:34 +02:00
if ( $user -> rights -> banque -> modifier )
2005-05-08 18:42:05 +02:00
{
2013-04-25 01:13:13 +02:00
print '<td align="center" width="30" class="nowrap">' ;
2005-10-12 00:39:05 +02:00
2005-10-11 23:14:34 +02:00
print '<a href="' . DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=' . $objp -> rowid . '&account=' . $acct -> id . '&orig_account=' . $acct -> id . '">' ;
print img_edit ();
2005-11-10 22:04:45 +01:00
print '</a> ' ;
2012-10-13 10:39:16 +02:00
2012-04-30 15:01:25 +02:00
$now = dol_now ();
if ( $db -> jdate ( $objp -> do ) <= $now ) {
2005-10-11 23:14:34 +02:00
print '<a href="' . DOL_URL_ROOT . '/compta/bank/rappro.php?action=del&rowid=' . $objp -> rowid . '&account=' . $acct -> id . '">' ;
print img_delete ();
print '</a>' ;
}
else {
2009-10-22 17:09:04 +02:00
print " " ; // On n'empeche la suppression car le raprochement ne pourra se faire qu'apr<70> s la date pass<73> e et que l'<27> criture apparaisse bien sur le compte.
2005-10-11 23:14:34 +02:00
}
print " </td> " ;
2005-05-08 18:42:05 +02:00
}
2005-10-11 23:14:34 +02:00
else
2005-05-08 22:35:07 +02:00
{
2005-10-11 23:14:34 +02:00
print " <td align= \" center \" > </td> " ;
2005-05-08 18:42:05 +02:00
}
2005-05-08 22:35:07 +02:00
}
2005-10-12 00:39:05 +02:00
2013-03-07 22:39:57 +01:00
// Show checkbox for conciliation
2010-06-16 22:06:18 +02:00
if ( $db -> jdate ( $objp -> do ) <= $now )
2005-11-10 22:04:45 +01:00
{
2012-02-15 12:16:33 +01:00
2013-04-25 01:13:13 +02:00
print '<td align="center" class="nowrap">' ;
2013-03-07 22:39:57 +01:00
print '<input class="flat" name="rowid[' . $objp -> rowid . ']" type="checkbox" value="' . $objp -> rowid . '" size="1"' . ( ! empty ( $_POST [ 'rowid' ][ $objp -> rowid ]) ? ' checked="checked"' : '' ) . '>' ;
2012-02-15 12:16:33 +01:00
// print '<input class="flat" name="num_releve" type="text" value="'.$objp->num_releve.'" size="8">';
// print ' ';
// print "<input class=\"button\" type=\"submit\" value=\"".$langs->trans("Conciliate")."\">";
// if ($options)
// {
// print "<br><select class=\"flat\" name=\"cat\">$options";
// print "</select>";
// }
2005-10-12 00:39:05 +02:00
print " </td> " ;
}
else
{
2005-11-10 22:04:45 +01:00
print '<td align="left">' ;
2010-11-02 23:26:02 +01:00
print $langs -> trans ( " FutureTransaction " );
2005-11-10 22:04:45 +01:00
print '</td>' ;
2005-10-12 00:39:05 +02:00
}
print " </tr> \n " ;
2012-02-15 12:16:33 +01:00
2005-10-12 00:39:05 +02:00
$i ++ ;
2005-05-08 22:35:07 +02:00
}
2005-10-12 00:39:05 +02:00
$db -> free ( $resql );
2013-03-07 22:39:57 +01:00
print " </table><br> \n " ;
2005-10-12 00:39:05 +02:00
2013-03-30 14:27:13 +01:00
print '<div align="right"><input class="button" type="submit" value="' . $langs -> trans ( " Conciliate " ) . '"></div><br>' ;
2013-03-07 22:39:57 +01:00
print " </form> \n " ;
2012-02-15 12:16:33 +01:00
2005-08-21 17:22:46 +02:00
}
else
{
2009-02-20 23:53:15 +01:00
dol_print_error ( $db );
2005-05-08 22:35:07 +02:00
}
2002-05-11 20:53:13 +02:00
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-02-15 12:16:33 +01:00
$db -> close ();
2005-05-08 22:35:07 +02:00
?>