Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/corpentunida-org/corpen/llms.txt

Use this file to discover all available pages before exploring further.

The Exequial Services module manages the full lifecycle of funeral plan membership for cooperative members. It covers enrollment of titulars (plan holders) and their beneficiaries, real-time service delivery records when a death occurs, statistical dashboards, and PDF/Excel exports. All routes are prefixed under /exequiales and guarded by the auth middleware.

Route Reference

MethodPathRoute NameControllerDescription
GET/exequiales/asociadosexequial.asociados.indexComaeExCliController@indexList of exequial members
GET/exequiales/asociados/createexequial.asociados.createComaeExCliController@createNew member form
POST/exequiales/asociadosexequial.asociados.storeComaeExCliController@storeEnrol a new member
GET/exequiales/asociados/{id}exequial.asociados.showComaeExCliController@showMember profile with beneficiaries
GET/exequiales/asociados/{id}/editexequial.asociados.editComaeExCliController@editEdit member form
PUT/PATCH/exequiales/asociados/{id}exequial.asociados.updateComaeExCliController@updateUpdate member record
GET/exequiales/asociados/{id}/generarpdf/{active}asociados.generarpdfComaeExCliController@generarpdfDownload member PDF report
GET/exequiales/prestarServicioexequial.prestarServicio.indexMaeC_ExSerController@indexList of service delivery records
GET/exequiales/prestarServicio/dashboardexequial.prestarServicio.dashboardMaeC_ExSerController@dashboardService statistics dashboard
GET/exequiales/prestarServicio/excelprestarServicio.generate.excelMaeC_ExSerController@generarExcelPrestarServicioExport services to Excel
GET/exequiales/prestarServicio/generarpdfprestarServicio.generarpdfMaeC_ExSerController@generarpdfDownload all services PDF
POST/exequiales/prestarServicioexequial.prestarServicio.storeMaeC_ExSerController@storeRegister a new service delivery
GET/exequiales/prestarServicio/{id}exequial.prestarServicio.showMaeC_ExSerController@editView service record
PUT/PATCH/exequiales/prestarServicio/{id}exequial.prestarServicio.updateMaeC_ExSerController@updateUpdate service record
GET/exequiales/prestarServicio/{id}/generarpdfprestarServicio.repIndividualMaeC_ExSerController@reporteIndividualIndividual service PDF
POST/exequiales/prestarServicio/{id}/comentarioprestarServicio.comentario.storeMaeC_ExSerController@addCommentAdd a comment to a service record
GET/exequiales/beneficiarios/createexequial.beneficiarios.createComaeExRelParController@createNew beneficiary form
POST/exequiales/beneficiariosexequial.beneficiarios.storeComaeExRelParController@storeAdd a beneficiary
GET/exequiales/beneficiarios/{id}/editexequial.beneficiarios.editComaeExRelParController@editEdit beneficiary form
PUT/PATCH/exequiales/beneficiarios/{id}exequial.beneficiarios.updateComaeExRelParController@updateUpdate beneficiary
DELETE/exequiales/beneficiarios/{id}exequial.beneficiarios.destroyComaeExRelParController@destroyRemove beneficiary
GET/POST/exequiales/tercerosexequial.terceros.*ComaeTerControllerThird-party person records (CRUD)
GET/exequiales/parentescosallexequial.parentescosallParentescosController@indexList all relationship types
GET/exequiales/plansallexequial.plansallPlanController@indexList all funeral plans

Data Models

Stored in table EXE_CoMae_ExCli. Each row represents one active plan holder.
ColumnTypeNotes
cod_clibigint (PK)Member’s national ID (cédula)
cod_planstring(5)Funeral plan code
fec_ingdateEnrolment date
fec_inidatePlan start date
cod_ccostring(10)Cost centre code (e.g., C1010)
por_desctostring(5)Discount percentage
estadobooleantrue = active plan holder
beneftextObservations / beneficiary notes
contratostring(5)Contract reference

Enrolling a New Exequial Member

1

Open the enrolment form

Navigate to GET /exequiales/asociados/create. The form loads the list of available funeral plans from PlanController@index. You need the member’s cédula (national ID) ready before proceeding.
2

Validate the member exists in the directory

Before submitting, the form calls GET /exequiales/asociados which triggers an AJAX call to the standalone validarRegistro endpoint. It checks:
  • ComaeExCli (local table) — returns 1 if the cédula already has a record in the local exequial table.
  • ComaeTer (third-parties table) — returns 2 if the person is in the directory but not yet enrolled locally.
  • Returns 0 if the cédula is not found anywhere.
If the cédula is not yet enrolled (0 or 2), proceed to store.
3

Submit the enrolment

