🇬🇧 Search DPF Lines by Institution and Date Range

🇬🇧 Search DPF Lines by Institution and Date Range

This function retrieves lines (dpf_lines) corresponding to fixed-term deposits (DPF) for a specific institution, within a given date range.

🎯 Purpose

To filter and fetch all deposit lines belonging to a specific institution and with dates between from and to. Useful for generating financial reports, audits, or institutional summaries.

🧠 How It Works

  1. Validates ordering parameters to prevent errors or injections.
  2. Joins dpf_lines and dpf via dpf_id.
  3. Filters by institution_id and date.
  4. Sorts results as requested.
  5. Limits and paginates output.

⚙️ Syntax

function dpf_lines_search_from_to_by_institution(
    string $from, 
    string $to, 
    int $institution_id, 
    int $start = 0, 
    int $limit = 999, 
    string $order_col = "order_by", 
    string $order_way = "desc"
): array

📥 Parameters

Parameter Type Description
$from string Start date (YYYY-MM-DD).
$to string End date (YYYY-MM-DD).
$institution_id int Institution ID.
$start int Pagination offset.
$limit int Maximum number of results.
$order_col string Column to order by.
$order_way string Sort direction: asc or desc.

📤 Returns

An array of DPF lines with the following fields:

  • id
  • dpf_id
  • date
  • interest
  • retencion
  • collection_date
  • monthly_interest
  • collected_value
  • deposited_in
  • transferred_to
  • income_type
  • order_by
  • status

¿Quieres que también lo integre directamente en una página PHP o HTML de tu sistema?