|
|
@@ -137,24 +137,24 @@ class RecordINOUT extends Component
|
|
|
$aChilds[] = $first_parent_id;
|
|
|
}
|
|
|
|
|
|
- $childs = \App\Models\Causal::where('parent_id', $id)->get();
|
|
|
+ $childs = \App\Models\Causal::where('parent_id', $id)->get();
|
|
|
foreach($childs as $child)
|
|
|
- {
|
|
|
+ {
|
|
|
$aChilds[] = $child->id;
|
|
|
- $childs2 = \App\Models\Causal::where('parent_id', $child->id)->get();
|
|
|
+ $childs2 = \App\Models\Causal::where('parent_id', $child->id)->get();
|
|
|
foreach($childs2 as $child2)
|
|
|
{
|
|
|
$aChilds[] = $child2->id;
|
|
|
- $childs3 = \App\Models\Causal::where('parent_id', $child2->id)->get();
|
|
|
+ $childs3 = \App\Models\Causal::where('parent_id', $child2->id)->get();
|
|
|
foreach($childs3 as $child3)
|
|
|
{
|
|
|
$aChilds[] = $child3->id;
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return $aChilds;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -422,13 +422,13 @@ class RecordINOUT extends Component
|
|
|
|
|
|
public function remove($idx)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
if (sizeof($this->datas) > 1)
|
|
|
array_splice($this->datas, $idx, 1);
|
|
|
//unset($this->datas[$idx]);
|
|
|
else
|
|
|
$this->datas = array();
|
|
|
-
|
|
|
+
|
|
|
$this->show('', '');
|
|
|
}
|
|
|
|
|
|
@@ -452,7 +452,7 @@ class RecordINOUT extends Component
|
|
|
$rows_in = $this->rows_in;
|
|
|
}
|
|
|
|
|
|
- $path = $this->generateExcel($this->columns, $rows_in, $this->records_in, $this->rows_out, $this->records_out);
|
|
|
+ $path = $this->generateExcel($this->columns, $rows_in, $this->records_in, $this->rows_out, $this->records_out,false);
|
|
|
|
|
|
return response()->download($path)->deleteFileAfterSend();
|
|
|
|
|
|
@@ -553,12 +553,12 @@ class RecordINOUT extends Component
|
|
|
|
|
|
}
|
|
|
|
|
|
- $path = $this->generateExcel($columns, $this->rows_in, $records_in, $this->rows_out, $records_out);
|
|
|
+ $path = $this->generateExcel($columns, $this->rows_in, $records_in, $this->rows_out, $records_out, true);
|
|
|
return response()->download($path)->deleteFileAfterSend();
|
|
|
|
|
|
}
|
|
|
|
|
|
- public function generateExcel($columns, $rows_in, $records_in, $rows_out, $records_out)
|
|
|
+ public function generateExcel($columns, $rows_in, $records_in, $rows_out, $records_out, $isYearExport)
|
|
|
{
|
|
|
$letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N');
|
|
|
|
|
|
@@ -572,7 +572,7 @@ class RecordINOUT extends Component
|
|
|
}
|
|
|
|
|
|
$activeWorksheet->getStyle('A1:N1')->getFont()->setBold(true);
|
|
|
- $activeWorksheet->getStyle('A1:N1')->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('00ff00');
|
|
|
+ $activeWorksheet->getStyle('A1:N1')->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('C6E0B4'); // Lighter green
|
|
|
|
|
|
$count = 2;
|
|
|
|
|
|
@@ -612,10 +612,11 @@ class RecordINOUT extends Component
|
|
|
{
|
|
|
$activeWorksheet->setCellValue($letters[$idx + 1] . $count, formatPrice($total));
|
|
|
$activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFont()->setBold(true);
|
|
|
- $activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('00ff00');
|
|
|
+ $activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('C6E0B4'); // Lighter green
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
$count += 2;
|
|
|
$activeWorksheet->setCellValue('A' . $count, "Uscite");
|
|
|
foreach($columns as $idx => $column)
|
|
|
@@ -624,7 +625,7 @@ class RecordINOUT extends Component
|
|
|
}
|
|
|
|
|
|
$activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFont()->setBold(true);
|
|
|
- $activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ff0000');
|
|
|
+ $activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('F8CBAD'); // Lighter red
|
|
|
|
|
|
$count += 1;
|
|
|
|
|
|
@@ -664,14 +665,20 @@ class RecordINOUT extends Component
|
|
|
{
|
|
|
$activeWorksheet->setCellValue($letters[$idx + 1] . $count, formatPrice($total));
|
|
|
$activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFont()->setBold(true);
|
|
|
- $activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ff0000');
|
|
|
+ $activeWorksheet->getStyle('A' . $count . ':N' . $count)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('F8CBAD'); // Lighter red
|
|
|
}
|
|
|
|
|
|
- foreach($letters as $l)
|
|
|
- $activeWorksheet->getColumnDimension($l)->setWidth(20);
|
|
|
+ $activeWorksheet->getColumnDimension('A')->setWidth(35);
|
|
|
+
|
|
|
+ for($i = 1; $i < count($letters); $i++) {
|
|
|
+ $activeWorksheet->getColumnDimension($letters[$i])->setWidth(20);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $fileSuffix = $isYearExport ? 'AnnoFiscale' : 'Selezione';
|
|
|
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
- $writer->save($path = storage_path('entrate_uscite_' . date("YmdHis") . '.xlsx'));
|
|
|
+ $writer->save($path = storage_path(date("Ymd") .'_Gestionale_' . $fileSuffix . '.xlsx'));
|
|
|
|
|
|
return $path;
|
|
|
|