%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/pjc/app/Http/Controllers/
Upload File :
Create Path :
Current File : /var/www/pjc/app/Http/Controllers/Budget.php

<?php
use Illuminate\Support\Facades\Response;
namespace App\Http\Controllers;
use DB;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Input;
use Illuminate\Http\Request;
class Budget extends Controller {

	/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
	public function index()
	{

		$settori = array('0' => '3', '1' => '2','2' => '4','3' => '1');


		foreach($settori as $key => $item)
		{
			$risultato=DB::table('budget')->where('idSettore',$item)->orderBy('mese')->get();
			foreach($risultato as $item2)
			{
				$dati[$key][]=$item2->importo;
			}


		}

		$elettrico = DB::table('budget')->where('idSettore')->get();


		$mesi =  array(1=>'Gennaio',2=>'Febbraio',3=>'Marzo',4=>'Aprile',5=>'Maggio',6=>'Giugno',7=>'Luglio',8=>'Agosto',9=>'Settembre',10=>'Ottobre',11=>'Novembre',12=>'Dicembre');
		$settori = array(0 => 'Elettrico',1 => 'Termico',2 => 'Sicurezza',3 => 'Anti Incendio');

		return view('budget.index')->withMesi($mesi)->withSettori($settori)->withDati($dati);
	}


	/**
	 * Show the form for creating a new resource.
	 *
	 * @return Response
	 */
	public function create()
	{
		//
	}


	/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
	public function store(Request $request)
	{



		$gen= $request->get('Gennaio');
		$feb= $request->get('Febbraio');
		$mar= $request->get('Marzo');
		$apr= $request->get('Aprile');
		$mag= $request->get('Maggio');
		$giu= $request->get('Giugno');
		$lug= $request->get('Luglio');
		$ago= $request->get('Agosto');
		$set= $request->get('Settembre');
		$ott= $request->get('Ottobre');
		$nov= $request->get('Novembre');
		$dic= $request->get('Dicembre');

		$settori = array('0' => '3', '1' => '2','2' => '4','3' => '1');

		$i=0;
		foreach($settori as $key => $item)
		{
			DB::table('budget')->where('idSettore',$item)->where('mese',1)->update(array('importo' => $gen[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',2)->update(array('importo' => $feb[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',3)->update(array('importo' => $mar[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',4)->update(array('importo' => $apr[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',5)->update(array('importo' => $mag[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',6)->update(array('importo' => $giu[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',7)->update(array('importo' => $lug[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',8)->update(array('importo' => $ago[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',9)->update(array('importo' => $set[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',10)->update(array('importo' => $ott[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',11)->update(array('importo' => $nov[$i]));
			DB::table('budget')->where('idSettore',$item)->where('mese',12)->update(array('importo' => $dic[$i]));

			$i++;
		}
		
		return Redirect::action('Budget@index');
	}


	/**
	 * Display the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function show($id)
	{
		//
	}


	/**
	 * Show the form for editing the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function edit($id)
	{
		//
	}


	/**
	 * Update the specified resource in storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function update($id)
	{
		//
	}


	/**
	 * Remove the specified resource from storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
		//
	}


}

Zerion Mini Shell 1.0