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) $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
64 $head[$tab][2] =
'documents';
67 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
68 $nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
69 $head[$tab][0] = DOL_URL_ROOT.
"/loan/note.php?id=".$object->id;
70 $head[$tab][1] = $langs->trans(
"Notes");
71 if ($nbNote > 0) $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
72 $head[$tab][2] =
'note';
76 $head[$tab][0] = DOL_URL_ROOT.
'/loan/info.php?id='.$object->id;
77 $head[$tab][1] = $langs->trans(
"Info");
78 $head[$tab][2] =
'info';
99 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
106 $cap_rest = $capital;
108 $int = ($capital * ($rate / 12));
109 $int = round($int, 2, PHP_ROUND_HALF_UP);
110 $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
112 $output[$echance] = 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);
115 $capital = $cap_rest;
116 while ($echance <= $nbterm) {
117 $mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
119 $int = ($capital * ($rate / 12));
120 $int = round($int, 2, PHP_ROUND_HALF_UP);
121 $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
123 $output[$echance] = array(
124 'cap_rest' => $cap_rest,
125 'cap_rest_str' =>
price($cap_rest, 0,
'', 1, -1, -1, $conf->currency),
127 'interet_str' =>
price($int, 0,
'', 1, -1, -1, $conf->currency),
131 $capital = $cap_rest;
loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
Calculate remaining loan mensuality and interests.
loan_prepare_head($object)
Prepare array with list of tabs.
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...
Class to manage Schedule of loans.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
static count($db, $objecttype, $objectid)
Return nb of links.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).