Sistemato esportazione reportCategorie AnnoXLS in MovimentiController
This commit is contained in:
parent
90bd6e1eeb
commit
71d75ef464
@ -241,20 +241,12 @@ class MovimentiController extends Controller
|
|||||||
->where('mov_fk_categoria', '=', $id)
|
->where('mov_fk_categoria', '=', $id)
|
||||||
->sum('mov_importo_avere');
|
->sum('mov_importo_avere');
|
||||||
|
|
||||||
// $movrow=DB::table('movimentis')
|
|
||||||
// ->whereMonth('mov_data','=',$i)
|
|
||||||
// ->whereYear('mov_data','=',$anno)
|
|
||||||
// ->where('mov_fk_categoria','=',$id)
|
|
||||||
// ->sum('mov_importo_dare')
|
|
||||||
// ->sum('mov_importo_avere');
|
|
||||||
$movrow = $importo_avere - $importo_dare;
|
$movrow = $importo_avere - $importo_dare;
|
||||||
|
|
||||||
$coll[]=$movrow;
|
$coll[]=$movrow;
|
||||||
$collx[]=$movrow;
|
$collx[]=$movrow;
|
||||||
}
|
}
|
||||||
//TEST
|
|
||||||
// dd($movrow);
|
|
||||||
// /TEST
|
|
||||||
$totale[]=array_sum($collx);
|
$totale[]=array_sum($collx);
|
||||||
unset($collx);
|
unset($collx);
|
||||||
}
|
}
|
||||||
@ -281,7 +273,7 @@ class MovimentiController extends Controller
|
|||||||
$intestazione=['Categoria','Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
|
$intestazione=['Categoria','Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
|
||||||
$categorie=DB::table('categories')->orderBy('cat_name')->get();
|
$categorie=DB::table('categories')->orderBy('cat_name')->get();
|
||||||
|
|
||||||
foreach ($categorie as $categoria)
|
/*foreach ($categorie as $categoria)
|
||||||
{
|
{
|
||||||
$id=$categoria->id;
|
$id=$categoria->id;
|
||||||
$ncategoria=$categoria->cat_name;
|
$ncategoria=$categoria->cat_name;
|
||||||
@ -298,6 +290,34 @@ class MovimentiController extends Controller
|
|||||||
|
|
||||||
$row[]=array_combine($intestazione,array_merge(array($ncategoria),$coll));
|
$row[]=array_combine($intestazione,array_merge(array($ncategoria),$coll));
|
||||||
unset($coll);
|
unset($coll);
|
||||||
|
}*/
|
||||||
|
foreach ($categorie as $categoria)
|
||||||
|
{
|
||||||
|
$id=$categoria->id;
|
||||||
|
$ncategoria=$categoria->cat_name;
|
||||||
|
for ($i=1;$i<=12;$i++)
|
||||||
|
{
|
||||||
|
$importo_dare = DB::table('movimentis')
|
||||||
|
->whereMonth('mov_data', '=', $i)
|
||||||
|
->whereYear('mov_data', '=', $anno)
|
||||||
|
->where('mov_fk_categoria', '=', $id)
|
||||||
|
->sum('mov_importo_dare');
|
||||||
|
|
||||||
|
$importo_avere = DB::table('movimentis')
|
||||||
|
->whereMonth('mov_data', '=', $i)
|
||||||
|
->whereYear('mov_data', '=', $anno)
|
||||||
|
->where('mov_fk_categoria', '=', $id)
|
||||||
|
->sum('mov_importo_avere');
|
||||||
|
|
||||||
|
$movrow = $importo_avere - $importo_dare;
|
||||||
|
|
||||||
|
$coll[]=$movrow;
|
||||||
|
$collx[]=$movrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
$totale[]=array_sum($collx);
|
||||||
|
$row[]=array_combine($intestazione,array_merge(array($ncategoria),$collx));
|
||||||
|
unset($collx);
|
||||||
}
|
}
|
||||||
return (new FastExcel($row))->download('report_al_'.date('d-m-Y').'.xls');
|
return (new FastExcel($row))->download('report_al_'.date('d-m-Y').'.xls');
|
||||||
}
|
}
|
||||||
@ -330,7 +350,7 @@ class MovimentiController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function importEC_ING(Request $request)
|
/* public function importEC_ING(Request $request)
|
||||||
{
|
{
|
||||||
if ($request->hasFile('filename'))
|
if ($request->hasFile('filename'))
|
||||||
{
|
{
|
||||||
@ -343,9 +363,9 @@ class MovimentiController extends Controller
|
|||||||
return 'Nessun File trovato';
|
return 'Nessun File trovato';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public function importEC_CR(Request $request)
|
/* public function importEC_CR(Request $request)
|
||||||
{
|
{
|
||||||
if ($request->hasFile('filename'))
|
if ($request->hasFile('filename'))
|
||||||
{
|
{
|
||||||
@ -358,7 +378,7 @@ class MovimentiController extends Controller
|
|||||||
return 'Nessun File trovato';
|
return 'Nessun File trovato';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public function importGenericCsv(Request $request)
|
public function importGenericCsv(Request $request)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user