Skip to content

Commit

Permalink
New: Loan - Show accounting account in card in view mode
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Jun 5, 2016
1 parent fda0799 commit bc92818
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
33 changes: 33 additions & 0 deletions htdocs/loan/card.php
Expand Up @@ -405,6 +405,39 @@
// Note Public
print '<tr><td>'.$langs->trans('NotePublic').'</td><td>'.nl2br($object->note_public).'</td></tr>';

// Accountancy account capital
print '<tr><td class="nowrap">';
print $langs->trans("LoanAccountancyCapitalCode");
print '</td><td>';
if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_capital);
} else {
print $object->account_capital;
}
print '</td></tr>';

// Accountancy account insurance
print '<tr><td class="nowrap">';
print $langs->trans("LoanAccountancyInsuranceCode");
print '</td><td>';
if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_insurance);
} else {
print $object->account_insurance;
}
print '</td></tr>';

// Accountancy account interest
print '<tr><td class="nowrap">';
print $langs->trans("LoanAccountancyInterestCode");
print '</td><td>';
if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_interest);
} else {
print $object->account_interest;
}
print '</td></tr>';

// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';

Expand Down
29 changes: 17 additions & 12 deletions htdocs/loan/class/loan.class.php
Expand Up @@ -72,7 +72,7 @@ function __construct($db)
function fetch($id)
{
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,";
$sql.= " l.paid";
$sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest";
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l";
$sql.= " WHERE l.rowid = ".$id;

Expand All @@ -84,17 +84,22 @@ function fetch($id)
{
$obj = $this->db->fetch_object($resql);

$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->datestart = $this->db->jdate($obj->datestart);
$this->dateend = $this->db->jdate($obj->dateend);
$this->label = $obj->label;
$this->capital = $obj->capital;
$this->nbterm = $obj->nbterm;
$this->rate = $obj->rate;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->paid = $obj->paid;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->datestart = $this->db->jdate($obj->datestart);
$this->dateend = $this->db->jdate($obj->dateend);
$this->label = $obj->label;
$this->capital = $obj->capital;
$this->nbterm = $obj->nbterm;
$this->rate = $obj->rate;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->paid = $obj->paid;

$this->account_capital = $obj->accountancy_account_capital;
$this->account_insurance = $obj->accountancy_account_insurance;
$this->account_interest = $obj->accountancy_account_interest;


return 1;
}
Expand Down

0 comments on commit bc92818

Please sign in to comment.