1551 lines
73 KiB
PHP
1551 lines
73 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Exports\UserProductExport;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\MonthlyUpdateMaster;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Imports\ImportMonthlyP2PFaircent;
|
|
use App\Imports\ImportMonthlyP2PFinancePeer;
|
|
use App\Imports\ImportMonthlyP2PLiquiloans;
|
|
use App\Imports\ImportMontlyUpdateFractionalRealEstate;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use App\Models\MonthlyUpdateIndianFinancialAssets;
|
|
use App\Imports\ImportMontlyUpdateIndianFinancialAssets;
|
|
use App\Imports\ImportMontlyUpdateAlternativeInvestmentFund;
|
|
use App\Models\Category;
|
|
use App\Models\Company;
|
|
use App\Models\MonthlyUpdateAlternativeInvestmentFund;
|
|
use App\Models\MonthlyUpdateFractionalRealEstate;
|
|
use App\Models\MonthlyUpdateMasterCommission;
|
|
use App\Models\MonthlyUpdatePeerToPeerLending;
|
|
use App\Models\Product;
|
|
use App\Notifications\UserAdmin;
|
|
use App\Exports\UserProduct;
|
|
use App\Models\AlternativeInvestmentFund;
|
|
use App\Models\FractionalRealEstate;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
|
|
class ManageUserProductController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$check = checkSidebarAccess('manage-user-product');
|
|
if(!$check)
|
|
{
|
|
abort(404);
|
|
}
|
|
// $userProduct = MonthlyUpdateMaster::with(['companies','investor', 'products'=>function($query){
|
|
// $query->WHEN('categories' == 'Alternative Investment Fund',function($query){
|
|
// $query->with('alternativeInvestmentFund');
|
|
// },function($query){
|
|
// $query->with('fractional_real_estate');
|
|
// });
|
|
// }])->latest()->get();
|
|
$userProduct = MonthlyUpdateMaster::with(['companies', 'investor', 'products'
|
|
// => function($query) {
|
|
// $query->with(['alternativeInvestmentFund' => function($q) {
|
|
// $q->when('categories' == 'Alternative Investment Fund', function($q) {
|
|
// $q->with('alternativeInvestmentFund');
|
|
// },);
|
|
// }])->with(['fractional_real_estate' => function($q) {
|
|
// $q->when('categories' != 'Alternative Investment Fund', function($q) {
|
|
// $q->with('fractional_real_estate');
|
|
// });
|
|
// }]);
|
|
// }
|
|
])->latest()->get();
|
|
foreach($userProduct as $data)
|
|
{
|
|
if($data->categories == 'Alternative Investment Fund')
|
|
{
|
|
$data['product_Name'] = AlternativeInvestmentFund::where('products_id',$data->products_id)->value('fund_name');
|
|
}
|
|
if($data->categories == 'Fractional Real Estate')
|
|
{
|
|
$data['product_Name'] = FractionalRealEstate::where('products_id',$data->products_id)->value('property_name_and_location');
|
|
}
|
|
}
|
|
// dd($userProduct[0]);
|
|
return view('Admin.Pages.manage_investors.manage_user_product.manage_user', compact('userProduct'));
|
|
}
|
|
|
|
public function exportUserProduct()
|
|
{
|
|
// dd('hello');
|
|
$data = MonthlyUpdateMaster::with(
|
|
['investor' => function($query){
|
|
$query->select('id','name');
|
|
// },'products.categorys' => function($query){
|
|
// $query->select('id','categories_id');
|
|
// }])->select('id','users_id','products_id','custom_id')->get();
|
|
},'products.categorys'])->get();
|
|
// dd($data->toArray());
|
|
$withClearData = collect();
|
|
$new = [];
|
|
$data->each(function($value) use($withClearData, $new){
|
|
$new['user_name'] = $value->investor->name;
|
|
$new['custom_id'] = $value->custom_id;
|
|
$new['investor_name'] = $value->investor->name;
|
|
$new['category'] = $value->products->categorys->category_name;
|
|
$new['holding_status'] = $value->holding_status;
|
|
$new['created_at'] = $value->created_at->format('d-m-Y');
|
|
$withClearData->push($new);
|
|
});
|
|
$columns = ['User Name', 'CustomId', 'Investor Name', 'Category', 'Holding Status', 'Created At'];
|
|
// dd($withClearData->sortByDesc('created_at'));
|
|
return Excel::download(new UserProductExport($withClearData->sortByDesc('created_at'), $columns), 'UsersProduct.XLSX');
|
|
}
|
|
|
|
public function redeemWithSoldAmount(Request $request)
|
|
{
|
|
// dd($request->all());
|
|
$validator = Validator::make($request->all(), [
|
|
'sold_amount' => 'required'
|
|
], [
|
|
'sold_amount.required' => 'This sold amount is required',
|
|
]);
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$productData = Product::find($request->product_id);
|
|
if ($request->categories == 'Fractional Real Estate') {
|
|
$getMonthlyId = MonthlyUpdateFractionalRealEstate::where('custom_id', $request->customId)->value('id');
|
|
} elseif ($request->categories == 'Alternative Investment Fund') {
|
|
$getMonthlyId = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $request->customId)->value('id');
|
|
}
|
|
|
|
$grossCommissionedEarned = ($request->sold_amount * $request->profitsharing) / 100;
|
|
$gst = ($grossCommissionedEarned * $productData->gst) / 100;
|
|
$tds = ($grossCommissionedEarned * $productData->tds) / 100;
|
|
|
|
$updateMonthlyUpdateCommission = MonthlyUpdateMasterCommission::create([
|
|
'monthly_id' => $getMonthlyId,
|
|
'total_investment_or_commitment_amount' => $request->sold_amount,
|
|
'applicable_rate' => $request->profitsharing,
|
|
'type_of_commission' => 'Profit Sharing',
|
|
'gross_commissioned_earned_inr' => $grossCommissionedEarned,
|
|
'gst' => $productData->gst,
|
|
'tds' => $productData->tds,
|
|
'net_commission_received' => $grossCommissionedEarned + $gst - $tds,
|
|
]);
|
|
}
|
|
|
|
public function getUserPan(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
if($id)
|
|
{
|
|
return MonthlyUpdateMaster::where('users_id',$id)->first('pan') ? response()->json(['status'=>200, 'message'=>MonthlyUpdateMaster::where('users_id',$id)->first('pan')]) : response()->json(['status'=>400, 'message'=>'']);
|
|
}
|
|
return response()->json(['status'=>400, 'message'=>'']);
|
|
}
|
|
|
|
public function monthlyUpdates($id)
|
|
{
|
|
$user = MonthlyUpdateMaster::findOrFail($id);
|
|
// dd($user);
|
|
|
|
$checkMonthlyUpdateIFA = MonthlyUpdateIndianFinancialAssets::where('custom_id', $user->custom_id)->exists();
|
|
$checkMonthlyUpdateP2P = MonthlyUpdatePeerToPeerLending::where('custom_id', $user->custom_id)->exists();
|
|
$checkMonthlyUpdateFRE = MonthlyUpdateFractionalRealEstate::where('custom_id', $user->custom_id)->exists();
|
|
$checkMonthlyUpdateAIF = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $user->custom_id)->exists();
|
|
// dd($checkMonthlyUpdateAIF);
|
|
$noData = true;
|
|
if ($checkMonthlyUpdateIFA) {
|
|
$noData = false;
|
|
$monthlyUpdate = MonthlyUpdateIndianFinancialAssets::where('custom_id', $user->custom_id)->get();
|
|
}
|
|
if ($checkMonthlyUpdateP2P) {
|
|
$noData = false;
|
|
$monthlyUpdate = MonthlyUpdatePeerToPeerLending::where('custom_id', $user->custom_id)->get();
|
|
}
|
|
if ($checkMonthlyUpdateFRE) {
|
|
$noData = false;
|
|
$monthlyUpdate = MonthlyUpdateFractionalRealEstate::where('custom_id', $user->custom_id)->get();
|
|
}
|
|
if ($checkMonthlyUpdateAIF) {
|
|
$noData = false;
|
|
$monthlyUpdate = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $user->custom_id)->get();
|
|
}
|
|
|
|
if ($noData) {
|
|
abort(404);
|
|
}
|
|
// $monthlyUpdate = MonthlyUpdateIndianFinancialAssets::where('custom_id',$user->custom_id)->get();
|
|
return view('Admin.Pages.manage_investors.manage_user_product.monthly_update', compact('user', 'monthlyUpdate'));
|
|
}
|
|
|
|
public function importMonthlyUpdateBlade()
|
|
{
|
|
return view('Admin.Pages.manage_investors.manage_user_product.import_monthly_update');
|
|
}
|
|
|
|
public function storeUserProduct()
|
|
{
|
|
$users = User::query()
|
|
->join('user_kycs', 'users.id', 'user_kycs.users_id')
|
|
->where('user_kycs.status', 'Approved')
|
|
->pluck('users.name', 'users.id');
|
|
$aifProductNames = $this->getAllProductNames([Category::VentureCapitalFundId, Category::InfrastructureFundId, Category::AngelFundId, Category::PrivateEquityFundId, Category::DebtFundId, Category::PrivateRealEstateFundId, Category::PrivateInvestmentInPublicEquityFundId,Category::LongOnlyFundId,Category::PrivateCreditFundId]);
|
|
$freProductNames = $this->getAllProductNames([Category::FractionalRealEstateId]);
|
|
// $p2pProductNames = $this->getAllProductNames(Category::PeerToPeerLendingId);
|
|
// $ifaProductNames = $this->getAllProductNames(Category::InvoiceDiscountingId, Category::CleanAndGreenAssetsId, Category::VentureDebtId, Category::HighYieldFinanceId, Category::SecuritizedDebtInstrumentId, Category::LeaseBasedFinancingId, Category::RevenueBasedFinancingId);
|
|
// $lbfProductNames = $this->getAllProductNames(Category::LeaseBasedFinancingId);
|
|
// $cagaProductNames = $this->getAllProductNames(Category::CleanAndGreenAssetsId);
|
|
// $vdProductNames = $this->getAllProductNames(Category::VentureDebtId);
|
|
// $hyfProductNames = $this->getAllProductNames(Category::HighYieldFinanceId);
|
|
// $sdiProductNames = $this->getAllProductNames(Category::SecuritizedDebtInstrumentId);
|
|
// $idProductNames = $this->getAllProductNames(Category::InvoiceDiscountingId);
|
|
|
|
|
|
|
|
// making unique custom id
|
|
$count = MonthlyUpdateMaster::get()->count();
|
|
$customID = 'JA';
|
|
$customIDLength = strlen((string)$count) > 6 ? strlen((string)$count) : 6;
|
|
for($j=$customIDLength; $j>strlen((string)$count); $j--)
|
|
{
|
|
$customID .= '0';
|
|
}
|
|
$customID .= $count;
|
|
|
|
$companies = Company::active()->get();
|
|
$data = MonthlyUpdateMaster::get();
|
|
// return view('Admin.Pages.manage_investors..manage_user_product.manage_user_add', compact('users','aifProductNames','freProductNames','p2pProductNames','ifaProductNames','lbfProductNames','cagaProductNames','vdProductNames','hyfProductNames','sdiProductNames','idProductNames','companies'));
|
|
return view('Admin.Pages.manage_investors.manage_user_product.manage_user_add', compact('users', 'aifProductNames', 'freProductNames', 'companies','customID','data'));
|
|
}
|
|
|
|
public function userProduct(Request $request){
|
|
$data = Product::with('alternativeInvestmentFund.companies','categorys')->where('id',$request->id)->first();
|
|
// dd($data);
|
|
if($data->alternativeInvestmentFund != null){
|
|
return response()->json(['status'=>200,'category'=>'aif','data'=>$data]);
|
|
}
|
|
$data = Product::with('fractional_real_estate','categorys')->where('id',$request->id)->first();
|
|
if($data->fractional_real_estate != null){
|
|
return response()->json(['status'=>200,'category'=>'fre','data'=>$data]);
|
|
}
|
|
}
|
|
|
|
function getAllProductNames($categoriesId)
|
|
{
|
|
return Product::
|
|
// leftJoin('securitized_debt_instruments as sdi', 'products.id', 'sdi.products_id')
|
|
leftJoin('fractional_real_estates as fre', 'products.id', 'fre.products_id')
|
|
// ->leftJoin('peer_to_peer_lendings as p2p', 'products.id', 'p2p.products_id')
|
|
// ->leftJoin('invoice_discountings as id', 'products.id', 'id.products_id')
|
|
->leftJoin('alternative_investment_funds as aif', 'products.id', 'aif.products_id')
|
|
// ->leftJoin('clean_and_green_assets as caga', 'products.id', 'caga.products_id')
|
|
// ->leftJoin('high_yield_finances as hyf', 'products.id', 'hyf.products_id')
|
|
// ->leftJoin('lease_based_financings as lbf', 'products.id', 'lbf.products_id')
|
|
// ->leftJoin('venture_debts as vd', 'products.id', 'vd.products_id')
|
|
// ->leftJoin('bonds as bd', 'products.id', 'bd.products_id')
|
|
// ->leftJoin('funds as fd', 'products.id', 'fd.products_id')
|
|
// ->leftJoin('stock_funds_real_estate_exchanges as exchange', 'products.id', 'exchange.products_id')
|
|
// ->leftJoin('real_estates as re', 'products.id', 're.products_id')
|
|
->where(function ($query) use ($categoriesId) {
|
|
$query->where('status', true);
|
|
$query->whereIn('categories_id', $categoriesId);
|
|
})
|
|
// ->select(\DB::raw('products.id,coalesce(sdi.product_name, p2p.scheme, fre.property_name_and_location,id.company_name,aif.fund_name,caga.project_name,hyf.security_name,lbf.company,sdi.product_name,vd.company_name,bd.issuer,fd.fund_name,exchange.name,re.property_name,lbf.company,caga.project_name) as product_name'))->get();
|
|
->select(\DB::raw('products.id,coalesce(fre.property_name_and_location, aif.fund_name) as product_name'))
|
|
->get();
|
|
}
|
|
|
|
public function storeMonthlyUpdatesForIFA(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'user_id' => 'required',
|
|
'categories' => 'required',
|
|
'custom_id' => 'required|unique:monthly_update_masters,custom_id',
|
|
'investor_name' => 'required',
|
|
'pan' => 'required',
|
|
'product_category' => 'required',
|
|
'investment_platform' => 'required',
|
|
'product_name' => 'required',
|
|
'counter_party' => 'required',
|
|
'repayment_schedule.*' => 'required|max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'repayment_schedule.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$monthlyUpdate = MonthlyUpdateMaster::create([
|
|
'users_id' => $request->user_id,
|
|
'categories' => $request->categories,
|
|
'custom_id' => $request->custom_id,
|
|
'investor_name' => $request->investor_name,
|
|
'pan' => $request->pan,
|
|
'product_category' => $request->product_category,
|
|
'investment_platform' => $request->investment_platform,
|
|
'product_name' => $request->product_name,
|
|
'counter_party' => $request->counter_party,
|
|
]);
|
|
|
|
$repaymentScheduleArray = array();
|
|
$count = 0;
|
|
if ($request->repayment_schedule) {
|
|
foreach ($request->repayment_schedule as $key => $repaymentSchedule) {
|
|
$repaymentScheduleName = $key . $request->user_id . time() . ++$count . '.' . $repaymentSchedule->extension();
|
|
$repaymentSchedule->storeAs('files/monthly-update', $repaymentScheduleName);
|
|
array_push($repaymentScheduleArray, $repaymentScheduleName);
|
|
}
|
|
}
|
|
|
|
$monthlyUpdateIFA = MonthlyUpdateIndianFinancialAssets::create([
|
|
'custom_id' => $request->custom_id,
|
|
'investment_date' => $request->investment_date,
|
|
'amount_invested' => $request->amount_invested,
|
|
'total_gross_repaid_amount' => $request->total_gross_repaid_amount,
|
|
'tenure_in_days' => $request->tenure_in_days,
|
|
'principal_payment_frequency' => $request->principal_payment_frequency,
|
|
'interest_payment_frequency' => $request->interest_payment_frequency,
|
|
'next_repayment_due_date' => $request->next_repayment_due_date,
|
|
'maturity_date' => $request->maturity_date,
|
|
'next_repayment_amount' => $request->next_repayment_amount,
|
|
'expected_irr' => $request->expected_irr,
|
|
'repayment_schedule' => json_encode($repaymentScheduleArray)
|
|
]);
|
|
|
|
if ($monthlyUpdate && $monthlyUpdateIFA) {
|
|
$notify = $this->sendNotificationToUser($request->user_id, $request->product_name);
|
|
return response()->json(['status' => 200, 'message' => "Successfully Assigned Product to $request->investor_name"]);
|
|
}
|
|
return response()->json(['status' => 400, 'message' => 'Products Could Not Be Assigned Successfully']);
|
|
}
|
|
|
|
public function importMonthlyUpdate(Request $request)
|
|
{
|
|
request()->validate([
|
|
'categories' => 'required',
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
], [
|
|
'required' => 'The :attribute field must be required'
|
|
]);
|
|
$categories = $request->categories;
|
|
|
|
$ifaValues = ['Invoice Discounting', 'Clean And Green Assets', 'Venture Debt', 'High Yield Finance', 'Securitized Debt Instrument', 'Lease Based Financing', 'Revenue Based Financing'];
|
|
|
|
if (in_array($categories, $ifaValues)) {
|
|
Excel::import(new ImportMontlyUpdateIndianFinancialAssets, $request->file('productFile'));
|
|
}
|
|
if ($categories == 'FractionalRealEstate') {
|
|
Excel::import(new ImportMontlyUpdateFractionalRealEstate, $request->file('productFile'));
|
|
}
|
|
|
|
if ($categories == 'AlternativeInvestmentFund') {
|
|
Excel::import(new ImportMontlyUpdateAlternativeInvestmentFund, $request->file('productFile'));
|
|
}
|
|
|
|
// if ($categories == 'Liquiloans') {
|
|
// Excel::import(new ImportMonthlyP2PLiquiloans, $request->file('productFile'));
|
|
// }
|
|
|
|
// if ($categories == 'Faircent') {
|
|
// Excel::import(new ImportMonthlyP2PFaircent, $request->file('productFile'));
|
|
// }
|
|
|
|
// if ($categories == 'FinancePeer') {
|
|
// Excel::import(new ImportMonthlyP2PFinancePeer, $request->file('productFile'));
|
|
// }
|
|
|
|
return redirect()->route('manage-user-product')->with('success', "Monthly Update Imported Successfully.");
|
|
}
|
|
|
|
public function validationError($validator)
|
|
{
|
|
if ($validator->fails()) {
|
|
$errors = $validator->errors();
|
|
$messages = '';
|
|
foreach ($errors->all() as $message) {
|
|
$messages .= $message . '</br>';
|
|
}
|
|
return $messages;
|
|
}
|
|
}
|
|
|
|
public function viewUserProduct($id)
|
|
{
|
|
|
|
$details = MonthlyUpdateMaster::find($id)->get();
|
|
return view('Admin.Pages.manage_investors.manage_user_product.manage_user', compact('details'));
|
|
}
|
|
public function updateStatus(Request $request)
|
|
{
|
|
|
|
$data = MonthlyUpdateMaster::where('id', $request->id)->first();
|
|
|
|
if ($data) {
|
|
if ($request->status == '1') {
|
|
$data->status = '0';
|
|
} else {
|
|
$data->status = '1';
|
|
}
|
|
$data->save();
|
|
}
|
|
|
|
return response(['status' => 200]);
|
|
}
|
|
|
|
public function editProduct(Request $request)
|
|
{
|
|
// dd($request->all());
|
|
// return $request->update_id;
|
|
$update_data = MonthlyUpdateMaster::where('id', $request->eid)->update([
|
|
"users_id" => $request->euserid,
|
|
"categories" => $request->categories,
|
|
// "custom_id"=>$request->interest_paidout,
|
|
"investor_name" => $request->investor_name,
|
|
"pan" => $request->pan,
|
|
"product_category" => $request->product_category,
|
|
"investment_platform" => $request->investment_platform,
|
|
"product_name" => $request->product_name,
|
|
"counter_party" => $request->counter_party,
|
|
"account_number" => $request->account_number,
|
|
"spv_details" => $request->spv_details,
|
|
]);
|
|
// return $update_data;
|
|
if ($update_data) {
|
|
return response()->json(
|
|
[
|
|
"status" => "success",
|
|
"code" => 200,
|
|
"message" => "Data updated successfully",
|
|
]
|
|
);
|
|
} else {
|
|
return response()->json(
|
|
[
|
|
"status" => "failed",
|
|
"code" => 200,
|
|
"message" => "Data not updated. Error!!"
|
|
]
|
|
);
|
|
}
|
|
}
|
|
|
|
public function storeMonthlyUpdatesForP2PLiquiloans(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'user_id' => 'required',
|
|
'categories' => 'required',
|
|
'custom_id' => 'required|unique:monthly_update_masters,custom_id',
|
|
'investor_name' => 'required',
|
|
'pan' => 'required',
|
|
'total_investment' => 'required',
|
|
'investment_platform' => 'required',
|
|
'principal_redemption' => 'required',
|
|
'interest_paidout' => 'required',
|
|
'net_principal_investment' => 'required',
|
|
'capitalised_interest' => 'required',
|
|
'accrued_interest' => 'required',
|
|
'portfolio_value' => 'required',
|
|
'absolute_return_in_rs' => 'required',
|
|
'absolute_return_in_pct' => 'required',
|
|
'annualised_return' => 'required',
|
|
'statement_reports.*' => 'required|max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'statement_reports.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$monthlyUpdate = MonthlyUpdateMaster::create([
|
|
'users_id' => $request->user_id,
|
|
'categories' => $request->categories,
|
|
'custom_id' => $request->custom_id,
|
|
'investor_name' => $request->investor_name,
|
|
'product_name' => $request->product_name,
|
|
'pan' => $request->pan,
|
|
'investment_platform' => $request->investment_platform,
|
|
]);
|
|
|
|
$statementReportsArray = array();
|
|
if ($request->statement_reports) {
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->user_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
}
|
|
|
|
$monthlyUpdateIFA = MonthlyUpdatePeerToPeerLending::create([
|
|
'custom_id' => $request->custom_id,
|
|
'total_investment' => $request->total_investment,
|
|
'principal_redemption' => $request->principal_redemption,
|
|
'interest_paidout' => $request->interest_paidout,
|
|
'net_principal_investment' => $request->net_principal_investment,
|
|
'capitalised_interest' => $request->capitalised_interest,
|
|
'accrued_interest' => $request->accrued_interest,
|
|
'portfolio_value' => $request->portfolio_value,
|
|
'absolute_return_in_rs' => $request->absolute_return_in_rs,
|
|
'absolute_return_in_pct' => $request->absolute_return_in_pct,
|
|
'annualised_return' => $request->annualised_return,
|
|
'statement_reports' => json_encode($statementReportsArray)
|
|
]);
|
|
|
|
if ($monthlyUpdate && $monthlyUpdateIFA) {
|
|
$notify = $this->sendNotificationToUser($request->user_id, $request->product_name);
|
|
return response()->json(['status' => 200, 'message' => "Successfully Assigned Peer To Peer Lending Product to $request->investor_name"]);
|
|
}
|
|
return response()->json(['status' => 400, 'message' => 'Products Could Not Be Assigned Successfully']);
|
|
}
|
|
|
|
public function storeMonthlyUpdatesForP2PFaircent(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'user_id' => 'required',
|
|
'categories' => 'required',
|
|
'custom_id' => 'required|unique:monthly_update_masters,custom_id',
|
|
'investor_name' => 'required',
|
|
'pan' => 'required',
|
|
'total_value' => 'required',
|
|
'investment_amount' => 'required',
|
|
'investment_platform' => 'required',
|
|
'all_time_amount_invested' => 'required',
|
|
'interest_accrued' => 'required',
|
|
'net_interest_redemption' => 'required',
|
|
'escrow_balance' => 'required',
|
|
'average_roi' => 'required',
|
|
'statement_reports.*' => 'required|max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'statement_reports.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$monthlyUpdate = MonthlyUpdateMaster::create([
|
|
'users_id' => $request->user_id,
|
|
'categories' => $request->categories,
|
|
'custom_id' => $request->custom_id,
|
|
'investor_name' => $request->investor_name,
|
|
'product_name' => $request->product_name,
|
|
'pan' => $request->pan,
|
|
'investment_platform' => $request->investment_platform,
|
|
]);
|
|
|
|
$statementReportsArray = array();
|
|
if ($request->statement_reports) {
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->user_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
}
|
|
|
|
$monthlyUpdateIFA = MonthlyUpdatePeerToPeerLending::create([
|
|
'custom_id' => $request->custom_id,
|
|
'total_value' => $request->total_value,
|
|
'investment_amount' => $request->investment_amount,
|
|
'all_time_amount_invested' => $request->all_time_amount_invested,
|
|
'interest_accrued' => $request->interest_accrued,
|
|
'net_interest_redemption' => $request->net_interest_redemption,
|
|
'escrow_balance' => $request->escrow_balance,
|
|
'average_roi' => $request->average_roi,
|
|
'statement_reports' => json_encode($statementReportsArray)
|
|
]);
|
|
|
|
if ($monthlyUpdate && $monthlyUpdateIFA) {
|
|
$notify = $this->sendNotificationToUser($request->user_id, $request->product_name);
|
|
return response()->json(['status' => 200, 'message' => "Successfully Assigned Peer To Peer Lending Product to $request->investor_name"]);
|
|
}
|
|
return response()->json(['status' => 400, 'message' => 'Products Could Not Be Assigned Successfully']);
|
|
}
|
|
|
|
public function storeMonthlyUpdatesForP2PFinancePeer(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'user_id' => 'required',
|
|
'categories' => 'required',
|
|
'custom_id' => 'required|unique:monthly_update_masters,custom_id',
|
|
'investor_name' => 'required',
|
|
'investment_platform' => 'required',
|
|
'pan' => 'required',
|
|
'all_time_investment_added' => 'required',
|
|
'total_active_investment' => 'required',
|
|
'net_expected_value_at_maturity' => 'required',
|
|
'net_asset_value' => 'required',
|
|
'amount_withdrawn' => 'required',
|
|
'interest_paidout' => 'required',
|
|
'absolute_return_in_rs' => 'required',
|
|
'absolute_return_in_pct' => 'required',
|
|
'statement_reports.*' => 'required|max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique'
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$monthlyUpdate = MonthlyUpdateMaster::create([
|
|
'users_id' => $request->user_id,
|
|
'categories' => $request->categories,
|
|
'custom_id' => $request->custom_id,
|
|
'investor_name' => $request->investor_name,
|
|
'product_name' => $request->product_name,
|
|
'pan' => $request->pan,
|
|
'investment_platform' => $request->investment_platform,
|
|
]);
|
|
|
|
$statementReportsArray = array();
|
|
if ($request->statement_reports) {
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->user_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
}
|
|
|
|
$monthlyUpdateIFA = MonthlyUpdatePeerToPeerLending::create([
|
|
'custom_id' => $request->custom_id,
|
|
'all_time_investment_added' => $request->all_time_investment_added,
|
|
'total_active_investment' => $request->total_active_investment,
|
|
'net_expected_value_at_maturity' => $request->net_expected_value_at_maturity,
|
|
'net_asset_value' => $request->net_asset_value,
|
|
'amount_withdrawn' => $request->amount_withdrawn,
|
|
'interest_paidout' => $request->interest_paidout,
|
|
'absolute_return_in_rs' => $request->absolute_return_in_rs,
|
|
'absolute_return_in_pct' => $request->absolute_return_in_pct,
|
|
'statement_reports' => json_encode($statementReportsArray)
|
|
]);
|
|
|
|
if ($monthlyUpdate && $monthlyUpdateIFA) {
|
|
$notify = $this->sendNotificationToUser($request->user_id, $request->product_name);
|
|
return response()->json(['status' => 200, 'message' => "Successfully Assigned Peer To Peer Lending Product to $request->investor_name"]);
|
|
}
|
|
return response()->json(['status' => 400, 'message' => 'Products Could Not Be Assigned Successfully']);
|
|
}
|
|
|
|
public function updateLiquiloansMonthlyUpdate(Request $request)
|
|
{
|
|
$validator = Validator::make($request->all(), [
|
|
"total_investment" => "required",
|
|
"principal_redemption" => "required",
|
|
"interest_paidout" => "required",
|
|
"net_principal_investment" => "required",
|
|
"capitalised_interest" => "required",
|
|
"accrued_interest" => "required",
|
|
"portfolio_value" => "required",
|
|
"absolute_return_in_rs" => "required",
|
|
"absolute_return_in_pct" => "required",
|
|
"annualised_return" => "required",
|
|
], [
|
|
'requried' => "The :attribute field must be required",
|
|
]);
|
|
|
|
$validationMessage = validationErrorMessage($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(["status" => 400, "message" => $validationMessage]);
|
|
}
|
|
|
|
$update_data = MonthlyUpdatePeerToPeerLending::where('id', $request->update_id)->update([
|
|
"total_investment" => $request->total_investment,
|
|
"principal_redemption" => $request->principal_redemption,
|
|
"interest_paidout" => $request->interest_paidout,
|
|
"net_principal_investment" => $request->net_principal_investment,
|
|
"capitalised_interest" => $request->capitalised_interest,
|
|
"accrued_interest" => $request->accrued_interest,
|
|
"portfolio_value" => $request->portfolio_value,
|
|
"absolute_return_in_rs" => $request->absolute_return_in_rs,
|
|
"absolute_return_in_pct" => $request->absolute_return_in_pct,
|
|
"annualised_return" => $request->annualised_return,
|
|
]);
|
|
if ($request->statement_reports) {
|
|
$statementReportsArray = array();
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->update_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
MonthlyUpdatePeerToPeerLending::where('id', $request->update_id)->update([
|
|
"statement_reports" => json_encode($statementReportsArray),
|
|
]);
|
|
}
|
|
|
|
|
|
if ($update_data) {
|
|
return response()->json(["status" => "success", "code" => 200, "message" => "Data updated successfully"]);
|
|
} else {
|
|
return response()->json(["status" => "failed", "code" => 200, "message" => "Data not updated. Error!!"]);
|
|
}
|
|
}
|
|
|
|
public function updateFaircentMonthlyUpdate(Request $request)
|
|
{
|
|
$validator = Validator::make($request->all(), [
|
|
"total_value" => "required",
|
|
"investment_amount" => "required",
|
|
"all_time_amount_invested" => "required",
|
|
"interest_accrued" => "required",
|
|
"principal_redemption" => "required",
|
|
"net_interest_redemption" => "required",
|
|
"escrow_balance" => "required",
|
|
"average_roi" => "required",
|
|
], [
|
|
'requried' => "The :attribute field must be required",
|
|
]);
|
|
|
|
$validationMessage = validationErrorMessage($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(["status" => 400, "message" => $validationMessage]);
|
|
}
|
|
|
|
$update_data = MonthlyUpdatePeerToPeerLending::where('id', $request->update_id)->update([
|
|
"total_value" => $request->total_value,
|
|
"investment_amount" => $request->investment_amount,
|
|
"all_time_amount_invested" => $request->all_time_amount_invested,
|
|
"interest_accrued" => $request->interest_accrued,
|
|
"principal_redemption" => $request->principal_redemption,
|
|
"net_interest_redemption" => $request->net_interest_redemption,
|
|
"escrow_balance" => $request->escrow_balance,
|
|
"average_roi" => $request->average_roi,
|
|
]);
|
|
if ($request->statement_reports) {
|
|
$statementReportsArray = array();
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->update_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
MonthlyUpdatePeerToPeerLending::where('id', $request->update_id)->update([
|
|
"statement_reports" => json_encode($statementReportsArray),
|
|
]);
|
|
}
|
|
|
|
|
|
if ($update_data) {
|
|
return response()->json(["status" => "success", "code" => 200, "message" => "Data updated successfully"]);
|
|
} else {
|
|
return response()->json(["status" => "failed", "code" => 200, "message" => "Data not updated. Error!!"]);
|
|
}
|
|
}
|
|
|
|
public function updateFinancePeerMonthlyUpdate(Request $request)
|
|
{
|
|
$validator = Validator::make($request->all(), [
|
|
"all_time_investment_added" => "required",
|
|
"total_active_investment" => "required",
|
|
"net_expected_value_at_maturity" => "required",
|
|
"net_asset_value" => "required",
|
|
"amount_withdrawn" => "required",
|
|
"interest_paidout" => "required",
|
|
"absolute_return_in_rs" => "required",
|
|
"absolute_return_in_pct" => "required",
|
|
], [
|
|
'requried' => "The :attribute field must be required",
|
|
]);
|
|
|
|
$validationMessage = validationErrorMessage($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(["status" => 400, "message" => $validationMessage]);
|
|
}
|
|
|
|
$update_data = MonthlyUpdatePeerToPeerLending::where('id', $request->update_id)->update([
|
|
"all_time_investment_added" => $request->all_time_investment_added,
|
|
"total_active_investment" => $request->total_active_investment,
|
|
"net_expected_value_at_maturity" => $request->net_expected_value_at_maturity,
|
|
"net_asset_value" => $request->net_asset_value,
|
|
"amount_withdrawn" => $request->amount_withdrawn,
|
|
"interest_paidout" => $request->interest_paidout,
|
|
"absolute_return_in_rs" => $request->absolute_return_in_rs,
|
|
"absolute_return_in_pct" => $request->absolute_return_in_pct,
|
|
]);
|
|
if ($request->statement_reports) {
|
|
$statementReportsArray = array();
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->update_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
MonthlyUpdatePeerToPeerLending::where('id', $request->update_id)->update([
|
|
"statement_reports" => json_encode($statementReportsArray),
|
|
]);
|
|
}
|
|
|
|
|
|
if ($update_data) {
|
|
return response()->json(["status" => "success", "code" => 200, "message" => "Data updated successfully"]);
|
|
} else {
|
|
return response()->json(["status" => "failed", "code" => 200, "message" => "Data not updated. Error!!"]);
|
|
}
|
|
}
|
|
|
|
public function updateStatusFunction(Request $request)
|
|
{
|
|
// return "hello";
|
|
$status = $request->status;
|
|
$id = $request->id;
|
|
|
|
if ($status == "1") {
|
|
$update = MonthlyUpdatePeerToPeerLending::where('id', $id)->update([
|
|
'status' => '0'
|
|
]);
|
|
} else {
|
|
$update = MonthlyUpdatePeerToPeerLending::where('id', $id)->update([
|
|
"status" => "1"
|
|
]);
|
|
}
|
|
// dd($request->all());
|
|
return response()->json(
|
|
[
|
|
"status" => 'success',
|
|
"code" => 200,
|
|
"message" => "Status Changed"
|
|
]
|
|
);
|
|
}
|
|
|
|
public function storeMonthlyUpdatesForFractionalRealEstate(Request $request)
|
|
{
|
|
// dd($request->all());
|
|
$validator = Validator::make($request->post(), [
|
|
'user_id' => 'required',
|
|
'categories' => 'required',
|
|
'custom_id' => 'required|unique:monthly_update_masters,custom_id',
|
|
'investor_name' => 'required',
|
|
'pan' => 'required',
|
|
'product_category' => 'required',
|
|
'investment_platform' => 'required',
|
|
'product_name' => 'required',
|
|
'account_number' => 'required',
|
|
'spv_details' => 'required',
|
|
'total_value_of_the_property' => 'required',
|
|
'investment_value' => 'required',
|
|
'investment_date' => 'required',
|
|
'total_gross_interest' => 'required',
|
|
'tds' => 'required',
|
|
'total_net_interest' => 'required',
|
|
'gross_entry_yield_in_pct' => 'required',
|
|
'target_return_in_pct' => 'required',
|
|
'absolute_return_till_date' => 'required',
|
|
'absolute_return_till_date_in_pct' => 'required',
|
|
'statement_reports.*' => 'required|max:2000'
|
|
// 'status' => 'required',
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'statement_reports.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$monthlyUpdate = MonthlyUpdateMaster::insertGetId([
|
|
'users_id' => $request->user_id,
|
|
'products_id' => (int)$request->product_id,
|
|
'categories' => $request->categories,
|
|
'custom_id' => $request->custom_id,
|
|
'investor_name' => $request->investor_name,
|
|
'pan' => $request->pan,
|
|
'product_category' => $request->product_category,
|
|
'investment_platform' => $request->investment_platform,
|
|
'product_name' => $request->product_name,
|
|
'account_number' => $request->account_number,
|
|
'spv_details' => $request->spv_details,
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
]);
|
|
|
|
$statementReportsArray = array();
|
|
$count = 0;
|
|
if ($request->statement_reports) {
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->user_id . time() . ++$count . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
}
|
|
|
|
$monthlyUpdateIFA = MonthlyUpdateFractionalRealEstate::create([
|
|
'custom_id' => $request->custom_id,
|
|
'total_value_of_the_property' => $request->total_value_of_the_property,
|
|
'investment_value' => $request->investment_value,
|
|
'investment_date' => $request->investment_date,
|
|
'total_gross_interest' => $request->total_gross_interest,
|
|
'tds' => $request->tds,
|
|
'total_net_interest' => $request->total_net_interest,
|
|
'gross_entry_yield_in_pct' => $request->gross_entry_yield_in_pct,
|
|
'target_return_in_pct' => $request->target_return_in_pct,
|
|
'absolute_return_till_date' => $request->absolute_return_till_date,
|
|
'absolute_return_till_date_in_pct' => $request->absolute_return_till_date_in_pct,
|
|
'statement_reports' => json_encode($statementReportsArray)
|
|
// 'status' => $request->status,
|
|
]);
|
|
|
|
$checkProductCommission = Product::where('id',(int)$request->product_id)->first();
|
|
$this->storeCommission($checkProductCommission, $request->investment_value, $monthlyUpdate);
|
|
|
|
if ($monthlyUpdate && $monthlyUpdateIFA) {
|
|
$notify = $this->sendNotificationToUser($request->user_id, $request->product_name);
|
|
return response()->json(['status' => 200, 'message' => "Successfully Assigned Fractional Real Estate Product to $request->investor_name"]);
|
|
}
|
|
return response()->json(['status' => 400, 'message' => 'Products Could Not Be Assigned Successfully']);
|
|
}
|
|
|
|
public function storeMonthlyUpdatesForAlternativeInvestmentFund(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'user_id' => 'required',
|
|
'categories' => 'required',
|
|
'custom_id' => 'required|unique:monthly_update_masters,custom_id',
|
|
'investor_name' => 'required',
|
|
'pan' => 'required',
|
|
'product_category' => 'required',
|
|
'investment_platform' => 'required',
|
|
'product_name' => 'required',
|
|
'commitment_amount' => 'required',
|
|
'contribution_amount' => 'required',
|
|
'contribution_called_amount' => 'required',
|
|
'contribution_uncalled_amount' => 'required',
|
|
'date_of_initial_contribution' => 'required',
|
|
'face_value_nav_per_unit' => 'required',
|
|
'principal_capital_repaid' => 'required',
|
|
'gross_income' => 'required',
|
|
'total_fees_paid' => 'required',
|
|
'net_income' => 'required',
|
|
'no_of_units_alloted' => 'required',
|
|
'no_of_units_redeemed' => 'required',
|
|
'current_valuation' => 'required',
|
|
// 'current_nav' => 'required',
|
|
'no_of_units_held' => 'required',
|
|
'statement_reports.*' => 'required|max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'statement_reports.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$monthlyUpdate = MonthlyUpdateMaster::insertGetId([
|
|
'users_id' => $request->user_id,
|
|
'products_id' => (int)$request->product_id,
|
|
'categories' => $request->categories,
|
|
'custom_id' => $request->custom_id,
|
|
'investor_name' => $request->investor_name,
|
|
'pan' => $request->pan,
|
|
'product_category' => $request->product_category,
|
|
'investment_platform' => $request->investment_platform,
|
|
'product_name' => $request->product_name,
|
|
'class_of_units' => $request->class_of_units,
|
|
'fund_category' => $request->fund_category,
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
]);
|
|
|
|
$statementReportsArray = array();
|
|
|
|
$count = 0;
|
|
if ($request->has('statement_reports')) {
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->user_id . ++$count . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
}
|
|
|
|
$monthlyUpdateIFA = MonthlyUpdateAlternativeInvestmentFund::create([
|
|
'custom_id' => $request->custom_id,
|
|
'commitment_amount' => $request->commitment_amount,
|
|
'contribution_amount' => $request->contribution_amount,
|
|
'contribution_called_amount' => $request->contribution_called_amount,
|
|
'contribution_uncalled_amount' => $request->contribution_uncalled_amount,
|
|
'date_of_initial_contribution' => $request->date_of_initial_contribution,
|
|
'face_value_nav_per_unit' => $request->face_value_nav_per_unit,
|
|
'principal_capital_repaid' => $request->principal_capital_repaid,
|
|
'gross_income' => $request->gross_income,
|
|
'total_fees_paid' => $request->total_fees_paid,
|
|
'net_income' => $request->net_income,
|
|
'no_of_units_alloted' => $request->no_of_units_alloted,
|
|
'current_valuation' => $request->current_valuation,
|
|
'current_nav' => 0,
|
|
'no_of_units_held' => $request->no_of_units_held,
|
|
'no_of_units_redeemed' => $request->no_of_units_redeemed,
|
|
'statement_reports' => json_encode($statementReportsArray)
|
|
]);
|
|
|
|
$commissionDetail = Product::where('id',(int)$request->product_id)->first();
|
|
$this->storeCommission($commissionDetail, $request->commitment_amount, $monthlyUpdate);
|
|
if ($monthlyUpdate && $monthlyUpdateIFA) {
|
|
$notify = $this->sendNotificationToUser($request->user_id, $request->product_name);
|
|
return response()->json(['status' => 200, 'message' => "Successfully Assigned Alternative Investment Fund Product to $request->investor_name"]);
|
|
}
|
|
return response()->json(['status' => 400, 'message' => 'Products Could Not Be Assigned Successfully']);
|
|
}
|
|
|
|
public function updateAlternativeMonthlyUpdate(Request $request)
|
|
{
|
|
// dd($request->update_alternative_id);
|
|
$validator = Validator::make($request->all(), [
|
|
"update_alternative_id" => "required",
|
|
"commitment_amount" => "required",
|
|
"contribution_amount" => "required",
|
|
"contribution_called_amount" => "required",
|
|
"contribution_uncalled_amount" => "required",
|
|
"date_of_initial_contribution" => "required",
|
|
"face_value_nav_per_unit" => "required",
|
|
"principal_capital_repaid" => "required",
|
|
"gross_income" => "required",
|
|
"total_fees_paid" => "required",
|
|
"net_income" => "required",
|
|
"no_of_units_alloted" => "required",
|
|
"no_of_units_redeemed" => "required",
|
|
"current_valuation" => "required",
|
|
// "current_nav" => "required",
|
|
"no_of_units_held" => "required",
|
|
], [
|
|
"required" => "The :attribute field are required",
|
|
]);
|
|
|
|
$validationMessage = validationErrorMessage($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(["status" => 400, "message" => $validationMessage]);
|
|
}
|
|
$updateAIFMonthlyUpdate = MonthlyUpdateAlternativeInvestmentFund::where('id', $request->update_alternative_id)->update([
|
|
"commitment_amount" => $request->commitment_amount,
|
|
"contribution_amount" => $request->contribution_amount,
|
|
"contribution_called_amount" => $request->contribution_called_amount,
|
|
"contribution_uncalled_amount" => $request->contribution_uncalled_amount,
|
|
"date_of_initial_contribution" => $request->date_of_initial_contribution,
|
|
"face_value_nav_per_unit" => $request->face_value_nav_per_unit,
|
|
"principal_capital_repaid" => $request->principal_capital_repaid,
|
|
"gross_income" => $request->gross_income,
|
|
"total_fees_paid" => $request->total_fees_paid,
|
|
"net_income" => $request->net_income,
|
|
"no_of_units_alloted" => $request->no_of_units_alloted,
|
|
"no_of_units_redeemed" => $request->no_of_units_redeemed,
|
|
"current_valuation" => $request->current_valuation,
|
|
// "current_nav" => $request->current_nav,
|
|
"no_of_units_held" => $request->no_of_units_held
|
|
]);
|
|
|
|
if ($request->statement_reports) {
|
|
$statementReportsArray = array();
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->update_alternative_id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
|
|
$oldStatementReport = MonthlyUpdateAlternativeInvestmentFund::where('id', $request->update_alternative_id)->first();
|
|
$statementReport = $oldStatementReport->getRawOriginal()['statement_reports'];
|
|
// dd($statementReport);
|
|
// $ltrim = ltrim($statementReport,'[');
|
|
// $rtrim = rtrim($ltrim,']');
|
|
$explode = json_decode($statementReport);
|
|
$oldStatement = [];
|
|
|
|
foreach($explode as $report)
|
|
{
|
|
// dd($report);
|
|
// $ltrimOfReport = ltrim($report,'"');
|
|
// $rtrimOfReport = rtrim($ltrimOfReport,'"');
|
|
// dd($rtrimOfReport);
|
|
array_push($oldStatement,$report);
|
|
}
|
|
|
|
// merge array
|
|
$newStatementReport = array_merge($oldStatement,$statementReportsArray);
|
|
|
|
MonthlyUpdateAlternativeInvestmentFund::where('id', $request->update_alternative_id)->update([
|
|
"statement_reports" => json_encode($newStatementReport),
|
|
]);
|
|
}
|
|
|
|
|
|
if ($updateAIFMonthlyUpdate) {
|
|
return response()->json(["status" => "success", "code" => 200, "message" => "Data updated successfully"]);
|
|
} else {
|
|
return response()->json(["status" => "failed", "code" => 200, "message" => "Error Updating Data!"]);
|
|
}
|
|
}
|
|
|
|
public function updateIndianFinancialAssetsMonthlyUpdate(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'id' => 'required',
|
|
'investment_date' => 'required',
|
|
'amount_invested' => 'required',
|
|
'tenure_in_days' => 'required',
|
|
'interest_payment_frequency' => 'required',
|
|
'maturity_date' => 'required',
|
|
'expected_irr' => 'required',
|
|
'total_gross_repaid_amount' => 'required',
|
|
'principal_payment_frequency' => 'required',
|
|
'next_repayment_due_date' => 'required',
|
|
'next_repayment_amount' => 'required',
|
|
'repayment_schedule.*' => 'max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'repayment_schedule.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
$update_data = MonthlyUpdateIndianFinancialAssets::where('id', $request->id)->update([
|
|
"investment_date" => $request->investment_date,
|
|
"amount_invested" => $request->amount_invested,
|
|
"tenure_in_days" => $request->tenure_in_days,
|
|
"interest_payment_frequency" => $request->interest_payment_frequency,
|
|
"maturity_date" => $request->maturity_date,
|
|
"expected_irr" => $request->expected_irr,
|
|
"total_gross_repaid_amount" => $request->total_gross_repaid_amount,
|
|
"principal_payment_frequency" => $request->principal_payment_frequency,
|
|
"next_repayment_due_date" => $request->next_repayment_due_date,
|
|
"next_repayment_amount" => $request->repayment_amount,
|
|
// "repayment_schedule" => $request->repayment_schedule,
|
|
]);
|
|
|
|
if ($request->repayment_schedule) {
|
|
$statementReportsArray = array();
|
|
foreach ($request->repayment_schedule as $key => $statementReport) {
|
|
$statementReportName = $key . $request->id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
MonthlyUpdateIndianFinancialAssets::where('id', $request->id)->update([
|
|
"repayment_schedule" => json_encode($statementReportsArray),
|
|
]);
|
|
}
|
|
}
|
|
|
|
|
|
if ($update_data) {
|
|
return response()->json(["status" => "success", "code" => 200, "message" => "Data updated successfully"]);
|
|
} else {
|
|
return response()->json(["status" => "failed", "code" => 200, "message" => "Data not updated. Error!!"]);
|
|
}
|
|
}
|
|
|
|
public function storeCommission($commissionDetail, $amount, $monthlyId)
|
|
{
|
|
if($commissionDetail->commission_type == 'One-Time Commission' || $commissionDetail->commission_type == 'Hybrid Structure')
|
|
{
|
|
// dd($commissionDetail->commission_type);
|
|
$total_investment = (int)$amount;
|
|
$applicable_rate = floatval($commissionDetail->upfront_rate);
|
|
$gross_commission_earned = $total_investment / 100 * $applicable_rate ;
|
|
$total_less_percentage = $gross_commission_earned / 100 * (floatval($commissionDetail->gst) - floatval($commissionDetail->tds));
|
|
$net_commission_received = $gross_commission_earned + $total_less_percentage;
|
|
|
|
$storeCommission = MonthlyUpdateMasterCommission::create([
|
|
'monthly_id' => $monthlyId,
|
|
'total_investment_or_commitment_amount' => $total_investment,
|
|
'applicable_rate' => $commissionDetail->upfront_rate,
|
|
'type_of_commission' => $commissionDetail->commission_type == 'Hybrid Structure' ? 'Hybrid Commission(Upfront)':$commissionDetail->commission_type,
|
|
'gross_commissioned_earned_inr' => $gross_commission_earned,
|
|
'gst' => $commissionDetail->gst,
|
|
'tds' => $commissionDetail->tds,
|
|
'net_commission_received' => $net_commission_received
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function updateStatusAlternative(Request $request)
|
|
{
|
|
if(MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $request->custom_id)->where('status',true)->get()->count() >= 1)
|
|
{
|
|
if($request->status == '1')
|
|
{
|
|
$other = MonthlyUpdateAlternativeInvestmentFund::where(['custom_id'=> $request->custom_id, 'status'=>false])->whereNotIn('id', [$request->id])->orderByDesc('created_at')->limit(1)->first();
|
|
if($other)
|
|
{
|
|
$inactiveAll = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $request->custom_id)->update(['status'=>false]);
|
|
if($inactiveAll)
|
|
{
|
|
MonthlyUpdateAlternativeInvestmentFund::where('id', $other->id)->update(['status'=>true]);
|
|
}
|
|
}
|
|
}else{
|
|
$falseAll = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $request->custom_id)->update(['status'=>false]);
|
|
if($falseAll)
|
|
{
|
|
MonthlyUpdateAlternativeInvestmentFund::where(['id'=>$request->id,'custom_id'=>$request->custom_id])->update(['status'=>true]);
|
|
}
|
|
}
|
|
return response(['status' => 200, 'message'=>'Product status changed successfully']);
|
|
}
|
|
return response(['status' => 400, 'message'=>'Status not changed, Atleast one should be active']);
|
|
|
|
// old running code
|
|
// dd($request->all());
|
|
// $status = $request->status;
|
|
// $id = $request->id;
|
|
// $custom_id = $request->custom_id;
|
|
// $count = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $custom_id)->get()->count();
|
|
// if($count > 1)
|
|
// {
|
|
// if ($status == "1") {
|
|
// $update = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
|
|
// 'status' => '0'
|
|
// ]);
|
|
// } else {
|
|
// $update = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
|
|
// "status" => "1"
|
|
// ]);
|
|
// }
|
|
// return response()->json(
|
|
// [
|
|
// "status" => 'success',
|
|
// "code" => 200,
|
|
// "message" => "Status Changed"
|
|
// ]
|
|
// );
|
|
// }
|
|
// // dd($request->all());
|
|
// return response()->json(
|
|
// [
|
|
// "status" => 400,
|
|
// "message" => "Status not changed, Atleast one should be active",
|
|
// ]
|
|
// );
|
|
}
|
|
|
|
public function updateIndianFinancialStatus(Request $request)
|
|
{
|
|
|
|
$data = MonthlyUpdateIndianFinancialAssets::where('id', $request->id)->first();
|
|
|
|
if ($data) {
|
|
if ($request->status == '1') {
|
|
$data->status = '0';
|
|
} else {
|
|
$data->status = '1';
|
|
}
|
|
$data->save();
|
|
}
|
|
|
|
return response(['status' => 200]);
|
|
}
|
|
public function updateFractionalRealEstateStatus(Request $request)
|
|
{
|
|
if(MonthlyUpdateFractionalRealEstate::where('custom_id', $request->custom_id)->where('status',true)->get()->count() >= 1)
|
|
{
|
|
// $data = MonthlyUpdateFractionalRealEstate::where('custom_id', $request->custom_id)->get();
|
|
// foreach($data as $row)
|
|
// {
|
|
if($request->status == '1')
|
|
{
|
|
$other = MonthlyUpdateFractionalRealEstate::where(['custom_id'=> $request->custom_id, 'status'=>false])->whereNotIn('id', [$request->id])->orderByDesc('created_at')->limit(1)->first();
|
|
if($other)
|
|
{
|
|
$inactiveAll = MonthlyUpdateFractionalRealEstate::where('custom_id', $request->custom_id)->update(['status'=>false]);
|
|
if($inactiveAll)
|
|
{
|
|
MonthlyUpdateFractionalRealEstate::where('id', $other->id)->update(['status'=>true]);
|
|
}
|
|
}
|
|
}else{
|
|
$falseAll = MonthlyUpdateFractionalRealEstate::where('custom_id', $request->custom_id)->update(['status'=>false]);
|
|
if($falseAll)
|
|
{
|
|
MonthlyUpdateFractionalRealEstate::where(['id'=>$request->id,'custom_id'=>$request->custom_id])->update(['status'=>true]);
|
|
}
|
|
}
|
|
// }
|
|
// $data = MonthlyUpdateFractionalRealEstate::where('id', $request->id)->first();
|
|
// if ($data) {
|
|
// if ($request->status == '1') {
|
|
// $data->status = '0';
|
|
// } else {
|
|
// $data->status = '1';
|
|
// }
|
|
// $data->save();
|
|
// }
|
|
|
|
|
|
return response(['status' => 200, 'message'=>'Product status changed successfully']);
|
|
}
|
|
return response(['status' => 400, 'message'=>'Status not changed, Atleast one should be active']);
|
|
}
|
|
|
|
public function updateFractionalRealEstateMonthlyUpdate(Request $request)
|
|
{
|
|
$validator = Validator::make($request->post(), [
|
|
'id' => 'required',
|
|
'total_value_of_the_property' => 'required',
|
|
'investment_value' => 'required',
|
|
'investment_date' => 'required',
|
|
'total_gross_interest' => 'required',
|
|
'tds' => 'required',
|
|
'total_net_interest' => 'required',
|
|
'gross_enter_yield_in_pct' => 'required',
|
|
'target_return_in_pct' => 'required',
|
|
'absolute_return_till_date' => 'required',
|
|
'absolute_return_till_date_in_pct' => 'required',
|
|
'statement_reports.*' => 'max:2000'
|
|
], [
|
|
'required' => 'The :attribute field must be required',
|
|
'unique' => 'The :attribute field must be unique',
|
|
'statement_reports.*.max' => 'Sorry! Maximum allowed size for an repayment schedule is 2MB',
|
|
]);
|
|
|
|
$validationMessage = $this->validationError($validator);
|
|
if ($validationMessage) {
|
|
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
|
}
|
|
|
|
$update_data = MonthlyUpdateFractionalRealEstate::where('id', $request->id)->update([
|
|
"total_value_of_the_property" => $request->total_value_of_the_property,
|
|
"investment_value" => $request->investment_value,
|
|
"investment_date" => $request->investment_date,
|
|
"total_gross_interest" => $request->total_gross_interest,
|
|
"tds" => $request->tds,
|
|
"total_net_interest" => $request->total_net_interest,
|
|
"gross_entry_yield_in_pct" => $request->gross_enter_yield_in_pct,
|
|
"target_return_in_pct" => $request->target_return_in_pct,
|
|
"absolute_return_till_date" => $request->absolute_return_till_date,
|
|
"absolute_return_till_date_in_pct" => $request->absolute_return_till_date_in_pct,
|
|
]);
|
|
if ($request->statement_reports) {
|
|
$statementReportsArray = array();
|
|
foreach ($request->statement_reports as $key => $statementReport) {
|
|
$statementReportName = $key . $request->id . time() . '.' . $statementReport->extension();
|
|
$statementReport->storeAs('files/monthly-update', $statementReportName);
|
|
array_push($statementReportsArray, $statementReportName);
|
|
}
|
|
$oldStatementReport = MonthlyUpdateFractionalRealEstate::where('id', $request->id)->first();
|
|
$statementReport = $oldStatementReport->getRawOriginal()['statement_reports'];
|
|
// merge array
|
|
// dd(json_decode($statementReport));
|
|
// $ltrim = ltrim($statementReport,'[');
|
|
// $rtrim = rtrim($ltrim,']');
|
|
// $explode = explode(',',$rtrim);
|
|
$explode = json_decode($statementReport);
|
|
$oldStatement = [];
|
|
|
|
foreach($explode as $report)
|
|
{
|
|
// dd($report);
|
|
// $ltrimOfReport = ltrim($report,'"');
|
|
// $rtrimOfReport = rtrim($ltrimOfReport,'"');
|
|
// dd($rtrimOfReport);
|
|
array_push($oldStatement,$report);
|
|
}
|
|
$newStatementReport = array_merge($oldStatement,$statementReportsArray);
|
|
|
|
|
|
MonthlyUpdateFractionalRealEstate::where('id', $request->id)->update([
|
|
"statement_reports" => json_encode($newStatementReport),
|
|
]);
|
|
}
|
|
if ($update_data) {
|
|
return response()->json(["status" => "success", "code" => 200, "message" => "Data updated successfully"]);
|
|
} else {
|
|
return response()->json(["status" => "failed", "code" => 200, "message" => "Data not updated. Error!!"]);
|
|
}
|
|
}
|
|
|
|
public function monthlyUpdateChangeHoldingStatus(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
$status = $request->status == 'Holding' ? 'Reedemed' : 'Holding';
|
|
$updateStatus = MonthlyUpdateMaster::where('id', $id)->update([
|
|
'holding_status' => $status
|
|
]);
|
|
if (!$updateStatus) {
|
|
return response()->json(['status' => 400, 'message' => 'Error Changing Holding Status!']);
|
|
}
|
|
return response()->json(['status' => 200, 'message' => 'Holding Status Changed!']);
|
|
}
|
|
|
|
public function monthlyUpdateChangeStatus(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
$status = $request->status == 1 ? 0 : 1;
|
|
$updateStatus = MonthlyUpdateMaster::where('id', $id)->update([
|
|
'status' => $status
|
|
]);
|
|
if (!$updateStatus) {
|
|
return response()->json(['status' => 400, 'message' => 'Error Changing Status!']);
|
|
}
|
|
return response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
|
}
|
|
|
|
public function sendNotificationToUser($id, $productName)
|
|
{
|
|
$notify['message'] = "Congratulations, A new investment ($productName) has been added in your current investment!";
|
|
$type = "New Investment";
|
|
$user = User::find($id);
|
|
$user->notify(new UserAdmin($notify, $type));
|
|
}
|
|
|
|
// for aif
|
|
public function fecthStatementReports(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
$reports = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->first();
|
|
if($reports)
|
|
{
|
|
$originalValue = json_decode($reports->getRawOriginal()['statement_reports'], true);
|
|
// dd($originalValue);
|
|
|
|
$fileNames = [];
|
|
foreach ($originalValue as $url) {
|
|
$fileName = basename($url);
|
|
$fileNames[] = $fileName;
|
|
}
|
|
|
|
return response()->json(['success' => 200, 'data' => $originalValue]);
|
|
}
|
|
else
|
|
{
|
|
return response()->json(['success' => 201]);
|
|
}
|
|
}
|
|
|
|
public function deleteStatementReport(Request $request)
|
|
{
|
|
$fileName = rtrim($request->input('fileName'),'❌');
|
|
$id = $request->input('id');
|
|
// dd($fileName,$id);
|
|
|
|
// Find the statement_report record
|
|
$statementReport = MonthlyUpdateAlternativeInvestmentFund::where('id',$id)->first()->getRawOriginal()['statement_reports'];
|
|
|
|
// Get the statement_reports array
|
|
// dd(json_decode($statementReport));
|
|
$fileNames = json_decode($statementReport);
|
|
|
|
|
|
// Find the index of the file name to be deleted
|
|
$index = array_search($fileName, $fileNames);
|
|
|
|
// If the file name exists, remove it from the array and delete the file
|
|
if ($index !== false) {
|
|
$deletedFileName = $fileNames[$index];
|
|
// dd($deletedFileName);
|
|
unset($fileNames[$index]); // Remove the file name from the array
|
|
Storage::delete('files/monthly-update/' . $deletedFileName); // Delete the corresponding file
|
|
}
|
|
|
|
// Update the statement_reports in the database
|
|
MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
|
|
"statement_reports" => json_encode(array_values($fileNames)), // Re-index the array and encode it back to JSON
|
|
]);
|
|
|
|
return response()->json(['success' => true]);
|
|
}
|
|
|
|
// for fre
|
|
public function fecthStatementReportsFre(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
$reports = MonthlyUpdateFractionalRealEstate::where('id', $id)->first();
|
|
// dd($reports);
|
|
if($reports)
|
|
{
|
|
$originalValue = json_decode($reports->getRawOriginal()['statement_reports'], true);
|
|
|
|
$fileNames = [];
|
|
foreach ($originalValue as $url) {
|
|
$fileName = basename($url);
|
|
$fileNames[] = $fileName;
|
|
}
|
|
|
|
return response()->json(['success' => 200, 'data' => $originalValue]);
|
|
}
|
|
else
|
|
{
|
|
return response()->json(['success' => 201]);
|
|
}
|
|
}
|
|
|
|
public function deleteStatementReportFre(Request $request)
|
|
{
|
|
$fileName = rtrim($request->input('fileName'),'❌');
|
|
$id = $request->input('id');
|
|
// dd($fileName,$id);
|
|
|
|
// Find the statement_report record
|
|
$statementReport = MonthlyUpdateFractionalRealEstate::where('id',$id)->first()->getRawOriginal()['statement_reports'];
|
|
|
|
// Get the statement_reports array
|
|
// dd(json_decode($statementReport));
|
|
$fileNames = json_decode($statementReport);
|
|
|
|
|
|
// Find the index of the file name to be deleted
|
|
$index = array_search($fileName, $fileNames);
|
|
|
|
// If the file name exists, remove it from the array and delete the file
|
|
if ($index !== false) {
|
|
$deletedFileName = $fileNames[$index];
|
|
// dd($deletedFileName);
|
|
unset($fileNames[$index]); // Remove the file name from the array
|
|
Storage::delete('files/monthly-update/' . $deletedFileName); // Delete the corresponding file
|
|
}
|
|
|
|
// Update the statement_reports in the database
|
|
MonthlyUpdateFractionalRealEstate::where('id', $id)->update([
|
|
"statement_reports" => json_encode(array_values($fileNames)), // Re-index the array and encode it back to JSON
|
|
]);
|
|
|
|
return response()->json(['success' => true]);
|
|
}
|
|
|
|
|
|
|
|
protected function exportExcelUserProduct(Request $request, $category)
|
|
{
|
|
$categories = $request->category;
|
|
if ($categories == "Faircent") {
|
|
$category = ["Faircent"];
|
|
$columns = ['Custom ID', 'Total Value', 'Investment Amount', 'All Time Amount Invested', 'Interest accrued', 'Principal Redemption', 'Net Interest Redemption', 'Escrow Balance', 'Average ROI'];
|
|
$excel_name = "Faircent.XLSX";
|
|
} elseif ($categories == "Liquiloans") {
|
|
$category = ["Liquiloans"];
|
|
$columns = ["Custom ID", "Total Investment", "Principal Redemption", "Interest Paid Out", "Net Principal Investment", "Capitalised Interest", "Accrued Interest", "Portfolio Value", "Absolute Return (in Rs)", "Absolute Return (%)", "Annualised Return"];
|
|
$excel_name = "Liquiloans.XLSX";
|
|
} elseif ($categories == "FinancePeer") {
|
|
$category = ["Finance Peer"];
|
|
$columns = ["Custom ID", "All Time Investment Added", "Total Active Investments", "Net Expected Value at Maturity", "Net Asset Value", "Amount Withdrawn", "Interest Paidout", "Absolute Return (in Rs)", "Absolute Return (%)"];
|
|
$excel_name = "FinancePeer.XLSX";
|
|
} elseif ($categories == "Indian Financial Assets") {
|
|
$category = ["Invoice Discounting", "Clean And Green Assets", "Venture Debt", "High Yield Finance", "Securitized Debt Instrument", "Lease Based Financing", "Revenue Based Financing"];
|
|
$columns = ['Custom ID', 'Investment Date', 'Amount Invested', 'Total Gross Repaid Amount', 'Tenure (Days)', 'Principal Payment Frequency', 'Interest Payment Frequency', 'Next Repayment Due Date', 'Maturity Date', 'Next Repayment Amount', 'Expected IRR'];
|
|
$excel_name = "Indian_Financial_Assets.XLSX";
|
|
} elseif ($categories == 'Alternative Investment Fund') {
|
|
$category = ["Alternative Investment Fund"];
|
|
$columns = ['Name','Email','Custom ID','Product Name','Product Category', '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 -Set Up -Management -Operating', 'Net Income', 'No of Units alloted', 'No of Units redeemed', 'Current Valuation', 'No of Units held'];
|
|
$excel_name = "Alternative_Investment_Fund.XLSX";
|
|
} elseif ($categories == 'Fractional Real Estate') {
|
|
$category = ["Fractional Real Estate"];
|
|
$columns = ['Name','Email','Custom ID','Product Name','Product Category', 'Total value of the Property', 'Investment Value', 'Investment Date', 'Total Gross Interest', 'TDS', 'Total Net Interest', 'Gross Entry Yield (%)', 'Target Return', 'Absolute Return till Date ', 'Absolute Return till date (%)'];
|
|
$excel_name = "Fractional_Real_Estate.XLSX";
|
|
}
|
|
|
|
return Excel::download(new UserProduct($category, $columns), $excel_name);
|
|
}
|
|
|
|
|
|
}
|