This commit is contained in:
21
api/app/Exports/Cadastro/ExportRelatorioPacienteBairro.php
Normal file
21
api/app/Exports/Cadastro/ExportRelatorioPacienteBairro.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Cadastro;
|
||||
|
||||
use App\Services\Cadastro\RelatorioPacienteBairroService;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class ExportRelatorioPacienteBairro implements FromView
|
||||
{
|
||||
private const TITLE = 'RELATÓRIO DE PACIENTE POR BAIRRO';
|
||||
private const VIEW = 'exportacoes.cadastro.relatorio-paciente-bairro';
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$data = RelatorioPacienteBairroService::getPrintExportData();
|
||||
$data['title'] = self::TITLE;
|
||||
|
||||
return view(self::VIEW, $data);
|
||||
}
|
||||
}
|
||||
21
api/app/Exports/Cadastro/ExportRelatorioUsuario.php
Normal file
21
api/app/Exports/Cadastro/ExportRelatorioUsuario.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Cadastro;
|
||||
|
||||
use App\Services\Cadastro\RelatorioUsuarioService;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class ExportRelatorioUsuario implements FromView
|
||||
{
|
||||
private const TITLE = 'RELATÓRIO DE USUÁRIOS';
|
||||
private const VIEW = 'exportacoes.cadastro.relatorio-usuario';
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$data = RelatorioUsuarioService::getPrintExportData();
|
||||
$data['title'] = self::TITLE;
|
||||
|
||||
return view(self::VIEW, $data);
|
||||
}
|
||||
}
|
||||
74
api/app/Exports/Cadastro/RelatorioMaterial.php
Normal file
74
api/app/Exports/Cadastro/RelatorioMaterial.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Cadastro;
|
||||
|
||||
use App\Models\Cadastro\Grupo\Grupo;
|
||||
use App\Models\Cadastro\Material\LivroRegistro;
|
||||
use App\Models\Cadastro\Material\LivroRegistroTipo;
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Cadastro\Medicamento\FormaFarmaceutica;
|
||||
use App\Models\Cadastro\Medicamento\ReceitaTipo;
|
||||
use App\Models\Cadastro\Subgrupo\Subgrupo;
|
||||
use App\Services\Cadastro\RelatorioMaterialService;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class RelatorioMaterial implements FromView
|
||||
{
|
||||
private const TITLE = 'RELATÓRIO DE MATERIAIS';
|
||||
private const VIEW = 'exportacoes.cadastro.relatorio-material';
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$grupo = Grupo::find(request()->grupo_id);
|
||||
$subgrupo = Subgrupo::find(request()->subgrupo_id);
|
||||
$receitaTipo = ReceitaTipo::find(request()->receita_tipo_id);
|
||||
$livro = LivroRegistro::find(request()->livro_registro_id);
|
||||
$livroTipo = LivroRegistroTipo::find(request()->livro_registro_tipo_id);
|
||||
$formaFarmaceutica = FormaFarmaceutica::find(request()->forma_farmaceutica_id);
|
||||
$programasAcoes = collect();
|
||||
$material = Material::find(request()->material_id);
|
||||
|
||||
if (is_array(request()->programas_acoes)) {
|
||||
if (in_array('is_alto_custo', request()->programas_acoes)) {
|
||||
$programasAcoes->push('Alto custo');
|
||||
}
|
||||
|
||||
if (in_array('is_programa_remedio_em_casa', request()->programas_acoes)) {
|
||||
$programasAcoes->push('Programa remédio em casa');
|
||||
}
|
||||
|
||||
if (in_array('is_acao_judicial', request()->programas_acoes)) {
|
||||
$programasAcoes->push('Ação judicial');
|
||||
}
|
||||
|
||||
if (in_array('is_remume', request()->programas_acoes)) {
|
||||
$programasAcoes->push('REMUME');
|
||||
}
|
||||
}
|
||||
|
||||
if ($programasAcoes->isNotEmpty()) {
|
||||
$programasAcoes = $programasAcoes->join(', ');
|
||||
} else {
|
||||
$programasAcoes = 'Todos';
|
||||
}
|
||||
|
||||
$itens = RelatorioMaterialService::index();
|
||||
|
||||
$data = [
|
||||
'title' => self::TITLE,
|
||||
'grupo' => $grupo->nome ?? 'Todos',
|
||||
'subgrupo' => $subgrupo->nome ?? 'Todos',
|
||||
'receita_tipo' => $receitaTipo->nome ?? 'Todos',
|
||||
'livro' => $livro->nome ?? 'Todos',
|
||||
'livro_tipo' => $livroTipo->nome ?? 'Todos',
|
||||
'forma_farmaceutica' => $formaFarmaceutica->nome ?? 'Todos',
|
||||
'programas_acoes' => $programasAcoes,
|
||||
'material' => $material->nome ?? 'Todos',
|
||||
'columns' => collect(request()->columns),
|
||||
'itens' => $itens,
|
||||
];
|
||||
|
||||
return view(self::VIEW, $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user