29require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/loan.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
54$langs->loadLangs(array(
"banks",
"bills",
"compta",
"loan"));
57$action =
GETPOST(
'action',
'aZ09');
59$cancel =
GETPOST(
'cancel',
'alpha');
69$hookmanager->initHooks(array(
'loancard',
'globalcard'));
74$permissiontoadd = $user->hasRight(
'loan',
'write');
85$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
87 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
91 if ($action ==
'confirm_paid' && $confirm ==
'yes' && $permissiontoadd) {
93 $result =
$object->setPaid($user);
95 setEventMessages($langs->trans(
'LoanPaid'),
null,
'mesgs');
102 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontoadd) {
105 $result =
$object->delete($user);
107 setEventMessages($langs->trans(
'LoanDeleted'),
null,
'mesgs');
108 header(
"Location: list.php");
116 if ($action ==
'add' && $permissiontoadd) {
127 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"LoanCapital")),
null,
'errors');
132 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DateStart")),
null,
'errors');
137 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DateEnd")),
null,
'errors');
142 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rate")),
null,
'errors');
149 $object->datestart = $datestart;
161 $accountancy_account_capital =
GETPOST(
'accountancy_account_capital');
162 $accountancy_account_insurance =
GETPOST(
'accountancy_account_insurance');
163 $accountancy_account_interest =
GETPOST(
'accountancy_account_interest');
165 if ($accountancy_account_capital <= 0) {
168 $object->account_capital = $accountancy_account_capital;
170 if ($accountancy_account_insurance <= 0) {
171 $object->account_insurance =
'';
173 $object->account_insurance = $accountancy_account_insurance;
175 if ($accountancy_account_interest <= 0) {
176 $object->account_interest =
'';
178 $object->account_interest = $accountancy_account_interest;
189 header(
"Location: list.php");
192 } elseif ($action ==
'update' && $permissiontoadd) {
203 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"LoanCapital")),
null,
'errors');
206 $object->datestart = $datestart;
219 $accountancy_account_capital =
GETPOST(
'accountancy_account_capital');
220 $accountancy_account_insurance =
GETPOST(
'accountancy_account_insurance');
221 $accountancy_account_interest =
GETPOST(
'accountancy_account_interest');
223 if ($accountancy_account_capital <= 0) {
226 $object->account_capital = $accountancy_account_capital;
228 if ($accountancy_account_insurance <= 0) {
229 $object->account_insurance =
'';
231 $object->account_insurance = $accountancy_account_insurance;
233 if ($accountancy_account_interest <= 0) {
234 $object->account_interest =
'';
236 $object->account_interest = $accountancy_account_interest;
240 $result =
$object->update($user);
243 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
250 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
256 if ($action ==
'classin' && $permissiontoadd) {
258 $result =
$object->setProject($projectid);
264 if ($action ==
'setlabel' && $permissiontoadd) {
266 $result =
$object->setValueFrom(
'label',
GETPOST(
'label'),
'',
null,
'text',
'', $user,
'LOAN_MODIFY');
273 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
281$form =
new Form($db);
284$outputlangs = $langs;
285$formaccounting =
null;
289$title = $langs->trans(
"Loan").
' - '.$langs->trans(
"Card");
290$help_url =
'EN:Module_Loan|FR:Module_Emprunt';
292llxHeader(
"", $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-loan page-card');
296if ($action ==
'create') {
298 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
302 print
'<form name="loan" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
303 print
'<input type="hidden" name="token" value="'.newToken().
'">';
304 print
'<input type="hidden" name="action" value="add">';
308 print
'<table class="border centpercent">';
311 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Label").
'</td><td><input name="label" class="minwidth300" maxlength="255" value="'.
dol_escape_htmltag(
GETPOST(
'label')).
'" autofocus="autofocus"></td></tr>';
315 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccount").
'</td><td>';
316 $form->select_comptes(
GETPOST(
"accountid"),
"accountid", 0,
"(courant:=:1)", 1);
319 print
'<tr><td>'.$langs->trans(
"BankAccount").
'</td><td>';
320 print $langs->trans(
"NoBankAccountDefined");
325 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanCapital").
'</td><td><input name="capital" size="10" value="'.
dol_escape_htmltag(
GETPOST(
"capital")).
'"></td></tr>';
329 print
'<td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
330 print $form->selectDate(!empty($datestart) ? $datestart : -1,
'start', 0, 0, 0,
'add', 1, 1);
335 print
'<td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
336 print $form->selectDate(!empty($dateend) ? $dateend : -1,
'end', 0, 0, 0,
'add', 1, 1);
340 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Nbterms").
'</td><td><input name="nbterm" size="5" value="'.
dol_escape_htmltag(
GETPOST(
'nbterm')).
'"></td></tr>';
343 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Rate").
'</td><td><input name="rate" size="5" value="'.
dol_escape_htmltag(
GETPOST(
"rate")).
'"> %</td></tr>';
346 $frequencies = array();
348 $frequencies[$key] = $langs->trans($label);
350 print
'<tr><td>'.$langs->trans(
"LoanFrequency").
'</td><td>'.$form->selectarray(
'frequency', $frequencies, (
GETPOSTINT(
'frequency') > 0 ?
GETPOSTINT(
'frequency') : 12)).
'</td></tr>';
351 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"LoanInterestBasis"), $langs->trans(
"LoanInterestBasisHelp")).
'</td><td>'.$form->selectarray(
'interest_basis', array(0 => $langs->trans(
'LoanInterestBasisPeriod'), 1 => $langs->trans(
'LoanInterestBasisDaily')),
GETPOSTINT(
'interest_basis')).
'</td></tr>';
354 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"LoanBalloon"), $langs->trans(
"LoanBalloonHelp")).
'</td><td><input name="balloon_amount" size="10" value="'.
dol_escape_htmltag(
GETPOST(
"balloon_amount")).
'" placeholder="'.$langs->trans(
'Amount').
'"></td></tr>';
357 $chargetypes = array();
359 $chargetypes[$key] = $langs->trans($label);
361 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"LoanCharge"), $langs->trans(
"LoanChargeHelp")).
'</td><td>';
362 print $form->selectarray(
'charge_type', $chargetypes,
GETPOSTINT(
'charge_type')).
' ';
363 print
'<input name="insurance_amount" size="10" value="'.dol_escape_htmltag(
GETPOST(
"insurance_amount")).
'" placeholder="'.$langs->trans(
'Amount').
'"> ';
364 print $form->selectarray(
'charge_per_payment', array(0 => $langs->trans(
'LoanChargeTotal'), 1 => $langs->trans(
'LoanChargePerPayment')),
GETPOSTINT(
'charge_per_payment'));
372 $langs->loadLangs(array(
"projects"));
374 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
376 $formproject->select_projects(-1, (
string) $projectid,
'projectid', 16, 0, 1, 1);
383 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
386 $doleditor =
new DolEditor(
'note_private',
GETPOST(
'note_private',
'alpha'),
'', 160,
'dolibarr_notes',
'In',
false,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_6,
'90%');
387 print $doleditor->Create(1);
393 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
395 $doleditor =
new DolEditor(
'note_public',
GETPOST(
'note_public',
'alpha'),
'', 160,
'dolibarr_notes',
'In',
false,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_6,
'90%');
396 print $doleditor->Create(1);
400 if (
isModEnabled(
'accounting') && $formaccounting !==
null) {
403 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"LoanAccountancyCapitalCode").
'</td>';
405 print $formaccounting->select_account(
GETPOST(
'accountancy_account_capital') ?
GETPOST(
'accountancy_account_capital') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL'),
'accountancy_account_capital', 1, array(), 1, 1);
409 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanAccountancyInsuranceCode").
'</td>';
411 print $formaccounting->select_account(
GETPOST(
'accountancy_account_insurance') ?
GETPOST(
'accountancy_account_insurance') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'),
'accountancy_account_insurance', 1, array(), 1, 1);
415 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanAccountancyInterestCode").
'</td>';
417 print $formaccounting->select_account(
GETPOST(
'accountancy_account_interest') ?
GETPOST(
'accountancy_account_interest') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_INTEREST'),
'accountancy_account_interest', 1, array(), 1, 1);
422 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"LoanAccountancyCapitalCode").
'</td>';
423 print
'<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.
'">';
427 print
'<tr><td>'.$langs->trans(
"LoanAccountancyInsuranceCode").
'</td>';
428 print
'<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.
'">';
432 print
'<tr><td>'.$langs->trans(
"LoanAccountancyInterestCode").
'</td>';
433 print
'<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.
'">';
440 print $form->buttonsSaveCancel(
"Add");
453 $totalpaid =
$object->getSumPayment();
456 if ($action ==
'paid') {
457 $text = $langs->trans(
'ConfirmPayLoan');
458 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
'PayLoan'), $text,
"confirm_paid",
'',
'', 2);
461 if ($action ==
'delete') {
462 $text = $langs->trans(
'ConfirmDeleteLoan');
463 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'DeleteLoan'), $text,
'confirm_delete',
'',
'', 2);
466 if ($action ==
'edit') {
467 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
468 print
'<input type="hidden" name="token" value="'.newToken().
'">';
469 print
'<input type="hidden" name="action" value="update">';
470 print
'<input type="hidden" name="id" value="'.$id.
'">';
473 print
dol_get_fiche_head($head,
'card', $langs->trans(
"Loan"), -1,
'money-bill-alt', 0,
'',
'', 0,
'', ($action ==
'edit' ? 0 : 1));
476 $linkback =
'<a href="'.DOL_URL_ROOT.
'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
478 $morehtmlref =
'<div class="refidno">';
480 $morehtmlref .= $form->editfieldkey(
"Label",
'label',
$object->label, $object, $user->hasRight(
'loan',
'write'),
'string',
'', 0, 1);
481 $morehtmlref .= $form->editfieldval(
"Label",
'label',
$object->label, $object, $user->hasRight(
'loan',
'write'),
'string',
'',
null,
null,
'', 1);
484 $langs->loadLangs(array(
"projects"));
485 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
486 if ($user->hasRight(
'loan',
'write')) {
487 if ($action !=
'classify') {
488 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
490 if ($action ==
'classify') {
493 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
494 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
495 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
496 $morehtmlref .= $formproject->select_projects(-1, (
string)
$object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
497 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
498 $morehtmlref .=
'</form>';
500 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, -1, (
string)
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
503 if (!empty(
$object->fk_project)) {
505 $proj->fetch(
$object->fk_project);
506 $morehtmlref .=
' : '.$proj->getNomUrl(1);
508 $morehtmlref .=
' - '.$proj->title;
515 $morehtmlref .=
'</div>';
517 $object->totalpaid = $totalpaid;
519 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlstatus);
521 print
'<div class="fichecenter">';
522 print
'<div class="fichehalfleft">';
523 print
'<div class="underbanner clearboth"></div>';
525 print
'<table class="border centpercent tableforfield">';
528 if ($action ==
'edit') {
529 print
'<tr><td class="fieldrequired titlefield">'.$langs->trans(
"LoanCapital").
'</td><td>';
530 print
'<input name="capital" size="10" value="'.$object->capital.
'"></td></tr>';
533 print
'<tr><td class="titlefield">'.$langs->trans(
"LoanCapital").
'</td><td><span class="amount">'.
price(
$object->capital, 0, $outputlangs, 1, -1, -1,
$conf->currency).
'</span></td></tr>';
537 if ($action ==
'edit') {
538 $chargetypes = array();
540 $chargetypes[$key] = $langs->trans($label);
542 print
'<tr><td class="titlefield">'.$form->textwithpicto($langs->trans(
"LoanCharge"), $langs->trans(
"LoanChargeHelp")).
'</td><td>';
543 print $form->selectarray(
'charge_type', $chargetypes, (
int)
$object->charge_type).
' ';
544 print
'<input name="insurance_amount" size="10" value="'.$object->insurance_amount.
'"> ';
545 print $form->selectarray(
'charge_per_payment', array(0 => $langs->trans(
'LoanChargeTotal'), 1 => $langs->trans(
'LoanChargePerPayment')), (
int)
$object->charge_per_payment);
549 print
'<tr><td class="titlefield">'.loanChargeLabel(
$object->charge_type, $langs).
'</td><td><span class="amount">'.
price(
$object->insurance_amount, 0, $outputlangs, 1, -1, -1,
$conf->currency).
'</span>'.((float)
$object->insurance_amount ?
' <span class="opacitymedium">'.$langs->trans(
$object->charge_per_payment ?
'LoanChargePerPayment' :
'LoanChargeTotal').
'</span>' :
'').
'</td></tr>';
553 print
'<tr><td>'.$langs->trans(
"DateStart").
"</td>";
555 if ($action ==
'edit') {
556 print $form->selectDate(
$object->datestart,
'start', 0, 0, 0,
'update', 1, 0);
563 print
'<tr><td>'.$langs->trans(
"DateEnd").
"</td>";
565 if ($action ==
'edit') {
566 print $form->selectDate(
$object->dateend,
'end', 0, 0, 0,
'update', 1, 0);
573 print
'<tr><td>'.$langs->trans(
"Nbterms").
'</td>';
575 if ($action ==
'edit') {
576 print
'<input name="nbterm" size="4" value="'.$object->nbterm.
'">';
583 print
'<tr><td>'.$langs->trans(
"Rate").
'</td>';
585 if ($action ==
'edit') {
586 print
'<input name="rate" size="4" value="'.$object->rate.
'">%';
593 $frequencies = array();
595 $frequencies[$key] = $langs->trans($label);
597 print
'<tr><td>'.$langs->trans(
"LoanFrequency").
'</td>';
599 if ($action ==
'edit') {
600 print $form->selectarray(
'frequency', $frequencies, (
int)
$object->frequency);
602 print $frequencies[(int)
$object->frequency] ?? (
int)
$object->frequency;
607 $bases = array(0 => $langs->trans(
'LoanInterestBasisPeriod'), 1 => $langs->trans(
'LoanInterestBasisDaily'));
608 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"LoanInterestBasis"), $langs->trans(
"LoanInterestBasisHelp")).
'</td>';
610 if ($action ==
'edit') {
611 print $form->selectarray(
'interest_basis', $bases, (
int)
$object->interest_basis);
613 print $bases[(int)
$object->interest_basis];
618 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"LoanBalloon"), $langs->trans(
"LoanBalloonHelp")).
'</td>';
620 if ($action ==
'edit') {
621 print
'<input name="balloon_amount" size="10" value="'.((float)
$object->balloon_amount ?
price2num(
$object->balloon_amount) :
'').
'">';
623 print ((
float)
$object->balloon_amount ?
'<span class="amount">'.price(
$object->balloon_amount, 0, $outputlangs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
629 if ($action ==
'edit') {
630 print
'<td class="nowrap fieldrequired">';
631 print $langs->trans(
"LoanAccountancyCapitalCode");
634 if (
isModEnabled(
'accounting') && $formaccounting !==
null) {
636 print $formaccounting->select_account(
$object->account_capital,
'accountancy_account_capital', 1, array(), 1, 1);
638 print
'<input name="accountancy_account_capital" size="16" value="'.$object->account_capital.
'">';
642 print
'<td class="nowrap">';
643 print $langs->trans(
"LoanAccountancyCapitalCode");
648 $accountingaccount->fetch(0,
$object->account_capital, 1);
650 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
652 print
$object->account_capital;
661 if ($action ==
'edit') {
662 print
'<td class="nowrap fieldrequired">';
666 if (
isModEnabled(
'accounting') && $formaccounting !==
null) {
668 print $formaccounting->select_account(
$object->account_insurance,
'accountancy_account_insurance', 1, array(), 1, 1);
670 print
'<input name="accountancy_account_insurance" size="16" value="'.$object->account_insurance.
'">';
674 print
'<td class="nowrap">';
680 $accountingaccount->fetch(0,
$object->account_insurance, 1);
682 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
684 print
$object->account_insurance;
693 if ($action ==
'edit') {
694 print
'<td class="nowrap fieldrequired">';
695 print $langs->trans(
"LoanAccountancyInterestCode");
698 if (
isModEnabled(
'accounting') && $formaccounting !==
null) {
700 print $formaccounting->select_account(
$object->account_interest,
'accountancy_account_interest', 1, array(), 1, 1);
702 print
'<input name="accountancy_account_interest" size="16" value="'.$object->account_interest.
'">';
706 print
'<td class="nowrap">';
707 print $langs->trans(
"LoanAccountancyInterestCode");
712 $accountingaccount->fetch(0,
$object->account_interest, 1);
714 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
716 print
$object->account_interest;
724 $parameters = array();
725 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
726 print $hookmanager->resPrint;
731 print
'<div class="fichehalfright">';
736 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp,";
737 $sql .=
" p.amount_capital, p.amount_insurance, p.amount_interest,";
738 $sql .=
" b.fk_account,";
739 $sql .=
" c.libelle as paiement_type";
740 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_loan as p";
741 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON p.fk_bank = b.rowid";
742 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepayment = c.id,";
743 $sql .=
" ".MAIN_DB_PREFIX.
"loan as l";
744 $sql .=
" WHERE p.fk_loan = ".((int) $id);
745 $sql .=
" AND p.fk_loan = l.rowid";
746 $sql .=
" AND l.entity IN ( ".getEntity(
'loan').
")";
747 $sql .=
" ORDER BY dp DESC";
750 $resql = $db->query($sql);
752 $num = $db->num_rows($resql);
756 print
'<div class="div-table-responsive-no-min">';
757 print
'<table class="noborder paymenttable">';
758 print
'<tr class="liste_titre">';
759 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
760 print
'<td>'.$langs->trans(
"Date").
'</td>';
761 print
'<td>'.$langs->trans(
"Type").
'</td>';
762 print
'<td>'.$langs->trans(
"BankAccount").
'</td>';
763 print
'<td class="right">'.loanChargeLabel(
$object->charge_type, $langs).
'</td>';
764 print
'<td class="right">'.$langs->trans(
"Interest").
'</td>';
765 print
'<td class="right">'.$langs->trans(
"LoanCapital").
'</td>';
766 print
'<td class="right">'.$langs->trans(
"Total").
'</td>';
769 $conf->cache[
'bankaccount'] = array();
772 $objp = $db->fetch_object($resql);
774 print
'<tr class="oddeven">';
775 print
'<td><a href="'.DOL_URL_ROOT.
'/loan/payment/card.php?id='.$objp->rowid.
'">'.img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
776 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
777 print
"<td>".$objp->paiement_type.
' '.$objp->num_payment.
"</td>\n";
779 if (!empty(
$conf->cache[
'bankaccount'][$objp->fk_account])) {
780 $tmpbank =
$conf->cache[
'bankaccount'][$objp->fk_account];
783 $tmpbank->fetch($objp->fk_account);
784 $conf->cache[
'bankaccount'][$objp->fk_account] = $tmpbank;
786 print $tmpbank->getNomUrl(1);
788 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1,
$conf->currency).
"</span></td>\n";
789 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1,
$conf->currency).
"</span></td>\n";
790 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1,
$conf->currency).
"</span></td>\n";
791 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_insurance + $objp->amount_interest + $objp->amount_capital, 0, $outputlangs, 1, -1, -1,
$conf->currency).
"</span></td>\n";
793 $total_capital += $objp->amount_capital;
797 $totalpaid = $total_capital;
800 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="nowrap right">'.
price($totalpaid, 0, $langs, 0, -1, -1,
$conf->currency).
'</td><td> </td></tr>';
801 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="nowrap right">'.
price(
$object->capital, 0, $outputlangs, 1, -1, -1,
$conf->currency).
'</td><td> </td></tr>';
803 $staytopay =
$object->capital - $totalpaid;
805 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"RemainderToPay").
' :</td>';
806 print
'<td class="nowrap right'.($staytopay ?
' amountremaintopay' :
' amountpaymentcomplete').
'">';
807 print
price($staytopay, 0, $langs, 0, -1, -1,
$conf->currency);
809 print
'<td> </td>';
817 dol_print_error($db);
823 print
'<div class="clearboth"></div>';
827 if ($action ==
'edit') {
828 print $form->buttonsSaveCancel();
836 if ($action !=
'edit') {
837 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
838 if (empty($reshook)) {
839 print
'<div class="tabsAction">';
842 if ((
$object->paid == 0 ||
$object->paid == 2) && $user->hasRight(
'loan',
'write')) {
843 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/loan/card.php?id='.
$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a></div>';
849 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/loan/payment/payment.php?id='.
$object->id.
'&action=create&token='.
newToken().
'">'.$langs->trans(
"DoPayment").
'</a></div>';
853 if ((
$object->paid == 0 ||
$object->paid == 2) && round($staytopay) <= 0 && $user->hasRight(
'loan',
'write')) {
854 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/loan/card.php?id='.
$object->id.
'&action=paid&token='.
newToken().
'">'.$langs->trans(
"ClassifyPaid").
'</a></div>';
858 if ((
$object->paid == 0 ||
$object->paid == 2) && $user->hasRight(
'loan',
'delete')) {
859 print
'<div class="inline-block divButAction">'.dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete', DOL_URL_ROOT.
'/loan/card.php?id='.
$object->id.
'&action=delete&token='.
newToken(),
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
'</div>'.
"\n";
867 dol_print_error(
null,
$object->error);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage bank accounts.
Class to manage accounting accounts.
Class to manage a WYSIWYG editor.
Class to manage projects.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
loan_prepare_head($object)
Prepare array with list of tabs.
loanChargeLabel($charge_type, $outputlangs)
Label of the charge of a loan (Insurance, Account-keeping fee, Other fee).
loanFrequencies()
Payment frequencies of a loan.
loanChargeTypes()
Kinds of charge the "insurance" amount of a loan can be.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.