27require
'../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/loan/class/paymentloan.class.php';
30if (isModEnabled(
"bank")) {
31 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
43$langs->loadLangs(array(
"bills",
"banks",
"companies",
"loan"));
47$action =
GETPOST(
'action',
'aZ09');
50 $socid = $user->socid;
57 $result = $payment->fetch($id);
69if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'loan',
'delete')) {
72 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"loan_schedule SET fk_bank = 0 WHERE fk_bank = ".((int) $payment->fk_bank);
75 $fk_loan = $payment->fk_loan;
77 $result = $payment->delete($user);
80 header(
"Location: ".DOL_URL_ROOT.
"/loan/card.php?id=".urlencode((
string) ($fk_loan)));
95$title = $langs->trans(
'Loans');
96$help_url =
"EN:Module_Loan|FR:Module_Emprunt";
98llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-loan page-payment-card');
102$head[$h][0] = DOL_URL_ROOT.
'/loan/payment/card.php?id='.
$id;
103$head[$h][1] = $langs->trans(
"PaymentLoan");
104$hselected = (string) $h;
107print
dol_get_fiche_head($head, $hselected, $langs->trans(
"PaymentLoan"), -1,
'payment');
112if ($action ==
'delete') {
113 print $form->formconfirm(
'card.php?id='.$payment->id, $langs->trans(
"DeletePayment"), $langs->trans(
"ConfirmDeletePayment"),
'confirm_delete',
'', 0, 2);
120dol_banner_tab($payment,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlstatus);
122print
'<div class="fichecenter">';
123print
'<div class="underbanner clearboth"></div>';
125print
'<table class="border centpercent">';
128print
'<tr><td>'.$langs->trans(
'Date').
'</td><td>'.
dol_print_date($payment->datep,
'day').
'</td></tr>';
131print
'<tr><td>'.$langs->trans(
'Mode').
'</td><td>'.$langs->trans(
"PaymentType".$payment->type_code).
'</td></tr>';
134print
'<tr><td>'.$langs->trans(
'LoanCapital').
'</td><td>'.
price($payment->amount_capital, 0, $langs, 1, -1, -1,
$conf->currency).
'</td></tr>';
135print
'<tr><td>'.$langs->trans(
'Insurance').
'</td><td>'.
price($payment->amount_insurance, 0, $langs, 1, -1, -1,
$conf->currency).
'</td></tr>';
136print
'<tr><td>'.$langs->trans(
'Interest').
'</td><td>'.
price($payment->amount_interest, 0, $langs, 1, -1, -1,
$conf->currency).
'</td></tr>';
139print
'<tr><td>'.$langs->trans(
'NotePrivate').
'</td><td>'.nl2br($payment->note_private).
'</td></tr>';
142print
'<tr><td>'.$langs->trans(
'NotePublic').
'</td><td>'.nl2br($payment->note_public).
'</td></tr>';
145if (isModEnabled(
"bank")) {
146 if ($payment->bank_account) {
148 $bankline->fetch($payment->bank_line);
151 print
'<td>'.$langs->trans(
'BankTransactionLine').
'</td>';
153 print $bankline->getNomUrl(1, 0,
'showall');
169$sql =
'SELECT l.rowid as id, l.label, l.paid, l.capital as capital, pl.amount_capital, pl.amount_insurance, pl.amount_interest';
170$sql .=
' FROM '.MAIN_DB_PREFIX.
'payment_loan as pl,'.MAIN_DB_PREFIX.
'loan as l';
171$sql .=
' WHERE pl.fk_loan = l.rowid';
172$sql .=
' AND l.entity = '.((int)
$conf->entity);
173$sql .=
' AND pl.rowid = '.((int) $payment->id);
175dol_syslog(
"loan/payment/card.php", LOG_DEBUG);
176$resql = $db->query($sql);
178 $num = $db->num_rows($resql);
182 print
'<br><table class="noborder centpercent">';
183 print
'<tr class="liste_titre">';
184 print
'<td>'.$langs->trans(
'Loan').
'</td>';
185 print
'<td>'.$langs->trans(
'Label').
'</td>';
187 print
'<td class="center">'.$langs->trans(
'Status').
'</td>';
188 print
'<td class="right">'.$langs->trans(
'PayedByThisPayment').
'</td>';
193 $objp = $db->fetch_object($resql);
195 print
'<tr class="oddeven">';
198 $loan->fetch($objp->id);
199 print $loan->getNomUrl(1);
202 print
'<td>'.$objp->label.
'</td>';
206 print
'<td class="center">'.$loan->getLibStatut(4, $objp->amount_capital).
'</td>';
208 $amount_payed = $objp->amount_capital + $objp->amount_insurance + $objp->amount_interest;
210 print
'<td class="right">'.price($amount_payed).
'</td>';
212 if ($objp->paid == 1) {
215 $total += $objp->amount_capital;
234print
'<div class="tabsAction">';
236if (empty($action) && $user->hasRight(
'loan',
'delete')) {
237 if (!$disable_delete) {
238 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&action=delete&token='.
newToken(),
'delete', 1);
240 print
dolGetButtonAction($langs->trans(
"CantRemovePaymentWithOneInvoicePaid"), $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', 0);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank transaction lines.
Class to manage payments of loans.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...