Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public static function penalt(){ ## This function will find all the repayment schedule which are matured but not paid up today; $today = date('Y-m-d'); $repayments = DB::table('repaymentschedule')->where('dueDate','<',$today)->where('status','wait')->whereNull('penalty')->get(); foreach($repayments as $repay){ foreach(DB::table('loanpenalty')->where('loanProduct',$repay->loanProduct)->get() as $penalt){ if($penalt->type == 'fixed'){ if($penalt->amount != NULL){ $penalt_amount = $penalt->amount; ## Updating the penalt value if($repay->penalty != NULL){ $penalt_amount = $repay->penalty + $penalt_amount; }else{ $penalt_amount = $penalt_amount; } $data = array('penalty'=>$penalt_amount); DB::table('repaymentschedule')->where('id',$repay->id)->where('loanProduct',$repay->loanProduct)->update($data); } }else{ if($penalt->percent != NULL){ $penalt_amount = round(($repay->principal*$penalt->percent/100),2); ## Updating the penalt value if($repay->penalty != NULL){ $penalt_amount = $repay->penalty + $penalt_amount; }else{ $penalt_amount = $penalt_amount; } $data = array('penalty'=>$penalt_amount); DB::table('repaymentschedule')->where('id',$repay->id)->where('loanProduct',$repay->loanProduct)->update($data); } } } } } public static function update_savings_fee(){ $acc=DB::table('savingaccount')->get(); $b=array(); foreach($acc as $ac){ $sv=DB::table('savingproduct')->where('id',$ac->savingProduct_id)->get(); foreach($sv as $svrow){ $spf=DB::table('savingproductfees')->where('savingproduct_id',$svrow->id)->get(); foreach($spf as $spfrow){ $sf=DB::table('savingfee1')->where('id',$spfrow->savingfee_id)->get(); $data=array(); foreach($sf as $sfrow){ $datetime=date('Y-m-d h:i'); $data['account_id']=$ac->id; $data['product_id']=$svrow->id; $data['product_fees_id']=$spfrow->id; $data['account_fees']=$sfrow->feeAmount; $data['feename']=$sfrow->feeName; $tdate=date('Y').'-'.date('m').'-'.$sfrow->whenFeeAdded; $feeFrequency=$sfrow->feeFrequency; $lasttr=DB::table('savingtransactions')->where('account_id',$ac->id)->where('type','fee')->where('date',$tdate)->where('description',$data['feename'])->orderBy('id','DESC')->limit(1)->get(); $check=$feeFrequency; foreach($lasttr as $lastrow){ $time=strtotime($lastrow->date); $month=date("m",$time); $check=$month-date('m'); } $tr=DB::table('savingtransactions')->where('account_id',$ac->id)->where('type','fee')->where('date',$tdate)->where('description',$data['feename'])->count(); if($tr==0 && $check==$feeFrequency && date('d')>=$sfrow->whenFeeAdded){ echo date('d').'=='.$sfrow->whenFeeAdded.' yes naadi '; $insert = array( 'branch_id'=>$ac->branch_id, 'borrower_id'=>$ac->borrower_id, 'account_id'=> $data['account_id'], 'amount'=>$data['account_fees'], 'debitCredit'=>'debit', 'type'=>'fee', 'datetime'=>$datetime, 'description'=>$data['feename'], 'registered_by'=>$ac->registered_by, 'date'=>$tdate, ); //DB::table('savingtransactions')->insert($insert); }else{ //do nothing... } } $b[]=$data; } } } } public static function update_savings_interest(){ $acc=DB::table('savingaccount')->get(); $b=array(); foreach($acc as $ac){ $sv=DB::table('savingproduct')->where('id',$ac->savingProduct_id)->get(); $data=array(); foreach($sv as $sfrow){ $datetime=date('Y-m-d h:i'); $data['account_id']=$ac->id; $data['product_id']=$sfrow->id; $data['product_interest']=$sfrow->interest; $tdate=date('Y').'-'.date('m').'-'.$sfrow->whenAdded; $feeFrequency=$sfrow->frequency; //get ledger amount $creditledge=app('App\Http\Controllers\Load')::get_savingtransactions_credit($ac->id,$ac->branch_id); $debitledge= app('App\Http\Controllers\Load')::get_savingtransactions_debit($ac->id,$ac->branch_id); foreach($creditledge as $ledger){ $ledgercr= $ledger->amount; } foreach($debitledge as $ledger1){ $ledgerdr= $ledger1->amount; } $ledger=$ledgercr-$ledgerdr; if($ledger>0){ $interest=($data['product_interest']/100)*$ledger; $interest=round($interest,2); }else{ $interest=0; } //echo $ledger.' '.$interest.'
'; $lasttr=DB::table('savingtransactions')->where('account_id',$ac->id)->where('type','interest')->where('date',$tdate)->orderBy('id','DESC')->limit(1)->get(); $check=$feeFrequency; foreach($lasttr as $lastrow){ $time=strtotime($lastrow->date); $month=date("m",$time); $check=$month-date('m'); } $tr=DB::table('savingtransactions')->where('account_id',$ac->id)->where('type','interest')->where('date',$tdate)->count(); if($tr==0 && $check==$feeFrequency && date('d')>=$sfrow->whenAdded && $interest>0){ echo date('d').'=='.$sfrow->whenAdded.' yes naadi '; $insert = array( 'branch_id'=>$ac->branch_id, 'borrower_id'=>$ac->borrower_id, 'account_id'=> $data['account_id'], 'amount'=>$interest, 'debitCredit'=>'credit', 'type'=>'interest', 'datetime'=>$datetime, 'description'=>'Saving Interest', 'registered_by'=>$ac->registered_by, 'date'=>$tdate, ); //DB::table('savingtransactions')->insert($insert); }else{ //do nothing... } } $b[]=$data; } } }