114 lines
3.0 KiB
PHP
114 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MonthlyUpdateAlternativeInvestmentFund extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['custom_id','commitment_amount','contribution_amount','contribution_called_amount','contribution_uncalled_amount','date_of_initial_contribution','face_value_nav_per_unit','principal_capital_repaid','gross_income','total_fees_paid','net_income','no_of_units_alloted','no_of_units_redeemed','current_valuation','current_nav','no_of_units_held','statement_reports','status'];
|
|
|
|
// const path = 'https://jerichoalternatives.in/api/get-statement-report/';
|
|
|
|
public function getStatementReportsAttribute($value)
|
|
{
|
|
|
|
$arr = [];
|
|
if($value){
|
|
foreach(json_decode($value) as $data){
|
|
$val = imagePath('api/get-statement-report/') . $data;
|
|
// $val = 'api/get-statement-report/' . $data;
|
|
array_push($arr,$val);
|
|
}
|
|
|
|
}
|
|
return $arr ;
|
|
}
|
|
|
|
|
|
public function getCommitmentAmountAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getContributionAmountAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getContributionCalledAmountAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getContributionUncalledAmountAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getGrossIncomeAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getTotalFeesPaidAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getFaceValueNavPerUnitAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getPrincipalCapitalRepaidAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getNetIncomeAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getCurrentValuationAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
public function getCurrentNavAttribute($value)
|
|
{
|
|
return $this->IND_money_format($value) ;
|
|
}
|
|
|
|
|
|
function IND_money_format($number)
|
|
{
|
|
$decimal = (string)($number - floor($number));
|
|
$money = floor($number);
|
|
$length = strlen($money);
|
|
$delimiter = '';
|
|
$money = strrev($money);
|
|
|
|
for ($i = 0; $i < $length; $i++) {
|
|
if (($i == 3 || ($i > 3 && ($i - 1) % 2 == 0)) && $i != $length) {
|
|
$delimiter .= ',';
|
|
}
|
|
$delimiter .= $money[$i];
|
|
}
|
|
|
|
$result = strrev($delimiter);
|
|
$decimal = preg_replace("/0\./i", ".", $decimal);
|
|
$decimal = substr($decimal, 0, 3);
|
|
|
|
if ($decimal != '0') {
|
|
$result = $result . $decimal;
|
|
}
|
|
|
|
return '₹ ' . $result;
|
|
}
|
|
}
|