public function record_neighbors() { $user_id = Auth::user()->id; $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $urbanismo = $urbanism->id; $urb_name = $urbanism->Colony->name; $property_id = NeighborProperty::where('urbanism_id', '=', $urbanismo)->pluck('id'); $vigencia = date("Y-m"); $months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Decem"); $today = date("Y-m-d"); $ano = date("Y"); $selano = Payment::select(DB::raw('DATE_FORMAT(payments.created_at,\'%Y\') as y'))->groupBy(DB::raw('Year(payments.created_at)'))->orderBy(DB::raw('Year(payments.created_at)'))->get(); $monthly_all = MonthlyFee::where('monthly_fee.urbanism_id', '=', $urbanismo)->where(DB::raw('DATE_FORMAT(monthly_fee.since,\'%Y\')'), '=', $ano)->get(); $monthly_ini = MonthlyFee::where('monthly_fee.urbanism_id', '=', $urbanismo)->where(DB::raw('DATE_FORMAT(monthly_fee.since,\'%Y\')'), '=', $ano)->orderBy('monthly_fee.created_at', 'ASC')->pluck('since'); $mes_ini = (int) date("m", strtotime($monthly_ini)); $cuotas = array(); foreach ($monthly_all as $cuota_mensual) { $ini = (int) date("m", strtotime($cuota_mensual->since)); $fin = (int) date("m", strtotime($cuota_mensual->until)); if ($cuota_mensual->until == NULL) { $fin = (int) date("m"); } for ($i = $ini; $i <= $fin; $i++) { $cuotas[$months[$i - 1]] = $cuota_mensual->amount; } } $neighbors = NeighborProperty::with('Neighbors')->where('urbanism_id', '=', $urbanismo)->get(); $breadcrumbs = Neighbors::where('user_id', '=', $user_id)->first(); $breadcrumbs_data = $breadcrumbs->name . " " . $breadcrumbs->last_name . " [ " . $urb_name . " ]"; return View::make('dashboard.payments.neighbors.index', ['cuotas' => $cuotas, 'mes_ini' => $mes_ini, 'months' => $months, 'selano' => $selano, 'urbanism' => $urbanismo, 'breadcrumbs_data' => $breadcrumbs_data, 'neighbors' => $neighbors, 'ini' => $ini, 'fin' => $fin, 'ano' => $ano]); }
public function charges_balances() { $user_id = Auth::user()->id; $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $urbanismo = $urbanism->id; $urb_name = $urbanism->Colony->name; $neighbors = NeighborProperty::with('Neighbors')->where('urbanism_id', '=', $urbanismo)->get(); $breadcrumbs = Neighbors::with('NeighborProperty')->where('user_id', '=', $user_id)->first(); $breadcrumbs_data = $breadcrumbs->name . " " . $breadcrumbs->last_name . " [ " . $urb_name . " ]"; return View::make('dashboard.incomes.charges.balances', ['neighbors' => $neighbors, 'breadcrumbs_data' => $breadcrumbs_data]); }
public function suggestion() { $user_id = Auth::user()->id; $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $neighbor = Neighbors::where('user_id', '=', $user_id)->first(); $neighbors = NeighborProperty::with('Neighbors')->where('urbanism_id', '=', $urbanism->id)->where('neighbors_id', '!=', $neighbor->id)->get(); $breadcrumbs = Neighbors::where('user_id', '=', $user_id)->first(); $breadcrumbs_data = $breadcrumbs->name . " " . $breadcrumbs->last_name . " [ " . $urbanism->Colony->name . " ]"; $suggestions = DB::table('suggestions')->select('suggestions.id', 'suggestions.user_id', 'neighbors.name', 'neighbors.last_name', 'suggestions.asunto', 'suggestions.contenido', 'suggestions.id_mensaje', 'suggestions.mark', 'suggestions.created_at')->join('neighbors', 'neighbors.user_id', '=', 'suggestions.user_id')->where('id_receptor', '=', $user_id)->where('tray', '<>', 0)->orderBy('created_at', 'desc')->paginate(10); $count = Suggestion::where('id_receptor', '=', $user_id)->where('tray', '<>', 0)->where('mark', '<>', 'read')->count(); $suggestionsSent = Suggestion::where('user_id', '=', $user_id)->where('tray', '<>', 0)->get(); return View::make('dashboard.colonies.suggestions.suggestion', ['usuario' => $breadcrumbs_data, 'urbanism' => $urbanism->id, 'admin' => $neighbor->id, 'suggestions' => $suggestions, 'count' => $count, 'suggestionsSent' => $suggestionsSent, 'contador' => 1]); }
public function sugerenciasPapelera() { $user_id = Auth::user()->id; $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $neighbor = Neighbors::where('user_id', '=', $user_id)->first(); $neighbors = NeighborProperty::with('Neighbors')->where('urbanism_id', '=', $urbanism->id)->where('neighbors_id', '!=', $neighbor->id)->get(); $breadcrumbs = Neighbors::where('user_id', '=', $user_id)->first(); $breadcrumbs_data = $breadcrumbs->name . " " . $breadcrumbs->last_name . " [ " . $urbanism->Colony->name . " ]"; $suggestions = Suggestion::where('user_id', '=', $user_id)->where('tray', '=', 0)->where('bd_inbox', '=', 1)->orderBy('created_at', 'desc')->paginate(10); $count = Suggestion::where('id_receptor', '=', $user_id)->where('tray', '<>', 0)->where('bd_inbox', '=', 2)->where('mark', '<>', 'read')->count(); return View::make('dashboard.colonies.suggestions.suggestions_trash', ['usuario' => $breadcrumbs_data, 'urbanism' => $urbanism, 'admin' => $neighbor->id, 'suggestions' => $suggestions, 'count' => $count, 'contador' => 1, 'neighbor' => $neighbor]); }
public function reportStatus() { $user_id = Auth::user()->id; $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $urbanismo = $urbanism->id; $urb_name = $urbanism->name; $property_id = NeighborProperty::where('urbanism_id', '=', $urbanismo)->pluck('id'); $vigencia = date("Y-m"); $months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Decem"); $today = date("Y-m-d"); $ano = date("Y"); $selano = Payment::select(DB::raw('DATE_FORMAT(payments.created_at,\'%Y\') as y'))->groupBy(DB::raw('Year(payments.created_at)'))->orderBy(DB::raw('Year(payments.created_at)'))->get(); $monthly_all = MonthlyFee::where('monthly_fee.urbanism_id', '=', $urbanismo)->where(DB::raw('DATE_FORMAT(monthly_fee.since,\'%Y\')'), '=', $ano)->get(); $monthly_ini = MonthlyFee::where('monthly_fee.urbanism_id', '=', $urbanismo)->where(DB::raw('DATE_FORMAT(monthly_fee.since,\'%Y\')'), '=', $ano)->orderBy('monthly_fee.created_at', 'ASC')->pluck('since'); $mes_ini = (int) date("m", strtotime($monthly_ini)); $cuotas = array(); foreach ($monthly_all as $cuota_mensual) { $ini = (int) date("m", strtotime($cuota_mensual->since)); $fin = (int) date("m", strtotime($cuota_mensual->until)); if ($cuota_mensual->until == NULL) { $fin = (int) date("m"); } for ($i = $ini; $i <= $fin; $i++) { $cuotas[$months[$i - 1]] = $cuota_mensual->amount; } } $neighbors = NeighborProperty::with('Neighbors')->where('urbanism_id', '=', $urbanismo)->get(); $breadcrumbs = Neighbors::select('neighbors.name as name_ne', 'neighbors.last_name', 'urbanisms.name as name_ur ')->join('neighbors_properties', 'neighbors.id', '=', 'neighbors_properties.neighbors_id')->join('urbanisms', 'neighbors_properties.urbanism_id', '=', 'urbanisms.id')->where('neighbors.user_id', '=', self::getUserId())->first(); $breadcrumbs_data = $breadcrumbs->name_ne . " " . $breadcrumbs->last_name . " [" . $breadcrumbs->name_ur . "]"; $data = ['mes_ini' => $mes_ini, 'months' => $months, 'cuotas' => $cuotas, 'selano' => $selano, 'urbanism' => $urbanismo, 'breadcrumbs_data' => $breadcrumbs_data, 'neighbors' => $neighbors, 'ini' => $ini, 'fin' => $fin, 'ano' => $ano, 'breadcrumbs_data' => $breadcrumbs_data]; $pdf = PDF::loadView('dashboard.reports.status.pdf', $data); return $pdf->download('reporte_Estato_cuanta_general.pdf'); }