35 global $db, $langs, $conf;
40 $head[$tab][0] = DOL_URL_ROOT.
'/loan/card.php?id='.$object->id;
41 $head[$tab][1] = $langs->trans(
'Card');
42 $head[$tab][2] =
'card';
45 $head[$tab][0] = DOL_URL_ROOT.
'/loan/schedule.php?loanid='.$object->id;
46 $head[$tab][1] = $langs->trans(
'FinancialCommitment');
47 $head[$tab][2] =
'FinancialCommitment';
56 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
59 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
60 $nbLinks =
Link::count($db, $object->element, $object->id);
61 $head[$tab][0] = DOL_URL_ROOT.
'/loan/document.php?id='.$object->id;
62 $head[$tab][1] = $langs->trans(
"Documents");
63 if (($nbFiles + $nbLinks) > 0) {
64 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
66 $head[$tab][2] =
'documents';
70 $nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
71 $head[$tab][0] = DOL_URL_ROOT.
"/loan/note.php?id=".$object->id;
72 $head[$tab][1] = $langs->trans(
"Notes");
74 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
76 $head[$tab][2] =
'note';
80 $head[$tab][0] = DOL_URL_ROOT.
'/loan/info.php?id='.$object->id;
81 $head[$tab][1] = $langs->trans(
"Info");
82 $head[$tab][2] =
'info';
105 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
113 $numactualloadterm = ((int) $numactualloadterm);
114 $nbterm = ((int) $nbterm);
119 $cap_rest = $capital;
121 $int = ($capital * ($rate / 12));
122 $int = round($int, 2, PHP_ROUND_HALF_UP);
123 $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
125 $output[$numactualloadterm] = array(
'cap_rest'=>$cap_rest,
'cap_rest_str'=>
price($cap_rest, 0,
'', 1, -1, -1, $conf->currency),
'interet'=>$int,
'interet_str'=>
price($int, 0,
'', 1, -1, -1, $conf->currency),
'mens'=>$mens);
127 $numactualloadterm++;
128 $capital = $cap_rest;
129 while ($numactualloadterm <= $nbterm) {
130 $mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $numactualloadterm + 1), 2, PHP_ROUND_HALF_UP);
132 $int = ($capital * ($rate / 12));
133 $int = round($int, 2, PHP_ROUND_HALF_UP);
134 $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
136 $output[$numactualloadterm] = array(
137 'cap_rest' => $cap_rest,
138 'cap_rest_str' =>
price($cap_rest, 0,
'', 1, -1, -1, $conf->currency),
140 'interet_str' =>
price($int, 0,
'', 1, -1, -1, $conf->currency),
144 $capital = $cap_rest;
145 $numactualloadterm++;
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
price2num($amount, $rounding='', $option=0)
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.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
loanCalcMonthlyPayment($mens, $capital, $rate, $numactualloadterm, $nbterm)
Calculate remaining loan mensuality and interests.