24 require
'../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/loan/class/paymentloan.class.php';
27 if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
30 $langs->loadLangs(array(
"bills",
"banks",
"companies",
"loan"));
34 $action =
GETPOST(
'action',
'aZ09');
36 if ($user->socid) $socid = $user->socid;
43 $result = $payment->fetch($id);
53 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->loan->delete)
57 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"loan_schedule SET fk_bank = 0 WHERE fk_bank = ".$payment->fk_bank;
60 $fk_loan = $payment->fk_loan;
62 $result = $payment->delete($user);
66 header(
"Location: ".DOL_URL_ROOT.
"/loan/card.php?id=".$fk_loan);
81 $loan =
new Loan($db);
82 $form =
new Form($db);
86 $head[$h][0] = DOL_URL_ROOT.
'/loan/payment/card.php?id='.$id;
87 $head[$h][1] = $langs->trans(
"PaymentLoan");
96 if ($action ==
'delete')
98 print $form->formconfirm(
'card.php?id='.$payment->id, $langs->trans(
"DeletePayment"), $langs->trans(
"ConfirmDeletePayment"),
'confirm_delete',
'', 0, 2);
105 dol_banner_tab($payment,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
107 print '<div class="fichecenter">';
108 print '<div class="underbanner clearboth"></div>';
110 print '<table class="border centpercent">';
113 print '<tr><td>'.$langs->trans(
'Date').
'</td><td>'.
dol_print_date($payment->datep,
'day').
'</td></tr>';
116 print '<tr><td>'.$langs->trans(
'Mode').
'</td><td>'.$langs->trans(
"PaymentType".$payment->type_code).
'</td></tr>';
119 print '<tr><td>'.$langs->trans(
'LoanCapital').
'</td><td>'.
price($payment->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency).
'</td></tr>';
120 print '<tr><td>'.$langs->trans(
'Insurance').
'</td><td>'.
price($payment->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency).
'</td></tr>';
121 print '<tr><td>'.$langs->trans(
'Interest').
'</td><td>'.
price($payment->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency).
'</td></tr>';
124 print '<tr><td>'.$langs->trans(
'NotePrivate').
'</td><td>'.nl2br($payment->note_private).
'</td></tr>';
127 print '<tr><td>'.$langs->trans(
'NotePublic').
'</td><td>'.nl2br($payment->note_public).
'</td></tr>';
130 if (!empty($conf->banque->enabled))
132 if ($payment->bank_account)
135 $bankline->fetch($payment->bank_line);
138 print '<td>'.$langs->trans(
'BankTransactionLine').
'</td>';
140 print $bankline->getNomUrl(1, 0,
'showall');
156 $sql =
'SELECT l.rowid as id, l.label, l.paid, l.capital as capital, pl.amount_capital, pl.amount_insurance, pl.amount_interest';
157 $sql .=
' FROM '.MAIN_DB_PREFIX.
'payment_loan as pl,'.MAIN_DB_PREFIX.
'loan as l';
158 $sql .=
' WHERE pl.fk_loan = l.rowid';
159 $sql .=
' AND l.entity = '.$conf->entity;
160 $sql .=
' AND pl.rowid = '.$payment->id;
162 dol_syslog(
"loan/payment/card.php", LOG_DEBUG);
163 $resql = $db->query($sql);
166 $num = $db->num_rows(
$resql);
170 print '<br><table class="noborder centpercent">';
171 print '<tr class="liste_titre">';
172 print '<td>'.$langs->trans(
'Loan').
'</td>';
173 print '<td>'.$langs->trans(
'Label').
'</td>';
175 print '<td class="center">'.$langs->trans(
'Status').
'</td>';
176 print '<td class="right">'.$langs->trans(
'PayedByThisPayment').
'</td>';
183 $objp = $db->fetch_object(
$resql);
185 print '<tr class="oddeven">';
188 $loan->fetch($objp->id);
189 print $loan->getNomUrl(1);
192 print '<td>'.$objp->label.
'</td>';
196 print '<td class="center">'.$loan->getLibStatut(4, $objp->amount_capital).
'</td>';
198 $amount_payed = $objp->amount_capital + $objp->amount_insurance + $objp->amount_interest;
200 print '<td class="right">'.price($amount_payed).
'</td>';
202 if ($objp->paid == 1)
206 $total = $total + $objp->amount_capital;
225 print '<div class="tabsAction">';
227 if (empty($action) && !empty($user->rights->loan->delete))
229 if (!$disable_delete)
231 print '<a class="butActionDelete" href="card.php?id='.$id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
'Delete').
'</a>';
233 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"CantRemovePaymentWithOneInvoicePaid")).
'">'.$langs->trans(
'Delete').
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage bank transaction lines.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage payments of loans.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.