36 global $db, $langs,
$conf;
41 $head[$tab][0] = DOL_URL_ROOT.
'/loan/card.php?id='.
$object->id;
42 $head[$tab][1] = $langs->trans(
'Card');
43 $head[$tab][2] =
'card';
46 $head[$tab][0] = DOL_URL_ROOT.
'/loan/schedule.php?loanid='.
$object->id;
47 $head[$tab][1] = $langs->trans(
'FinancialCommitment');
48 $head[$tab][2] =
'FinancialCommitment';
57 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
58 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
60 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
62 $head[$tab][0] = DOL_URL_ROOT.
'/loan/document.php?id='.
$object->id;
63 $head[$tab][1] = $langs->trans(
"Documents");
64 if (($nbFiles + $nbLinks) > 0) {
65 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
67 $head[$tab][2] =
'documents';
71 $nbNote = (empty(
$object->note_private) ? 0 : 1) + (empty(
$object->note_public) ? 0 : 1);
72 $head[$tab][0] = DOL_URL_ROOT.
"/loan/note.php?id=".
$object->id;
73 $head[$tab][1] = $langs->trans(
"Notes");
75 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
77 $head[$tab][2] =
'note';
81 $head[$tab][0] = DOL_URL_ROOT.
'/loan/info.php?id='.
$object->id;
82 $head[$tab][1] = $langs->trans(
"Info");
83 $head[$tab][2] =
'info';
106 require_once DOL_DOCUMENT_ROOT.
'/loan/class/loanschedule.class.php';
114 $numactualloadterm = ((int) $numactualloadterm);
115 $nbterm = ((int) $nbterm);
120 $cap_rest = $capital;
122 $int = ((float) $capital * ((
float) $rate / 12));
123 $int = round($int, 2, PHP_ROUND_HALF_UP);
124 $cap_rest = round((
float) $capital - ((
float) $mens - $int), 2, PHP_ROUND_HALF_UP);
126 $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);
128 $numactualloadterm++;
129 $capital = $cap_rest;
130 while ($numactualloadterm <= $nbterm) {
131 $mens = round(
$object->calcMonthlyPayments($capital, $rate, $nbterm - $numactualloadterm + 1), 2, PHP_ROUND_HALF_UP);
133 $int = ($capital * ((float) $rate / 12));
134 $int = round($int, 2, PHP_ROUND_HALF_UP);
135 $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
137 $output[$numactualloadterm] = array(
138 'cap_rest' => $cap_rest,
139 'cap_rest_str' =>
price($cap_rest, 0,
'', 1, -1, -1,
$conf->currency),
141 'interet_str' =>
price($int, 0,
'', 1, -1, -1,
$conf->currency),
144 $capital = $cap_rest;
145 $numactualloadterm++;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage Schedule of loans.
dol_dir_list($utf8_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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
loan_prepare_head($object)
Prepare array with list of tabs.
loanCalcMonthlyPayment($mens, $capital, $rate, $numactualloadterm, $nbterm)
Calculate remaining loan mensuality and interests.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...