public function print_affiliate($affiliate) { $header1 = "DIRECCIÓN DE BENEFICIOS ECONÓMICOS"; $header2 = "UNIDAD DE FONDO DE RETIRO POLICIAL INDIVIDUAL"; $title = "REPORTE DE AFILIADO"; $date = Util::getDateEdit(date('Y-m-d')); $current_date = Carbon::now(); $hour = Carbon::parse($current_date)->toTimeString(); $data = $this->getData($affiliate); $affiliate = $data['affiliate']; $spouse = $data['spouse']; $total_gain = $data['total_gain']; $total_public_security_bonus = $data['total_public_security_bonus']; $total_quotable = $data['total_quotable']; $total_retirement_fund = $data['total_retirement_fund']; $total_mortuary_quota = $data['total_mortuary_quota']; $total = $data['total']; $contributions = Contribution::select(['id', 'month_year', 'degree_id', 'unit_id', 'item', 'base_wage', 'seniority_bonus', 'study_bonus', 'position_bonus', 'border_bonus', 'east_bonus', 'public_security_bonus', 'gain', 'quotable', 'retirement_fund', 'mortuary_quota', 'total'])->where('affiliate_id', $affiliate->id)->get(); $date = Util::getfulldate(date('Y-m-d')); $view = \View::make('affiliates.print.show', compact('header1', 'header2', 'title', 'date', 'hour', 'affiliate', 'spouse', 'total_gain', 'total_public_security_bonus', 'total_quotable', 'total_retirement_fund', 'total_mortuary_quota', 'total', 'contributions'))->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($view)->setPaper('legal', 'landscape'); return $pdf->stream(); }
public function period() { $second = Contribution::select('month_year')->where('contributions.direct_contribution_id', '=', $this->id)->orderBy('id', 'desc')->first(); $first = Contribution::select('month_year')->where('contributions.direct_contribution_id', '=', $this->id)->orderBy('id', 'asc')->first(); return "De " . Util::getDateAbrePeriod($first->month_year) . " a " . Util::getDateAbrePeriod($second->month_year); }
/** * Execute the console command. * * @return mixed */ public function handle() { global $NewAffi, $UpdateAffi, $NewContri, $Progress, $FolderName, $Date; $password = $this->ask('Enter the password'); if ($password == ACCESS) { $FolderName = $this->ask('Enter the name of the folder you want to import'); if ($this->confirm('Are you sure to import the folder "' . $FolderName . '" ? [y|N]') && $FolderName) { $time_start = microtime(true); $this->info("Working...\n"); $Progress = $this->output->createProgressBar(); $Progress->setFormat("%current%/%max% [%bar%] %percent:3s%%"); Excel::batch('public/file_to_import/' . $FolderName . '/', function ($rows, $file) { $rows->each(function ($result) { global $NewAffi, $UpdateAffi, $NewContri, $Progress, $FolderName, $Date; ini_set('memory_limit', '-1'); ini_set('max_execution_time', '-1'); ini_set('max_input_time', '-1'); set_time_limit('-1'); if (!isset($result->car) or !isset($result->pat) or !isset($result->mat) or !isset($result->nom) or !isset($result->nom2) or !isset($result->apes) or !isset($result->eciv) or !isset($result->sex) or !isset($result->nac) or !isset($result->ing) or !isset($result->mes) or !isset($result->a_o) or !isset($result->uni) or !isset($result->desg) or !isset($result->niv) or !isset($result->gra) or !isset($result->item) or !isset($result->sue) or !isset($result->cat) or !isset($result->est) or !isset($result->carg) or !isset($result->fro) or !isset($result->ori) or !isset($result->bseg) or !isset($result->dfu) or !isset($result->nat) or !isset($result->lac) or !isset($result->pre) or !isset($result->sub) or !isset($result->gan) or !isset($result->afp) or !isset($result->pag) or !isset($result->nua) or !isset($result->mus)) { $this->error('Missing columns in the file!'); exit; } switch ($FolderName) { case 'c1': $first_name = Util::FirstName($result->nom); $second_name = Util::SecondName($result->nom); $birth_date = Util::dateDDMMAA($result->nac); $date_entry = Util::dateDDMMAA($result->ing); break; case 'c2': $first_name = Util::FirstName($result->nom); $second_name = Util::SecondName($result->nom); $birth_date = Util::dateAAMMDD($result->nac); $date_entry = Util::dateAAMMDD($result->ing); break; case 'c3': $first_name = Util::FirstName($result->nom); $second_name = Util::SecondName($result->nom); $birth_date = Util::dateAADDMM($result->nac); $date_entry = Util::dateAADDMM($result->ing); break; case 'c4': $first_name = $result->nom; $second_name = $result->nom2; $birth_date = Util::dateAAMMDD($result->nac); $date_entry = Util::dateAAMMDD($result->ing); break; case 'c5': $first_name = $result->nom; $second_name = $result->nom2; $birth_date = Util::dateDDMMAA($result->nac); $date_entry = Util::dateDDMMAA($result->ing); break; default: $first_name = $result->nom; $second_name = $result->nom2; $birth_date = Util::date($result->nac); $date_entry = Util::date($result->ing); } $Date = Util::zero($result->mes) . "-" . Util::formatYear($result->a_o); $month_year = Carbon::createFromDate(Util::formatYear($result->a_o), Util::zero($result->mes), 1)->toDateString(); if (is_null($result->desg)) { $result->desg = 0; } $breakdown_id = Breakdown::select('id')->where('code', $result->desg)->first()->id; if ($breakdown_id == 1) { $unit_id = Unit::select('id')->where('breakdown_id', 1)->where('code', '20190')->first()->id; } elseif ($breakdown_id == 2) { $unit_id = Unit::select('id')->where('breakdown_id', 2)->where('code', '20190')->first()->id; } elseif ($breakdown_id == 3) { $unit_id = Unit::select('id')->where('breakdown_id', 3)->where('code', '20190')->first()->id; } else { if (Unit::select('id')->where('breakdown_id', $breakdown_id)->where('code', $result->uni)->first()) { $unit_id = Unit::select('id')->where('breakdown_id', $breakdown_id)->where('code', $result->uni)->first()->id; } else { $unit_id = Unit::select('id')->where('code', $result->uni)->first()->id; } } if ($result->niv && $result->gra) { if ($result->niv == '04' && $result->gra == '15') { $result->niv = '03'; } $degree_id = Degree::select('id')->where('code_level', $result->niv)->where('code_degree', $result->gra)->first()->id; } $category_id = Category::select('id')->where('percentage', Util::CalcCategory(Util::decimal($result->cat), Util::decimal($result->sue)))->first()->id; $affiliate = Affiliate::where('identity_card', '=', Util::zero($result->car))->first(); if (!$affiliate) { $affiliate = Affiliate::where('last_name', '=', $result->pat)->where('mothers_last_name', '=', $result->mat)->where('birth_date', '=', $birth_date)->where('date_entry', '=', $date_entry)->where('identity_card', '=', Util::RepeatedIdentityCard($result->car))->first(); if (!$affiliate) { $affiliate = new Affiliate(); $affiliate->identity_card = Util::zero($result->car); $affiliate->gender = $result->sex; $NewAffi++; } else { $UpdateAffi++; } } else { $UpdateAffi++; } $affiliate->change_date = $month_year; switch ($result->desg) { case '1': //Disponibilidad $affiliate->affiliate_state_id = 3; break; case '3': //Comisión $affiliate->affiliate_state_id = 2; break; default: //Servicio $affiliate->affiliate_state_id = 1; } switch ($result->desg) { case '5': //Batallón $affiliate->affiliate_type_id = 2; break; default: //Comando $affiliate->affiliate_type_id = 1; } if ($result->uni) { $affiliate->unit_id = $unit_id; } if ($result->gra) { $affiliate->degree_id = $degree_id; } $affiliate->category_id = $category_id; $affiliate->user_id = 1; $affiliate->last_name = Util::replaceCharacter($result->pat); $affiliate->mothers_last_name = Util::replaceCharacter($result->mat); $affiliate->first_name = Util::replaceCharacter($first_name); $affiliate->second_name = Util::replaceCharacter($second_name); $affiliate->surname_husband = Util::replaceCharacter($result->apes); $affiliate->civil_status = $result->eciv; $affiliate->nua = $result->nua; $affiliate->afp = Util::getAfp($result->afp); $affiliate->item = $result->item; $affiliate->birth_date = $birth_date; $affiliate->date_entry = $date_entry; $affiliate->registration = Util::CalcRegistration($birth_date, $affiliate->last_name, $affiliate->mothers_last_name, $affiliate->first_name, $affiliate->gender); $affiliate->save(); if (Util::decimal($result->sue) != 0) { $contribution = Contribution::where('month_year', '=', $month_year)->where('affiliate_id', '=', $affiliate->id)->first(); if (!$contribution) { $contribution = new Contribution(); $contribution->user_id = 1; $contribution->contribution_type_id = 1; $contribution->affiliate_id = $affiliate->id; $contribution->month_year = $month_year; if ($result->uni) { $contribution->unit_id = $unit_id; } $contribution->breakdown_id = $breakdown_id; if ($result->gra) { $contribution->degree_id = $degree_id; } $contribution->category_id = $category_id; $contribution->item = $result->item; $contribution->base_wage = Util::decimal($result->sue); $contribution->seniority_bonus = Util::decimal($result->cat); $contribution->study_bonus = Util::decimal($result->est); $contribution->position_bonus = Util::decimal($result->carg); $contribution->border_bonus = Util::decimal($result->fro); $contribution->east_bonus = Util::decimal($result->ori); $contribution->public_security_bonus = Util::decimal($result->bseg); $contribution->deceased = $result->dfu; $contribution->natality = $result->nat; $contribution->lactation = $result->lac; $contribution->prenatal = $result->pre; $contribution->subsidy = Util::decimal($result->sub); $contribution->gain = Util::decimal($result->gan); $contribution->payable_liquid = Util::decimal($result->pag); $contribution->quotable = (double) $contribution->base_wage + (double) $contribution->seniority_bonus + (double) $contribution->study_bonus + (double) $contribution->position_bonus + (double) $contribution->border_bonus + (double) $contribution->east_bonus; $contribution->total = Util::decimal($result->mus); $percentage = round($contribution->total / $contribution->quotable * 100, 1); if ($percentage == 2.5) { $contribution->retirement_fund = $contribution->total * 1.85 / $percentage; $contribution->mortuary_quota = $contribution->total * 0.65 / $percentage; } else { $this->error('Unknown percentage of contribution!'); exit; } $contribution->save(); $NewContri++; } } $Progress->advance(); }); }); $time_end = microtime(true); $execution_time = ($time_end - $time_start) / 60; $TotalAffi = $NewAffi + $UpdateAffi; $TotalNewAffi = $NewAffi ? $NewAffi : "0"; $TotalUpdateAffi = $UpdateAffi ? $UpdateAffi : "0"; $TotalAffi = $TotalAffi ? $TotalAffi : "0"; $TotalNewContri = $NewContri ? $NewContri : "0"; $Progress->finish(); $this->info("\n\nReport {$Date}:\n\n {$TotalNewAffi} new affiliates.\n\n {$TotalUpdateAffi} affiliates successfully updated.\n\n Total {$TotalAffi} affiliates.\n\n Total {$TotalNewContri} entered contributions.\n\n Execution time {$execution_time} [minutes].\n"); \Storage::disk('local')->put('ImportPayroll_' . $Date . '.txt', "\n\nReport:\n\n\n {$TotalNewAffi} new affiliates.\n\n {$TotalUpdateAffi} affiliates successfully updated.\n\n Total {$TotalAffi} affiliates.\n\n Total {$TotalNewContri} entered contributions.\n\n Execution time {$execution_time} [minutes].\n"); } } else { $this->error('Incorrect password!'); exit; } }
public function SelectData(Request $request) { $affiliate = Affiliate::idIs($request->affiliate_id)->first(); $afi["affiliate"] = $affiliate->id; $group_contributions = new Collection(); $now = Carbon::now(); $from = Carbon::parse($affiliate->date_entry); $to = Carbon::createFromDate($now->year, $now->month, 1)->subMonth(); for ($i = $from->year; $i <= $to->year; $i++) { $count = 0; $total = 0; $base = array(); $mes = array(); for ($j = 1; $j <= 12; $j++) { $contribution = Contribution::select(['month_year'])->where('affiliate_id', $affiliate->id)->where('month_year', '=', Carbon::createFromDate($i, $j, 1)->toDateString())->first(); if ($contribution) { $mes["m" . $j] = 1; $count++; $total++; } else { $mes["m" . $j] = 0; $total++; } if ($i == $from->year) { if ($j < $from->month) { $mes["m" . $j] = -1; $total--; } } if ($i == $to->year) { if ($j > $to->month) { $mes["m" . $j] = -1; $total--; } } $base = array_merge($base, $mes); } if ($total == $count) { $c["status"] = false; } else { $c["status"] = true; } $year = array('year' => $i); $group_contributions->push(array_merge($afi, $c, $year, $base)); } return Datatables::of($group_contributions)->editColumn('m1', '<?php if($m1 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m1 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m1 === -1){ ?> <?php } ?>')->editColumn('m2', '<?php if($m2 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m2 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m2 === -1){ ?> <?php } ?>')->editColumn('m3', '<?php if($m3 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m3 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m3 === -1){ ?> <?php } ?>')->editColumn('m4', '<?php if($m4 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m4 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m4 === -1){ ?> <?php } ?>')->editColumn('m5', '<?php if($m5 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m5 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m5 === -1){ ?> <?php } ?>')->editColumn('m6', '<?php if($m6 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m6 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m6 === -1){ ?> <?php } ?>')->editColumn('m7', '<?php if($m7 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m7 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m7 === -1){ ?> <?php } ?>')->editColumn('m8', '<?php if($m8 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m8 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m8 === -1){ ?> <?php } ?>')->editColumn('m9', '<?php if($m9 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m9 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m9 === -1){ ?> <?php } ?>')->editColumn('m10', '<?php if($m10 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m10 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m10 === -1){ ?> <?php } ?>')->editColumn('m11', '<?php if($m11 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m11 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m11 === -1){ ?> <?php } ?>')->editColumn('m12', '<?php if($m12 === 1){ ?><i class="glyphicon glyphicon-check"></i><?php } if($m12 === 0){?><i class="glyphicon glyphicon-unchecked"></i><?php } if($m12 === -1){ ?> <?php } ?>')->addColumn('action', ' <?php if($status){ ?> <div class="btn-group" style="margin:-6px 0;"> <a href="{{ url("calculation_contribution")}}/{{$affiliate}}/{{$year}}/normal" class="btn btn-success btn-raised btn-sm"><i class="glyphicon glyphicon-edit"></i></a> <a href="" data-target="#" class="btn btn-success btn-raised btn-sm dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="{{ url("calculation_contribution")}}/{{$affiliate}}/{{$year}}/reintegro" style="padding:3px 10px;"><i class="glyphicon glyphicon-pencil"></i> reintegro</a></li> </ul> </div> <?php } ?>')->make(true); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($direct_contribution) { $affiliate = Affiliate::IdIs($direct_contribution->affiliate_id)->first(); $contribution = Contribution::where('direct_contribution_id', '=', $direct_contribution->id)->first(); $data = ['direct_contribution' => $direct_contribution, 'affiliate' => $affiliate, 'year' => $contribution->month_year, 'type' => $contribution ? "Normal" : "Reintegro"]; return view('direct_contributions.show', $data); }
{ return $this->belongsTo('Muserpol\\Unit'); } public function contribution_type() { return $this->belongsTo('Muserpol\\ContributionType'); } public function category() { return $this->belongsTo('Muserpol\\Category'); } public function scopeIdIs($query, $id) { return $query->where('id', $id); } public function scopeAffiliateidIs($query, $id) { return $query->where('affiliate_id', $id); } public function scopeAfiContribution($query, $year) { return $query = DB::table('contributions')->select(DB::raw('SUM(contributions.total) total, year(contributions.month_year) as month_year'))->whereYear('contributions.month_year', '=', $year); } public function scopeVoluntaryContribution($query, $month, $year) { return $query = DB::table('contributions')->select(DB::raw('COUNT(*) total, month(contributions.month_year) as month'))->where('contributions.contribution_type_id', '=', 2)->whereMonth('contributions.month_year', '=', $month)->whereYear('contributions.month_year', '=', $year); } } Contribution::updating(function ($contribution) { Activity::updateContribution($contribution); });
/** * Show the application dashboard to the user. * * @return Response */ public function showIndex() { $AfiServ = DB::table('affiliates')->select(DB::raw('COUNT(*) totalAfiS'))->where('affiliates.affiliate_state_id', '=', 1)->get(); foreach ($AfiServ as $item) { $totalAfiServ = $item->totalAfiS; } $AfiComi = DB::table('affiliates')->select(DB::raw('COUNT(*) totalAfiC'))->where('affiliates.affiliate_state_id', '=', 2)->get(); foreach ($AfiComi as $item) { $totalAfiComi = $item->totalAfiC; } $affiliateState = AffiliateState::all(); $affiliateType = AffiliateType::all(); $district = DB::table('units')->select(DB::raw('DISTINCT (units.district) as district'))->get(); $year = Carbon::now()->year; foreach ($affiliateState as $item) { $TotalAffiliates = Affiliate::afibyState($item->id, $year)->first(); $Total_AffiliatebyState[$item->id] = $TotalAffiliates->total; } foreach ($affiliateType as $item) { $Afitype = Affiliate::afibyType($item->id, $year)->first(); $Total_AffiliatebyType[$item->id] = $Afitype->type; } //Total Contributions of last five year, disaggregated by year. $lastContribution = DB::table('contributions')->orderBy('month_year', 'desc')->first(); if ($lastContribution) { $date_contribution = Carbon::parse($lastContribution->month_year)->subYears(5); $yearc = Carbon::parse($date_contribution)->year; $listYear = DB::table('contributions')->select(DB::raw('DISTINCT(year(contributions.month_year)) as year'))->whereYear('contributions.month_year', '>', $yearc)->orderBy('contributions.month_year', 'asc')->get(); foreach ($listYear as $item) { $totalContribution = Contribution::afiContribution($item->year)->first(); $list_totalcontribution[] = $totalContribution->total; $list_year[] = $totalContribution->month_year; } $totalContributionByYear = array($list_year, $list_totalcontribution); } else { $list_totalcontribution[] = 0; $list_year[] = 0; $totalContributionByYear = array($list_year, $list_totalcontribution); } // Total Affiliates disaggregated by district. foreach ($district as $item) { $afiDistrict = Affiliate::afiDistrict($item->district, $year)->first(); $list_affiliateByDisctrict[$item->district] = $afiDistrict->district; } //Total Retirement Fund of current year, disaggregated by month. $current_date = Carbon::now(); $current_year = Carbon::parse($current_date)->year; $monthRetirementFund = DB::table('retirement_funds')->select(DB::raw('DISTINCT(month(retirement_funds.reception_date)) as month'))->whereYear('retirement_funds.reception_date', '=', $current_year)->orderBy('retirement_funds.reception_date', 'asc')->get(); if ($monthRetirementFund) { foreach ($monthRetirementFund as $item) { $totalRetirementFundByMonth = RetirementFund::totalRetirementFund($item->month, $current_year)->first(); $list_month[] = Util::getMes($totalRetirementFundByMonth->month); $list_totalRetirementFundByMonth[] = $totalRetirementFundByMonth->total; } $total_retirementFundByMonth = array($list_month, $list_totalRetirementFundByMonth); } else { $list_month[] = 0; $list_totalRetirementFundByMonth[] = 0; $total_retirementFundByMonth = array($list_month, $list_totalRetirementFundByMonth); } //voluntary contribution by current year $monthVoluntaryContribution = DB::table('contributions')->select(DB::raw('DISTINCT(month(contributions.month_year)) as month'))->where('contributions.contribution_type_id', '=', 2)->whereYear('contributions.month_year', '=', $current_year)->orderBy('contributions.month_year', 'asc')->get(); if ($monthVoluntaryContribution) { foreach ($monthVoluntaryContribution as $item) { $totalVoluntaryContributionByMonth = Contribution::voluntaryContribution($item->month, $current_year)->first(); $list_monthVoluntaryContribution[] = Util::getMes($totalVoluntaryContributionByMonth->month); $list_amountVoluntaryContribution[] = $totalVoluntaryContributionByMonth->total; } $total_voluntayContributionByMonth = array($list_monthVoluntaryContribution, $list_amountVoluntaryContribution); } else { $list_monthVoluntaryContribution[] = 0; $list_amountVoluntaryContribution[] = 0; $total_voluntayContributionByMonth = array($list_monthVoluntaryContribution, $list_amountVoluntaryContribution); } $activities = Activity::orderBy('created_at', 'desc')->take(10)->get(); $totalAfi = $totalAfiServ + $totalAfiComi; $data = ['activities' => $activities, 'totalAfiServ' => $totalAfiServ, 'totalAfiComi' => $totalAfiComi, 'totalAfi' => $totalAfi, 'Total_AffiliatebyState' => $Total_AffiliatebyState, 'Total_AffiliatebyType' => $Total_AffiliatebyType, 'totalContributionByYear' => $totalContributionByYear, 'list_affiliateByDisctrict' => $list_affiliateByDisctrict, 'total_retirementFundByMonth' => $total_retirementFundByMonth, 'total_voluntayContributionByMonth' => $total_voluntayContributionByMonth, 'current_year' => $current_year]; return view('dashboard.index', $data); //return response()->json($totalAfiServ); }
public function getData($afid) { $affiliate = Affiliate::idIs($afid)->first(); $spouse = Spouse::affiliateidIs($afid)->first(); if (!$spouse) { $spouse = new Spouse(); } $retirement_fund = RetirementFund::afiIs($afid)->first(); if (!$retirement_fund) { $now = Carbon::now(); $last_retirement_fund = RetirementFund::whereYear('created_at', '=', $now->year)->where('deleted_at', '=', null)->orderBy('id', 'desc')->first(); $retirement_fund = new RetirementFund(); if ($last_retirement_fund) { $number_code = Util::separateCode($last_retirement_fund->code); $code = $number_code + 1; } else { $code = 1; } $retirement_fund->code = $code . "/" . $now->year; $retirement_fund->affiliate_id = $afid; $retirement_fund->save(); } $applicant = Applicant::retirementFundIs($retirement_fund->id)->first(); if (!$applicant) { $applicant = new Applicant(); } $requirements = Requirement::modalityIs($retirement_fund->retirement_fund_modality_id)->get(); $documents = Document::retirementFundIs($retirement_fund->id)->get(); $antecedents = Antecedent::retirementFundIs($retirement_fund->id)->get(); if ($retirement_fund->retirement_fund_modality_id) { $info_modality = TRUE; } else { $info_modality = FALSE; } if ($applicant->identity_card) { $info_applicant = TRUE; } else { $info_applicant = FALSE; } if (Document::retirementFundIs($retirement_fund->id)->first()) { $info_documents = TRUE; } else { $info_documents = FALSE; } if (Antecedent::retirementFundIs($retirement_fund->id)->first()) { $info_antecedents = TRUE; } else { $info_antecedents = FALSE; } if ($retirement_fund->comment) { $info_comment = TRUE; } else { $info_comment = FALSE; } $lastContribution = Contribution::affiliateidIs($affiliate->id)->orderBy('month_year', 'desc')->first(); $affiliate->service_start_date = $affiliate->date_entry; $affiliate->service_end_date = $lastContribution->month_year; $data = array('affiliate' => $affiliate, 'spouse' => $spouse, 'retirement_fund' => $retirement_fund, 'applicant' => $applicant, 'requirements' => $requirements, 'documents' => $documents, 'antecedents' => $antecedents, 'info_modality' => $info_modality, 'info_applicant' => $info_applicant, 'info_documents' => $info_documents, 'info_antecedents' => $info_antecedents, 'info_comment' => $info_comment); $data = array_merge($data, self::getViewModel()); return $data; }