return Util::getDateEdit($this->birth_date); } public function getFullNametoPrint() { return $this->fisrt_name . ' ' . $this->second_name . ' ' . $this->last_name . ' ' . $this->mothers_last_name; } public function getFullDateNactoPrint() { if ($this->birth_date) { $meses = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); return date("d", strtotime($this->birth_date)) . " de " . $meses[date("m", strtotime($this->birth_date)) - 1] . " de " . date("Y", strtotime($this->fech_nac)); } } public function getFull_fech_decetoPrint() { if ($this->date_death) { $meses = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); return date("d", strtotime($this->date_death)) . " " . $meses[date("n", strtotime($this->date_death)) - 1] . " " . date("Y", strtotime($this->date_death)); } } public function getFullName() { return $this->last_name . ' ' . $this->mothers_last_name . ' ' . $this->first_name . ' ' . $this->second_name; } } Spouse::created(function ($spouse) { Activity::createdSpouse($spouse); }); Spouse::updating(function ($spouse) { Activity::updateSpouse($spouse); });
public function getFullNametoPrint() { return $this->first_name . ' ' . $this->last_name . ' ' . $this->mothers_last_name; } public function getParentesco() { if ($this->applicant_type->id == 3) { return $this->kinship; } else { return $this->applicant_type->name; } } public function getFullDateNactoPrint() { return Util::getfulldate($this->fech_nac); } public function getFullNumber() { return $this->home_phone_number . ' ' . $this->home_cell_phone_number; } public function getFullName() { return $this->last_name . ' ' . $this->mothers_last_name . ' ' . $this->first_name; } } Applicant::created(function ($applicant) { Activity::createdApplicant($applicant); }); Applicant::updating(function ($applicant) { Activity::updateApplicant($applicant); });
{ protected $table = 'antecedents'; protected $fillable = ['antecedent_file_id', 'retirement_fund_id', 'status', 'reception_date', 'code']; protected $guarded = ['id']; public function retirement_fund() { return $this->belongsTo('Muserpol\\RetirementFund'); } public function antecedent_file() { return $this->belongsTo('Muserpol\\AntecedentFile'); } public function scopeRetirementFundIs($query, $id) { return $query->where('retirement_fund_id', $id); } public function getData_fech_requi() { return Util::getdateabre($this->fech_pres); } public function getDataEdit() { return Util::getdateforEdit($this->fecha); } } Antecedent::created(function ($antecedent) { Activity::createdAntecedent($antecedent); }); Antecedent::updating(function ($antecedent) { Activity::updateAntecedent($antecedent); });
public function getYearsAndMonths_fech_ini_reco() { return Util::getYearsAndMonths($this->fech_ini_reco, $this->fech_fin_reco); } public function getNumberTram() { if ($this->code) { return $this->code . "/" . Carbon::parse($this->created_at)->year; } } public function getStatus() { if ($this->fech_ven && $this->fech_arc && $this->fech_cal && $this->fech_dic) { return "FINALIZADO"; } elseif ($this->fech_ven && $this->fech_arc && $this->fech_cal) { return "DICTAMEN LEGAL"; } elseif ($this->fech_ven && $this->fech_arc) { return "CALIFICACIÓN"; } elseif ($this->fech_ven) { return "ARCHIVO"; } else { return "VENTANILLA"; } } } RetirementFund::created(function ($retirementfund) { Activity::createdRetirementFund($retirementfund); }); RetirementFund::updating(function ($retirementfund) { Activity::updateRetirementFund($retirementfund); });
{ 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); }
return Util::getfulldate($this->fech_fin_apor); } public function getData_fech_bajatoPrint() { return Util::getfulldate($this->date_decommissioned); } public function getData_fech_ini_Reco_print() { if ($this->fech_ini_reco) { return $this->fech_ini_reco; } else { return $this->fech_ing; } } public function getData_fech_fin_Reco_print() { if ($this->fech_fin_reco) { return $this->fech_fin_reco; } else { $lastAporte = Aporte::afiliadoId($this->id)->orderBy('gest', 'desc')->first(); return $lastAporte->gest; } } } Affiliate::created(function ($affiliate) { Record::CreatedAffiliate($affiliate); }); Affiliate::updating(function ($affiliate) { Activity::updateAffiliate($affiliate); Record::UpdatingAffiliate($affiliate); });
public static function createdApplicant($applicant) { if (Auth::user()) { $RetirementFund = RetirementFund::findOrFail($applicant->retirement_fund_id); $affiliate = Affiliate::findOrFail($RetirementFund->affiliate_id); $activity = new Activity(); $activity->user_id = Auth::user()->id; $activity->affiliate_id = $affiliate->id; $activity->applicant_id = $applicant->id; $activity->retirement_fund_id = $applicant->retirement_fund_id; $activity->activity_type_id = ACTIVITY_TYPE_CREATE_APPLICANT; $activity->message = Util::encodeActivity(Auth::user(), 'Creó al Solicitante', $applicant); $activity->save(); } }
{ protected $table = 'documents'; protected $fillable = ['requirement_id', 'retirement_fund_id', 'reception_date', 'status', 'comment']; protected $guarded = ['id']; public function retirement_fund() { return $this->belongsTo('Muserpol\\RetirementFund'); } public function requirement() { return $this->belongsTo('Muserpol\\Requirement'); } public function scopeRetirementFundIs($query, $id) { return $query->where('retirement_fund_id', $id); } public function getData_fech_requi() { return Util::getDateAbrePeriod($this->reception_date); } public function getDataEdit() { return Util::getdateforEdit($this->fech_pres); } } Document::created(function ($document) { Activity::createdDocument($document); }); Document::updating(function ($document) { Activity::updateDocument($document); });