Module: SRB Integration v1.0.0
What is SRB Integration?
Pakistan SRB Sindh Revenue Board POS integration for Perfex CRM (sandbox and production APIs).
This module installs into modules/srb_integration/ and adds its own admin menus, permissions, and database tables — without editing Perfex CRM core files.
Who should use this module?
- Admins — activate the module, configure Settings, assign roles, and manage integrations.
- Operators / day-to-day staff — create and update records (orders, attendance, shipments, messages, etc.).
- Managers / approvers — review queues, approve workflows, and monitor dashboards/KPIs.
- Finance / compliance / ops leads — run reports, exports, and audit trails when the module supports them.
What you can achieve
- Keep all related work in one place inside Perfex CRM instead of spreadsheets.
- Control who can view, create, edit, approve, or export with role permissions.
- Use dashboards and reports to see status, bottlenecks, and history.
- Connect to other CRM data (customers, invoices, items, staff) where the module integrates.
Recommended learning path
- Read How to Install and activate the module.
- Skim Features so you know what screens exist.
- Complete the Quick Start checklist on this page (Settings → masters → first sample record).
- Open each screen guide under Screen-by-screen guides when you need step-by-step help.
- Check Version & Changelog after upgrades for new options.
Tip: Train one admin first, then create a limited role for operators so they only see the screens they need.
5-minute Quick Start
Follow this short path the first time you use SRB Integration:
- Activate — Setup → Modules → activate SRB Integration (run Upgrade if prompted).
- Permissions — Setup → Staff → Roles → enable view/create/edit (and approve/settings if needed) for this module.
- Settings — Open SRB Integration → Settings and save company defaults, prefixes, and integrations.
- Master data — Create the first required masters (products, warehouses, templates, channels, accounts, routes, etc.).
- First transaction — Create one sample record end-to-end (save → submit/approve → complete) and confirm it appears in lists/reports.
- Cron — If the module uses alerts, sync, queues, or AI, confirm Perfex CRM cron is scheduled on the server.
Full how-to guide (from module package)
The steps below come from the module author's printable guide — follow them in order for best results.
SRB Integration for Perfex CRM — How to Use
Author: Nasbix Technologies | Version: 1.0.0
1. INSTALL
1. Upload the "srb_integration" folder into your Perfex CRM /modules/ directory
(FTP/SFTP or Setup → Modules → Upload Module).
- Go to Setup → Modules.
- Find "SRB Integration" and click Activate.
4. Assign staff permissions under Setup → Staff → Roles:
- view, send, settings, view_srb_report
2. CONFIGURE SETTINGS
1. Open Setup → Settings → Integrations → SRB Integration
(or SRB Integration → Settings in the sidebar).
- Set auto-submit (invoices / credit notes) if needed.
- Map custom fields: HS code, sale type, buyer SNTN.
- Enable retry queue, webhooks, and/or REST API as required.
3. API CREDENTIALS
- Open SRB Integration → API Settings.
- Choose Mode: Simulation (safe testing) or Live.
- Choose Environment: Sandbox or Production.
- Enter Seller SNTN, POS ID, and API key.
- Optionally override API URLs.
- Click "Test connection".
4. SEND AN INVOICE TO SRB
- Open any invoice preview in Perfex CRM.
- Use the SRB panel on the left → Send to SRB.
- On success, SRB invoice number + QR appear on PDF / client view.
5. CREDIT NOTES
- Submit the original invoice to SRB first.
- Create a credit note linked to that invoice.
- On credit note preview, click Send credit note to SRB.
6. BULK SUBMIT / REPORT / AUDIT
- Bulk Submit: SRB Integration → Bulk Submit
- Report: SRB Integration → SRB Report (CSV / PDF)
- Audit Log: SRB Integration → Audit Log
7. CRON (RETRIES & WEBHOOKS)
Ensure Perfex CRM cron is scheduled (e.g. every 5 minutes).
Retries and webhook delivery run on cron when enabled in settings.
8. UNINSTALL (CLEAN)
- Setup → Modules → Deactivate SRB Integration.
- Click Uninstall.
Removes tables: srb_settings, srb_invoices, srb_audit_log, srb_webhook_queue
and all srb_integration_* options + module files.
9. DOCUMENTATION
Open documentation/index.html inside this package for full docs.
Support: via CodeCanyon (6 months) — Nasbix Technologies — https://nasbix.com
Perfex CRM is sold separately and is not included with this item.
Setup & usage notes from README
Setup
- Activate module: Setup → Modules → SRB Integration
- Open Setup → Settings → Integrations → SRB Integration
- Configure auto-submit, field mapping, retry, webhooks, and REST API
- Open SRB Integration → API Settings (or click Open SRB API settings on the settings tab)
- Set mode, environment, seller SNTN, POS ID, API key (and optional custom URLs)
- Click Test connection
- Start in Simulation, then switch to Live
Module documentation index
Start here — full guides for SRB Integration:
- Overview & How to Use — what it is, who uses it, daily workflow
- Quick Start Guide — first 5 minutes + printable how-to
- How to Install — upload, activate, permissions, verify
- Features (Full Detail) — every capability explained
- FAQ & Tips — common questions and best practices
- Version & Changelog — version history
How to use in Perfex CRM (daily operations)
- Sign in to the admin area with a role that includes SRB Integration permissions.
- Open Srb Integration (sidebar) or search for SRB Integration in the admin menu.
- Start on the Dashboard (if available) to see open tasks, pending approvals, and KPIs.
- Review Settings after upgrades — new options may need defaults for your company.
- Create or import master data first; most modules block transactions until masters exist.
- Run the main business flow (create → submit → approve → post/complete) using the screens listed in Admin menu below.
- Use Reports / Analytics screens to reconcile stock, finance, compliance, or SLA metrics.
- For integrations (API, EDI, gateways, tax), confirm credentials in Settings and monitor logs or webhook delivery screens.
- Train staff with role-based access — give approvers approve permissions only, operators create/edit on their area.
- If something fails overnight, check Perfex CRM cron ran and open the module log / failed queue screen if present.
Admin menu — where to work
Open the SRB Integration section in the admin sidebar. Screens your staff may use (depending on role):
- API Settings
- Bulk Submit
- Settings
- SRB Audit Log
- SRB Report
Detailed guide — features, workflows, API & FAQ
Features
- Submit invoices to SRB (manual + auto-submit)
- Credit note submission with source invoice SRB reference
- Simulation mode for safe testing
- Encrypted API credentials at rest
- Custom field mapping (HS code, sale type, buyer SNTN)
- QR codes on invoice PDF / client view / public verify page
- SRB report (CSV / PDF export)
- Retry queue with exponential backoff (cron)
- Test connection button (validate endpoint)
- Audit log of submit / retry / test actions
- Bulk submit admin UI for unsent invoices
- Webhooks (HTTPS + HMAC) on submit success/failure
- External REST API for third-party integrations
- Configurable API URLs per environment
- Urdu + Arabic language packs
- SaaS multi-tenant hooks (
nasbix_saas)
Setup
- Activate module: Setup → Modules → SRB Integration
- Open Setup → Settings → Integrations → SRB Integration
- Configure auto-submit, field mapping, retry, webhooks, and REST API
- Open SRB Integration → API Settings (or click Open SRB API settings on the settings tab)
- Set mode, environment, seller SNTN, POS ID, API key (and optional custom URLs)
- Click Test connection
- Start in Simulation, then switch to Live
Admin navigation
| Menu item | Permission | URL |
|---|---|---|
| ----------- | ------------ | ----- |
| Settings | settings | admin/settings?group=srb_integration |
| API Settings | settings | admin/srb_integration |
| Bulk Submit | send | admin/srb_integration/srb/bulk_submit |
| SRB Report | view_srb_report | admin/srb_integration/srb/report |
| Audit Log | view_srb_report | admin/srb_integration/srb/audit_log |
Bulk submit
SRB Integration → Bulk Submit lists invoices not yet sent to SRB (excludes drafts). Select invoices and submit in batch (max 50 per request).
External REST API
Enable in settings and set an API key. Endpoints (site URL, not admin):
| Method | Path | Description |
|---|---|---|
| -------- | ------ | ------------- |
| GET | /srb_integration/srb_rest | Service info |
| GET | /srb_integration/srb_rest/invoice_status/{id} | SRB status for invoice |
| POST | /srb_integration/srb_rest/invoice_submit/{id} | Submit single invoice |
| POST | /srb_integration/srb_rest/bulk_submit | JSON body: {"invoice_ids":[1,2,3]} |
Authenticate: Authorization: Bearer {api_key} or ?api_key=
Webhooks
Configure an HTTPS URL and optional signing secret. Events: submit.success, submit.failed. Payload includes event, company_id, timestamp, and data (submission context). Header: X-SRB-Integration-Signature (HMAC-SHA256).
Field mapping
| Setting | Source |
|---|---|
| --------- | -------- |
| HS code slug | Line item CF → catalog product CF → default |
| Sale type slug | Same as HS code |
| Buyer SNTN slug | Customer VAT → customer CF → unregistered default |
Credit notes
- Submit original invoice to SRB first
- Create credit note with applied credit to that invoice
- Use Send credit note to SRB on credit note preview
Auto-submit for credit notes supports cron/system-created documents (same as invoices).
SaaS multi-tenant
When nasbix_saas is active, tenant isolation is enforced via filters on:
srb_integration_company_idsrb_integration_settings_company_idsrb_integration_send_company_idsrb_integration_send_credit_note_company_idsrb_integration_report_company_idsrb_integration_verify_company_idsrb_integration_invoice_panel_company_idsrb_integration_client_invoice_company_idsrb_integration_invoice_pdf_company_idsrb_integration_credit_note_panel_company_id
Hooks
| Hook | Type | Purpose |
|---|---|---|
| ------ | ------ | --------- |
srb_integration_company_id | filter | Default tenant ID |
srb_integration_settings_company_id | filter | Settings page tenant |
srb_integration_send_company_id | filter | Invoice submit tenant |
srb_integration_send_credit_note_company_id | filter | Credit note submit tenant |
srb_integration_report_company_id | filter | Report / export tenant |
srb_integration_verify_company_id | filter | Public verify page tenant |
srb_integration_send_payload | filter | Final payload before POST |
srb_integration_invoice_payload | filter | Invoice payload |
srb_integration_di_payload | filter | Raw DI payload builder |
srb_integration_credit_note_payload | filter | Credit note payload |
srb_integration_parse_response | filter | Parse API response |
srb_integration_di_post_url | filter | Override POST URL |
srb_integration_di_validate_url | filter | Override validate URL |
srb_integration_item_hs_code | filter | Line item HS code |
srb_integration_credit_note_source_srb_number | filter | Source invoice SRB number |
srb_integration_after_submit | action | Fires after submit (webhooks) |
srb_integration_webhook_payload | filter | Outbound webhook body |
srb_integration_retry_delay_minutes | filter | Retry backoff schedule |
srb_integration_simulation_invoice_number | filter | Simulated SRB invoice number |
srb_integration_qr_verification_url | filter | QR verification URL |
srb_integration_before_invoice_added | filter | Pre-create invoice hook |
API configuration
Default gateway URLs (override in API Settings):
| Environment | POST URL |
|---|---|
| ------------- | ---------- |
| Sandbox | https://pos.srb.gos.pk/di_data/v1/di/postinvoicedata_sb |
| Production | https://pos.srb.gos.pk/di_data/v1/di/postinvoicedata |
Obtain production URLs and credentials from the [SRB POS portal](https://pos.srb.gos.pk/PoSRegistration/) after registering your POS stations.
Troubleshooting
| Issue | Check |
|---|---|
| ------- | ------- |
| No settings error | API key saved for tenant |
| HTTP 401 | Token + SRB credentials |
| Invalid endpoint | Custom URL must start with https:// |
| Credit note blocked | Source invoice SRB status = sent |
| Retries not running | Cron + retry enabled |
| Webhooks not firing | HTTPS URL + cron + subscribed events |
| REST API 403 | API enabled + valid Bearer key |
| Verify page shows raw keys | Module lang loads automatically |
Tests
php modules/srb_integration/tests/SrbLogicTest.php
Permissions
| Capability | Key | Used for |
|---|---|---|
| ------------ | ----- | ---------- |
| View | view | SRB panel on invoices |
| Send | send | Submit to SRB, bulk submit |
| Settings | settings | API config, test connection |
| View Report | view_srb_report | Report, audit log, exports |
Uninstall
- Go to Setup → Modules.
- Deactivate SRB Integration first.
- Click Uninstall.
Uninstall removes module tables (srb_settings, srb_invoices, srb_audit_log, srb_webhook_queue), all related options, and the module files.
Features
Integrate Perfex CRM invoices with SRB Sindh Revenue Board POS (sandbox and production APIs via CURL).
- Submit invoices to SRB (manual + auto-submit)
- Credit note submission with source invoice SRB reference
- Simulation mode for safe testing
- Encrypted API credentials at rest
- Custom field mapping (HS code, sale type, buyer SNTN)
- QR codes on invoice PDF / client view / public verify page
- SRB report (CSV / PDF export)
- Retry queue with exponential backoff (cron)
- Test connection button (validate endpoint)
- Audit log of submit / retry / test actions
- Bulk submit admin UI for unsent invoices
- Webhooks (HTTPS + HMAC) on submit success/failure
- External REST API for third-party integrations
- Configurable API URLs per environment
- Urdu + Arabic language packs
Permissions
Granular staff capabilities are registered on activation. Assign them under Setup → Staff → Roles for the SRB Integration capability group.
- view — SRB panel on invoices
- send — Submit to SRB, bulk submit
- settings — API config, test connection
- view_srb_report — Report, audit log, exports
Cron Jobs
Background tasks (retries & webhooks) run through Perfex CRM's main cron. Example crontab (every 5 minutes):
* * * * * php /path/to/perfex/index.php cron/index > /dev/null 2>&1
Enable Retry failed SRB submissions and webhooks in module settings as needed.
After activation — configuration checklist
- Go to Setup → Modules and activate SRB Integration.
- If prompted, click Upgrade Database or reload admin — migrations run automatically.
- Assign permissions under Setup → Staff → Roles.
- Open Setup → Settings → Integrations → SRB Integration and configure settings.
- Perfex CRM 3.0+
- PHP 7.4+ (8.1+ recommended)
- MySQL 5.7+ / MariaDB 10.3+ (InnoDB)
- PHP extensions: mysqli, json, mbstring, curl, fileinfo
One-time setup (first time only)
- Setup → Modules → activate SRB Integration.
- Setup → Staff → Roles → assign SRB Integration permissions (view, create, edit, delete, approve, export, settings as needed).
- Open SRB Integration → Settings and complete company defaults, prefixes, integrations, and notification options.
- Create master data (warehouses, products, templates, accounts, routes, etc.) before processing live transactions.
- Enable Perfex CRM cron (
php /path/to/perfex/index.php cron/index) for sync, retries, alerts, and scheduled jobs. - Optionally enable REST API / webhooks in module settings if you integrate external systems.
Tips for success
- Always configure Settings before creating live transactions.
- Create master data (items, warehouses, templates, channels, accounts) first — most modules block incomplete records.
- Use a test/sample record before going live with real customers or production stock.
- Separate roles: operators create/edit; managers approve; finance/reporting get view/export only.
- After any module upgrade, reopen Settings and confirm new options have sensible defaults.
- If overnight jobs fail, verify Perfex CRM cron and check the module log / failed queue screen.
Common questions (FAQ)
Where do I find the module after activation?
In the admin sidebar look for SRB Integration. If missing, your role may lack view permission — fix under Setup → Staff → Roles.
Do I need to edit core Perfex CRM files?
No. Keep all custom code under modules/srb_integration/. Activate/deactivate from Setup → Modules.
What happens if I uninstall?
Deactivate keeps data. Uninstall usually removes module tables/options (see the Install article). Core customers, invoices, and items are not deleted by well-built modules.
Why can't my staff see a screen?
Almost always a permissions issue. Give the role at least view on that feature, then ask the user to log out and back in.
Reports/export buttons do nothing
Confirm the role has export (or view reports) permission, and that filters return at least one row. Try PDF/CSV from a wider date range.
FAQ from module documentation
Troubleshooting
| Issue | Check |
|---|---|
| ------- | ------- |
| No settings error | API key saved for tenant |
| HTTP 401 | Token + SRB credentials |
| Invalid endpoint | Custom URL must start with https:// |
| Credit note blocked | Source invoice SRB status = sent |
| Retries not running | Cron + retry enabled |
| Webhooks not firing | HTTPS URL + cron + subscribed events |
| REST API 403 | API enabled + valid Bearer key |
| Verify page shows raw keys | Module lang loads automatically |
Perfex CRM Knowledge Base — detailed usage guide generated from module README, HOW_TO_USE, and documentation.