Skip to content

Routing Overdue Summary

Jadestone only. Report code routing_01_summary, added by INA27-296 (Done). Opens the routing module with show=report&print=due_summary; routing_handler_print.php includes routing_handler_print_due_summary.php, 321 lines, on $pdo. One row per PIC and discipline with two counts: routings that are overdue, and routings that fall due today. It is the recap of Routing Overdue, which lists every routing; that report is unchanged.

How this page was verified

Traced in ina-jadestone on 2026-09-08. Screenshots from inact-jadestone.eris.place on the production snapshot of 2026-09-07, project AAL-VS, Route Status Open. Master and the other forks do not have this report.

The filter form

Routing Overdue Summary, the filter form: Project, Show Only Latest Revision, Route Status
Routing Overdue Summary, the filter form: Project, Show Only Latest Revision, Route Status · click to enlarge

view=custom renders routing_print_due_summary_custom.htm. No template, no record grouping, no column picker: the output has fixed columns.

ControlFieldEffect
Projectprojectthe user's projects, from getProjectPersonByResource()
Show Only Latest Revisiononly_latest_revkeeps one routing per document number: the one with the highest rout_id among the main files (rout_type = 1)
Route Statusrout_statusopen (default), close, or all: ts_routing.rout_status
Preview, Download Exceldue_summary_download_asHTML in a new tab, or an .xlsx built inline with PhpSpreadsheet; the routing module's excel/export_excel.php is not used

The query

One query over ts_routing joined to ts_map_routing_to, ts_resource and ts_org_person, for the project's sent routings (rout_have_send = 1) and only the recipient rows whose Action Indicated is Responsible (rout_indicate = 16) or Approval (9). Draft routings are never counted, even when their recipients already have due dates. The query also returns rout_day, the due date minus today:

Driverrout_day
MySQLDATEDIFF(rt.rout_due_date, NOW())
PostgreSQLrt.rout_due_date - CURRENT_DATE
SQL ServerDATEDIFF(DAY, GETDATE(), rt.rout_due_date)

All three read the same way: negative is late, zero is due today, positive is still in time. Then three lookups for the discipline: the project's disciplines, the MDR (dm_docmaster_number to dm_discipline_identifier), and the routing files (ts_map_routing_file) of the routings found.

The rows

Routing Overdue Summary on project AAL-VS, Route Status Open: one row per PIC and discipline, with a Total row
Routing Overdue Summary on project AAL-VS, Route Status Open: one row per PIC and discipline, with a Total row · click to enlarge

PIC

One PIC per routing. The first recipient row with Responsible wins; a routing without a Responsible falls back to its first Approval row by map_id. A routing with neither is not counted for anyone. The label is person_name from ts_org_person, or resource_name (No user) when the resource has no person behind it.

Discipline

The document's discipline name, looked up in this order from the routing's first file (rout_type, then map_id): the MDR row's dm_discipline_identifier mapped to docdisc_name; else the file's docdisc_id; else the raw MDR code; else -.

The two counts

A routing is counted only while the PIC still has it pending: rout_status_resp = 'N' on that recipient row. Then:

ColumnRule
Overduerout_day < 0
Will be overdue by todayrout_day = 0
not countedrout_day > 0, still in time

Rows are keyed by PIC and discipline, sorted by PIC then discipline (case-insensitive), and the Total row sums both columns. Because the unit is a routing, a document with two open routings counts twice, once per routing, and the same PIC can appear on several discipline rows.

Known issues

  • Counts routings, not documents. The ticket asked for distinct documents; the code counts one PIC row per rout_id, which is distinct per routing. Two routings of the same document both count.
  • Route Status Close still applies the pending gate. A closed routing rarely has a recipient with rout_status_resp = 'N', so close usually prints an empty table.
  • The discipline fallback prints - for a document outside the MDR whose routing file has no docdisc_id.
  • Routing Overdue: the per-routing list this one summarises, including the Jadestone-only Issued Status column (INA27-299).
  • DMS reports.