POST /exequiales/asociados sends the following payload to the production API at POST /api/Exequiales/Tercero:
[
    'documentId'     => $request->documentId,
    'obsevations'    => $request->observaciones,
    'dateStart'      => Carbon::now(),
    'descuento'      => $request->discount,
    'codePlan'       => $request->plan,
    'codeCenterCost' => 'C1010',
]
Simultaneously, the controller creates a local record in EXE_CoMae_ExCli:
ComaeExCli::create([
    'cod_cli'    => $request->documentId,
    'cod_plan'   => $request->plan,
    'fec_ing'    => Carbon::now(),
    'cod_cco'    => 'C1010',
    'estado'     => true,
    'fec_ini'    => Carbon::now(),
    'por_descto' => $request->discount,
]);
On API success, the user is redirected to the member’s show page and the action is recorded in the Auditoría log as add titular {documentId}.

Delivering a Funeral Service

1

Open the service registration form

From the member’s show page, click Prestar Servicio to reach POST /exequiales/prestarServicio. The form requires identifying whether the deceased is the titular (plan holder) or a beneficiary.
2

Identify the deceased

  • If the titular died (pastor === 'true'): the controller sends a PATCH to /api/Exequiales/Tercero setting stade: false and the observation 'PASTOR FALLECIDO', then updates EXE_CoMae_ExCli to set estado = false.
  • If a beneficiary died: the controller sends a PUT to /api/Exequiales/Beneficiary with type: 'I' (inactive), and updates EXE_CoMae_ExRelPar to set estado = false, tipo = 'I'.
3

Complete and save the service record

On API success, ExMonitoria::create() persists the full record to EXE_MAEC_EXSER with all death details, contact information, municipality, and the initial estado = 1 (pending). The action is logged in Auditoría as prestar servicio a {cedulaFallecido}.
4

Track and update the service

Navigate to GET /exequiales/prestarServicio/{id} to edit the service record. You can update:
  • horaFallecimiento, fechaFallecimiento, lugarFallecimiento
  • Contact information (contacto, telefonoContacto, Contacto2, telefonoContacto2)
  • municipio (linked to MaeMunicipios)
Add timeline notes via POST /exequiales/prestarServicio/{id}/comentario, which saves to ExServicioComentarios with a tipo and observacion.

Adding a Beneficiary

To add a dependent to an existing plan holder’s record:
  1. From the member’s show page, click Agregar Beneficiario.
  2. The create form loads available parentescos from ParentescosController@index.
  3. POST /exequiales/beneficiarios sends a POST request to /api/Exequiales/Beneficiary and simultaneously creates a ComaeExRelPar record with tipo = 'A' (active).
  4. On success, the action is logged as add beneficiario {documentid}.

PDF Generation

Corpen uses Barryvdh DomPDF for all PDF output in this module:
EndpointDescriptionPaper
GET /exequiales/asociados/{id}/generarpdf/trueMember certificate with plan and beneficiaries (active format)Letter, landscape
GET /exequiales/asociados/{id}/generarpdf/falseAlternate member report templateLetter, landscape
GET /exequiales/prestarServicio/generarpdfFull services report (all records)Letter, landscape
GET /exequiales/prestarServicio/{id}/generarpdfIndividual service delivery reportLetter, landscape
The active path parameter in generarpdf/{active} is evaluated with filter_var($active, FILTER_VALIDATE_BOOLEAN). Passing true uses the view exequial.asociados.showpdf; passing false uses exequial.asociados.showpdf2. Each PDF request fetches data from the production API using a Bearer token from env('TOKEN_ADMIN') and env('API_PRODUCCION'), combining titular details, beneficiary list, and pastor personal data into a single printable document.

Excel Export (Service Deliveries)

GET /exequiales/prestarServicio/excel exports all ExMonitoria records via Maatwebsite Excel using the ExcelExport class. The generated file is named {timestamp}Prestar_Servicio.xlsx and contains the following columns:
#ColumnSource
1Row index
2Fecha FallecimientofechaFallecimiento
3DíaCarbon::translatedFormat('l') (Spanish weekday)
4HorahoraFallecimiento
5Cédula TitularcedulaTitular
6Nombre TitularnombreTitular
7Cédula FallecidocedulaFallecido
8Nombre FallecidonombreFallecido
9Lugar FallecimientolugarFallecimiento
10ParentescoResolved name via ParentescosController@showName
11Contactocontacto
12TeléfonotelefonoContacto
13EstadoPENDIENTE / EN PROCESO / CERRADO

Service Dashboard

The dashboard at GET /exequiales/prestarServicio/dashboard provides management-level KPIs sourced entirely from the database — no API call is required. It shows total services delivered, services grouped by district (joining EXE_MAEC_EXSER → MaeTerceros → MaeDistritos), the top 15 municipalities by service volume, total active beneficiaries (EXE_ExRelPar where tipo = 'A'), total active plan holders (EXE_ExCli where estado = 1), and an audit breakdown showing the percentage of add, update, delete, and service-delivery actions from the Auditoría log for the EXEQUIALES area.

Build docs developers (and LLMs) love