Compliance Documents
A register for your factory's Philippine regulatory permits, licenses, and certificates — record each document's number, issuing agency, and expiry, then get warned before anything lapses so you can renew on time.
production/ComplianceDocs). It is gated by the
manufacturing_compliance permission and requires the manufacturing
module to be enabled. See Getting Started to switch the
module on and Permissions & Roles for the access matrix.
What the register is for
Every manufacturer holds a stack of government permits and certificates — a DTI business-name registration, a BIR permit, DOLE compliance certificates, an FDA license for regulated products, a DENR environmental permit, ISO or GMP certificates, and more. Each one has a number, an issuing agency, an issue date, and — usually — an expiry date. When one lapses unnoticed, production can be halted or fined. The Compliance Documents register is where you keep all of them in one place and let ERPat colour-code and count the ones that are about to expire.
Philippine regulatory context
The seven document types map onto the agencies a Philippine SME manufacturer typically answers to. The register is deliberately agency-agnostic — you can record any permit under Other — but the built-in types cover the common cases:
| Agency | What it regulates | Typical document type here |
|---|---|---|
| DTI — Dept. of Trade and Industry | Business-name registration. | DTI Registration |
| BIR — Bureau of Internal Revenue | Tax registration / permits (the tax authority). | BIR Permit |
| DOLE — Dept. of Labor and Employment | Labour standards & occupational safety-and-health compliance certificates. | DOLE Certificate |
| FDA — Food and Drug Administration | Licenses for regulated food, drug, and cosmetic products (e.g. LTO / CPR). | FDA License |
| DENR — Dept. of Environment and Natural Resources | Environmental permits (e.g. ECC, pollution permits). | DENR Permit |
| ISO / certifying bodies | International management-system certification (quality, environment, etc.). | ISO Certificate |
| Any other body | Anything not covered above (local LGU permits, industry bodies…). | Other |
The screens
The feature is four connected pages, all reached from the main list:
production/ComplianceDocs — the landing page. A DataTable of
every document with Type and Status filters, a New Document button, and an
Expiring Soon shortcut.
production/ComplianceDocs/modal_form — the popup form used for
both creating and editing. Posts to …/save.
production/ComplianceDocs/expiring — a focused report of
active documents due within a window (default 30 days, override with
?days=N).
production/ComplianceDocs/view/{id} — read-only detail plus an
audit trail. Reached only by clicking a document number on the Expiring page.
List columns & filters
The main list is an appTable DataTable (#compliance-table) with these columns:
| Column | Shows | Notes |
|---|---|---|
| Document # | The permit/license number. | Colour-coded by expiry (see Expiry tracking). Shows - if empty. |
| Type | The document type label. | One of the seven types. |
| Issuing Agency | The body that issued it. | Free text as entered. |
| Issue Date | When it was issued. | |
| Expiry Date | When it lapses. | Shows No expiry / N/A when blank; drives all warnings. |
| Status | The manual lifecycle label. | Colour badge — see the status legend. |
| Responsible | The accountable person's name. | Shows - when unset (there is no field to set it in the form — see the gotcha below). |
| Actions | Per-row gear (cogs) menu. | Contains Edit and Delete. |
Two dropdown filters sit above the table:
| Filter | Options | Effect |
|---|---|---|
Type (w150) | – Type –, DTI Registration, BIR Permit, DOLE Certificate, FDA License, DENR Permit, ISO Certificate, Other | Re-queries the list, narrowing by document type. |
Status (w150) | – Status –, Active, Expired, Pending Renewal, Suspended | Re-queries the list, narrowing by status. Rows are sorted by expiry date, soonest first. |
The form fields
The New / Edit modal is the same form for both create and edit; on edit it opens pre-filled
via the row's data-post-id. Every field it exposes is listed below, followed by the
fields the record carries that the form does not let you set.
Fields you fill in
| Field | Meaning | Required | Notes |
|---|---|---|---|
document_type — Type |
Kind of regulatory document: DTI Registration, BIR Permit, DOLE Certificate, FDA License, DENR Permit, ISO Certificate, or Other. | Required | Select2 dropdown. Defaults to DTI Registration on a new form. |
document_number — Document # |
The permit/license/certificate number exactly as printed on the document. | Required | Free text, max 100 chars. Enforced client-side (data-rule-required) and server-side. |
issuing_agency — Issuing Agency |
The government body or certifier that issued it (e.g. DTI, BIR, FDA). | Required | Free text, max 200 chars. Client + server required. |
issue_date — Issue Date |
Date the document was issued. | Required | HTML date picker (YYYY-MM-DD). |
expiry_date — Expiry Date |
Date the document lapses. Drives every expiry warning and the Expiring Soon report. | Optional | Date picker. If blank, the record shows No expiry / N/A, is saved as null, and never appears in Expiring Soon. |
alert_days_before_expiry — Alert Days Before Expiry |
Your intended renewal lead time — how many days before expiry the document should be flagged. | Optional | Number input, defaults to 30. Stored and shown on the detail Audit Trail only — see the warning under Expiry tracking. |
status — Status |
Current lifecycle label: Active, Pending Renewal, Expired, or Suspended. | Optional | Select2 dropdown, defaults to Active. Set by you; never changed automatically. |
file_path — File Path |
A path or reference to the stored scan of the document. | Optional | Free text, max 500 chars. Not an upload control — type or paste a reference. Shown on the detail view only if set. |
notes — Notes |
Free-form remarks about the document. | Optional | Textarea (2 rows). Rendered with line breaks on the detail view. |
Fields on the record you can't set from the form
A few columns exist on the record but have no input in the modal. The controller would save
them if they were posted, but because the form never posts them they stay null unless
populated by other means. The rest are set automatically by the system.
| Field | Meaning | Required | Notes |
|---|---|---|---|
responsible_person — Responsible Person |
The user accountable for maintaining/renewing this document; joined to users to show a name. |
Optional | Displayed in the Responsible column, on the Expiring page, and on the detail view — but no input exists in the modal, so it shows - / N/A in practice. |
product_id — (Product) |
Optional link to a specific product this document applies to; null means it applies to the whole facility. |
Optional | Filterable in the model, but no input exists in the modal, so it stays null. |
days_until_expiry — Days Until Expiry |
Computed count of days from today to the expiry date (negative once expired). | Computed | Read-only; shown on the detail view's Audit Trail. |
uuid — (system) |
Unique identifier auto-generated on create. | System | Set once via UUID v4; not editable. |
created_by — Created By |
The user who created the record. | System | Set to the logged-in user on create; shown as a name on the Audit Trail. |
created_at — Created At |
When the record was created (UTC). | System | Set on create; shown on the Audit Trail. |
updated_at — (system) |
Timestamp of the last update (UTC). | System | Set on every save. |
Document status — pipeline & legend
Every document carries a Status label that you set by hand. There are no automatic transitions — the system never flips a document from Active to Expired for you. All four statuses can move to any other status by editing the record; the lifecycle below shows the typical renewal flow.
Expiry tracking — the colour thresholds
Separately from the manual status, ERPat colours each document by how close its expiry date is. These colours are computed from the date itself, on a set of fixed thresholds, and update automatically. They appear on the list, the detail view, and the Expiring page.
(N days).(N days).(EXPIRED), regardless of the status field.On the detail view, the expiry date carries its own badge:
?days parameter. There is no e-mail
or cron notification wired to this field — treat the register as something you check, not
something that pings you.
The "Expiring Soon" view
The dedicated Expiring Compliance Documents page (production/ComplianceDocs/expiring)
is the working screen for renewals. It lists active documents whose expiry falls within a
window — 30 days by default, overridable by adding ?days=N to the URL (e.g.
?days=90 for a quarter-ahead view). Rows are sorted soonest-first and highlighted by
urgency.
| Column | Shows | Notes |
|---|---|---|
| Document # | The number. | A link — the only in-UI link to the detail view. |
| Type | The document type. | |
| Expiry Date | When it lapses. | |
| Days Left | A coloured badge counting down. | See the badge legend below. |
| Issuing Agency | The issuing body. | |
| Responsible | Accountable person. | Shows - when unset. |
| Status | The status label. | Always Active here (only Active documents appear). |
| Actions | An edit icon. | Opens the same edit modal as the list. |
The page opens with a banner and highlights rows:
The Days Left badge itself is colour-coded:
?days=90, the page
filters correctly on 90 days, but the empty/summary banner text still says
"…within the next 30 days." — trust the rows, not the sentence.
SOP — Register a permit and monitor its expiry
manufacturing_compliance access and the physical or
scanned document in hand.
Step 1 — Onboard the document
-
Open the register
Go to Manufacturing → Compliance Documents (
production/ComplianceDocs). -
Start a new record
Click New Document. The blank create modal opens. Nothing is saved until you click Save.
-
Choose the type and enter the identity
Set Type (e.g. FDA License), then enter the exact Document # and the Issuing Agency (e.g. FDA). All three are required.
-
Enter the dates
Pick the Issue Date (required). Enter the Expiry Date whenever the document expires — without it, the document can never be tracked or appear in Expiring Soon.
-
Set your renewal lead time and status
Adjust Alert Days Before Expiry to your renewal lead time (default 30). Leave Status = Active for a valid document.
-
Add references (optional)
Record the File Path of the stored scan and any Notes.
-
Save and verify
Click Save and confirm the record appears in the list.
document_type, document_number,
issuing_agency, and issue_date as required. On a new record it also
generates the uuid and sets created_by / created_at; every
save updates updated_at. A blank Expiry Date is saved as null.
Success shows "Record saved successfully"; a failure shows "An error occurred".
Step 2 — Monitor and renew (weekly)
-
Open the watch-list
From the list, click Expiring Soon (or open
production/ComplianceDocs/expiring). For a longer horizon add?days=90to the URL. -
Triage by colour
If the green "No documents expiring" banner shows, you are done. Otherwise work the red rows first (expired or ≤ 7 days left), then the yellow rows.
-
Open the document
Click the Document # link to open its read-only detail view, or click the edit icon in the Actions column.
-
Start the renewal
Begin the renewal with the issuing agency. Edit the document and set Status = Pending Renewal while it is in progress, then Save.
-
Close the loop
Once renewed, edit again: update the Issue Date and Expiry Date and set Status back to Active. For a permanently lapsed document, set Status = Expired (or Suspended if the agency suspended it).
Auditing a document's history
-
Reach the detail view
Open the Expiring Soon page and click the document number (the only in-UI link to the detail view), or navigate directly to
production/ComplianceDocs/view/{id}. -
Read the two panels
The Document Details panel shows the number, type, responsible person, agency, dates, the expiry badge, status, file path, and notes. The Audit Trail panel shows Created By, Created At, Alert Days Before Expiry, and Days Until Expiry.
-
Correct if needed
Click Edit to open the modal and fix any details.
view/{id} with a missing or unknown id returns a 404 (Not Found) —
the detail view exists only for records that are present and not deleted.
Actions & confirmations
What each button does, and when you are asked to confirm:
| Action | Effect | Confirm? |
|---|---|---|
| New Document | Opens the blank create modal. No data change until Save. | None |
| Save | Posts the form, validates the required fields, persists the record, and inserts/updates the row in the list. | None |
| Edit (row gear) | Opens the modal pre-filled with the selected document; saving overwrites it. | None |
| Delete (row gear) | Soft-deletes the document (sets deleted = 1). It vanishes from every list and from the Expiring report. | Yes — standard delete-confirmation dialog. |
| Expiring Soon | Navigates to the Expiring report (read-only). | None |
| Document # link (Expiring page) | Opens the read-only detail view; 404 if not found. | None |
| Back / All Documents | Returns to the main list. No data change. | None |
| Close (modal) | Dismisses the modal without saving. | None |
| Type / Status filters | Re-query the list to narrow it. View-only. | None |
Validation & messages
The messages you may see, and what triggers them:
| When | Message |
|---|---|
| Saving with a missing required field (Type, Document #, Issuing Agency, or Issue Date) | The field is rejected server-side; Document # and Issuing Agency also flag client-side. |
| Save succeeds | "Record saved successfully." |
| Save fails | "An error occurred." |
| Delete succeeds | "Record deleted." |
| Delete fails | "Record cannot be deleted." |
| Expiring page — nothing due | "No documents expiring within the next 30 days." |
| Expiring page — items due | "N document(s) expiring within 30 days." |
Opening view/{id} with a bad/unknown id | Returns a 404 page. |
Permissions
The whole controller is gated by a single permission. Finer-grained keys exist in configuration but are not separately enforced.
| Permission | Gates | Enforced? |
|---|---|---|
manufacturing_compliance | The entire ComplianceDocs controller — list, create, edit, delete, expiring, and view. Also requires the manufacturing module to be enabled. | Yes — in the constructor. |
manufacturing_compliance_create | Labelled "Create Compliance Document". | Defined, not checked — creation is gated only by manufacturing_compliance. |
manufacturing_compliance_update | Labelled "Update Compliance Document". | Defined, not checked |
manufacturing_compliance_delete | Labelled "Delete Compliance Document". | Defined, not checked |
manufacturing_compliance can create, edit, and delete
documents. If you need to restrict who can change the register, restrict who holds that single
permission. See Permissions & Roles.
How it connects
Compliance Documents is deliberately standalone within the module:
| Area | Relationship |
|---|---|
| Inventory | None. This feature does not read or write items, variants, or stock. The product_id column can tag a document to a product but is not populated from the UI. |
| Users | Read-only join to resolve names for Created By and Responsible Person. |
| Manufacturing module | Co-created with the other manufacturing tables and surfaced in the Manufacturing left menu. Independent of BOMs, Work Orders, and Manufacturing Orders. |
Watch-outs
?days), and no e-mail or cron notification is wired to it.production/ComplianceDocs/view/{id} directly.null (showing - / N/A) even though the columns and labels appear across the UI.?days=90 filters on 90 days, but the empty/summary banner wording is hard-coded to 30. Read the rows, not the sentence.deleted = 1; the record is hidden everywhere in the UI but remains in the database.