test feature di reportbudget
This commit is contained in:
parent
690b356a02
commit
55a7a68826
@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
//use Rap2hpoutre\FastExcel\FastExcel;
|
||||
use Rap2hpoutre\FastExcel\FastExcel;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class MovimentiController extends Controller
|
||||
{
|
||||
@ -254,6 +255,56 @@ class MovimentiController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function reportCategorieAnno($anno=0)
|
||||
{
|
||||
if ($anno <= 1970)
|
||||
{
|
||||
$anno = date('Y');
|
||||
}
|
||||
|
||||
$mesi=['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
|
||||
$categorie=DB::table('categories')->orderBy('cat_name')->get();
|
||||
|
||||
foreach ($categorie as $categoria)
|
||||
{
|
||||
$id=$categoria->id;
|
||||
$ncategoria=$categoria->cat_name;
|
||||
for ($i=1;$i<=12;$i++)
|
||||
{
|
||||
// $SQL="SELECT SUM(mov_importo) as totale, WHERE Year(mov_data)=".$anno." AND Month(mov_data)=".$i." AND mov_fk_categoria=".$categoria->id;
|
||||
$movrow=DB::table('movimentis')
|
||||
|
||||
->whereMonth('mov_data','=',$i)
|
||||
->whereYear('mov_data','=',$anno)
|
||||
|
||||
->where('mov_fk_categoria','=',$id)
|
||||
->sum('mov_importo');
|
||||
|
||||
$coll[] = ['totale' => $movrow];
|
||||
/*
|
||||
foreach ($movrow as $mov)
|
||||
{
|
||||
echo($mov->mov_importo);
|
||||
$coll[] = ['totale' => $movrow];
|
||||
|
||||
// ','categoria'=>$ncategoria,
|
||||
// 'categoria_id'=>$id,
|
||||
// 'mese'=>$i
|
||||
// ]);
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// dd($movrow);
|
||||
/*dd(array_chunk($coll, 12));*/
|
||||
return view('conti.report.catanno',[
|
||||
'categorie'=>$categorie,
|
||||
'mesi'=>$mesi,
|
||||
'matrice'=>array_chunk($coll, 12)
|
||||
]);
|
||||
}
|
||||
|
||||
public function apiList()
|
||||
{
|
||||
|
68
resources/views/conti/report/catanno.blade.php
Normal file
68
resources/views/conti/report/catanno.blade.php
Normal file
@ -0,0 +1,68 @@
|
||||
<!-- Report categorie dell'anno suddiviso per mesi -->
|
||||
@extends('admin')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header">Rapporto dei movimenti</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Rapporto spese per categoria nell'arco dell'anno {{ $anno ?? '' }}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-striped table-bordered table-hover" id="listrapporto">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Categoria</td>
|
||||
@foreach($mesi as $mese)
|
||||
<td>{{ $mese }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$cat=0;
|
||||
@endphp
|
||||
@foreach($categorie as $categoria)
|
||||
<tr>
|
||||
|
||||
<td>{{ $categoria->cat_name}}</td>
|
||||
@php
|
||||
|
||||
$index=0;
|
||||
while($index<12)
|
||||
{
|
||||
@endphp
|
||||
|
||||
<td>{{ $matrice[$cat][$index]['totale'] }}</td>
|
||||
@php
|
||||
$index++;
|
||||
}
|
||||
$cat++;
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@endsection
|
||||
@section('script')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#listrapporto').DataTable({
|
||||
responsive: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
@ -66,3 +66,5 @@ Route::get('/', function () {
|
||||
Route::get('fullcalender', [FullCalenderController::class, 'index']);
|
||||
Route::post('fullcalenderAjax', [FullCalenderController::class, 'ajax']);
|
||||
Route::get('condominio',[CondominioController::class,'testPdf']);
|
||||
Route::get('reportbudget',[MovimentiController::class,'reportCategorieAnno']);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user