{{-- Extends layout --}} @extends('index') {{-- Content --}} @section('content')

Monthly Allowance Report

@foreach($users as $user) @php $rate = config('pfd.project')->monthly_allowance_rate/100; $ablv = $user->order->order_packages[0]->ablv_rm; $check_ma = check_ma($user->id); if($check_ma > 0) { $prorate = $lastDayofMonth/$lastDayofMonth; } else { $reg_date = carbon_reg_date($user->order->payment_date); $period = $reg_date->addDays(16); $get_day = date('d', strtotime($period)); $get_month = date('F Y', strtotime($period)); if($get_month == $current_month) { $prorate = ($lastDayofMonth - $get_day)/$lastDayofMonth; } else { $current_month_month = date('m', strtotime($current_month)); $current_month_year = date('Y', strtotime($current_month)); $get_month_month = date('m', strtotime($get_month)); $get_month_year = date('Y', strtotime($get_month)); if($get_month_year < $current_month_year) { $prorate = $lastDayofMonth/$lastDayofMonth; } else { if($get_month_month <= $current_month_month) { $prorate = $lastDayofMonth/$lastDayofMonth; } else { $prorate = 0; } } } } $allowance = ($prorate * $rate) * $ablv; $package = get_package($user->package_id); foreach($package->allowances as $data) { $allowance_cash = 0; $allowance_token = 0; $percent = $data->allowance_percent/100; if($data->allowance_type == 'CASH') { $allowance_cash = $allowance * $percent; $service_charge = $allowance_cash * 0.05; } else if($data->allowance_type == 'DIGITAL SHARE') { $profit = $token->current_price + ($token->current_price * 0.1); $allowance_token = ($allowance * $percent) / $profit; } $tot_amt_cash = $tot_amt_cash+ $allowance_cash; $tot_amt_token = $tot_amt_token + $allowance_token; $tot_service_charge = $tot_service_charge + $service_charge; } $tot_monthly_allowance = $tot_monthly_allowance + $allowance; @endphp @if($prorate != 0) @endif @endforeach
Date Username Income Type Withdrawal Charges (RM) Cash Wallet (RM) Digital Share (Unit)
{{ date('d/m/Y 00:00', strtotime($next)) }} {{ $user->username }} Monthly Allowance (RM{{ formatMoney($allowance,1) }}) -{{ formatMoney($service_charge,1) }} {{ formatMoney($allowance_cash - $service_charge, 1)}} {{ token_formatMoney($allowance_token, 1)}}
@endsection {{-- Scripts Section --}} @section('scripts') @endsection