SMS · VERSION 0.1 · HOSTING PILOT

Solar Management System

Two portals, one database: Power Division and Regional Operations. HTML, CSS, JavaScript, PHP and MySQL/MariaDB. No Node.js, Composer or Java installation is needed on your hosting account.

This is a functional pilot for testing on your hosting. Core forms and workflows are implemented. Browser Save as PDF and Excel-compatible CSV are included. Automatic PDF attachments, native XLSX, a full engineering shading model and complete offline operation are not part of this release.

1. Hosting requirements

2. Upload and configure — cPanel

  1. Extract the ZIP on your computer. Upload the solar directory to public_html. The final path should be public_html/solar/power/index.php, not public_html/solar/solar/power/index.php. Preserve the included .htaccess files; enable “Show Hidden Files” in File Manager.
  2. Open cPanel → MySQL Databases. Create engrgolk_solar (or the database name your account permits), create a dedicated database user, and grant that user privileges on this database only.
  3. Open phpMyAdmin, select that empty database, and import solar/database/schema.sql. Import once. Do not re-import over operational data.
  4. Copy config.example.php to config.php. Fill in db_host, db_port, db_name, db_user and db_pass. Set base_url to https://engrgo.lk/solar or your actual URL, without a trailing slash.
  5. Replace setup_key with your own random string of at least 32 characters. Do not leave the sample value.
  6. Prefer a private directory outside public_html, such as /home/YOUR_CPANEL_USER/sms_storage. Set storage_path to this exact absolute path, and make it writable by PHP. Create an uploads subdirectory. Use 0750 or the least permissions supported by your host; do not use 0777. The default solar/storage is protected by .htaccess on Apache/LiteSpeed.
  7. Open https://engrgo.lk/solar/setup.php. Enter the setup key, your name, email, username, and a password of at least 12 characters. This creates the first Administrator. There is no default login.
  8. Delete setup.php from hosting after success. The database also prevents repeated installation.
  9. Open https://engrgo.lk/solar/power/ and sign in.

3. First-time administration

  1. Open Administration → add main regions, then their subregions.
  2. Add sites with ID, name, subregion, Mobitel/OOP ownership and actual solar status. Set the initial maintenance due date for installed/live sites that have no checklist yet.
  3. Regional officers register at /solar/rgo/. Power officers register at /solar/power/. Registration does not grant access immediately.
  4. In Administration, verify the applicant, set their role and subregion, then enable Approved / active. An applicant's chosen portal is only a requested role.
  5. Regional users can access their assigned subregion. In this pilot each Regional account has one subregion; multi-subregion engineer assignments are a future enhancement.
  6. Administrators can open either portal. Power users use the Power portal; Regional users use the Regional portal.

4. Using the workflows

Feature How to test
Installation request Regional → New Solar Requirement → choose a site, select close and far photographs, draw the layout, then submit. Power can create a proposal from Pending Installation. Only one non-rejected installation request per site is allowed.
Layout drawing Add symbols, drag, pinch or use Size to resize, rotate, and confirm each placement. HCT is a straight line drawn by dragging. Rotate north in 45° increments. Confirm the entire drawing before saving. Power may add/revise a layout before approval; earlier confirmed data is retained in layout_revisions. Drawings are schematic, not to scale.
Installation review Open record → Review → Approved → Planned → Installed → Live. Approval requires a confirmed layout and both location images. Approved, installed and live are separate states.
Faults Submit a site, notes, theft indication and one image per applicable equipment category. Power reviews and assigns to a named Power, Regional or Vendor contact.
Maintenance Complete all eight answers. Yes opens image upload for damage/cleaning findings. Communication Not OK requires a comment. Cleaning Yes creates one linked open cleaning request. Power can create a separate task from each maintenance finding and assign each independently.
Cleaning and tasks Submitted → Review → Assigned → In progress → Completed → Closed. Completed means work is reported done; Closed means Power verified it. Power may return a completed job to In progress. Blocked requires a reason. Rejected requests may return to review.
Vendor work No vendor login is included. Authorized Power officers record vendor completion and verification. Assigned RGO tasks can be updated by officers in that site's subregion.
Stock and planning Add equipment types, receive stock with a reference, define a capacity package with a bill of materials, then reserve for an approved site. Reservations immediately reduce available stock. Cancelling returns the quantities once; installing consumes the reservation. Marking a deployment Installed updates the site register; update its installation request milestone separately.
IP plan Enter site, IPv4 address, contiguous subnet mask, same-subnet gateway and port 1–65535. Export selected rows or all rows as CSV.
Reports Open a record → Print / Save PDF → select Save as PDF in the browser. Wait for images to load. Summary Reports allows selected columns, type and text filters, CSV export and browser PDF. CSV opens in Excel; it is not a native .xlsx workbook.
Editing / deleting Submitting officers may edit their unreviewed records. Power may edit unreviewed records. Reviewed data is locked; Power adds status comments. Deletion is a soft delete with an audit entry. Image replacements retain old files on disk but only the current image is displayed.

5. Email and scheduled reminders

This package uses your hosting provider's configured PHP mail() transport. It has no embedded SMTP credentials. Ask your host to configure authenticated mail delivery for your domain, then set mail_from and mail_enabled => true in config.php. Verify real inbox delivery; mail() accepting a message is not proof of inbox delivery.

Create a cPanel cron job every five minutes. Replace the PHP executable and account paths with your host's actual values:

*/5 * * * * /usr/local/bin/php /home/YOUR_CPANEL_USER/public_html/solar/bin/cron.php >/dev/null 2>&1

6. Your hosting test checklist

  1. Create a test site in each of two subregions and one Regional user per subregion. Confirm neither user can access the other's records, even by changing a report/image URL.
  2. On Android and iPhone, test Camera and Gallery separately. Confirm permission prompts, portrait image orientation, image readability and upload error messages. HEIC is not accepted by the backend; use JPEG/PNG/WebP or the camera's compatible format setting.
  3. Submit an installation with both photographs. Review it in Power, check the layout, approve, and progress through installation to Live.
  4. Submit maintenance with cleaning Yes and communication Not OK. Check the generated cleaning request and a separately created communication task.
  5. Assign a task to RGO, update it as the Regional officer, then verify and close it as Power.
  6. Receive 10 panels, define a package requiring 8, reserve once, and verify available stock becomes 2. Release it and verify stock returns to 10.
  7. Print a report with photographs and check page layout. Open an exported CSV in Excel.
  8. Check actual password-reset and submission email delivery. Test cron reminders with a test site's old initial due date.
  9. Disconnect the network while entering a form. Reconnect and retry. If a photograph upload fails after saving, the record stays saved and the form lets you retry the pending images.
  10. Test a narrow phone, tablet and desktop. Use Send feedback to report confusing steps. Save screenshots of issues and provide the page, browser/device and exact error text for the next update.

7. Release boundaries and next development

8. Maintenance, updates and backups

Back up the database and private storage/uploads together. Keep config.php private. Do not replace config.php or delete storage when uploading updates. Future releases should use incremental SQL migrations; never re-import schema.sql over live data. Check host/PHP logs for errors. Set display_errors=Off on hosting. Store backup archives outside public_html.

9. Nginx hosting note

Nginx ignores .htaccess. Ask the administrator to deny these paths before enabling the application, and keep storage outside the document root:

location ~ ^/solar/(app|database|storage|bin)/ { deny all; }
location ~ ^/solar/(config[^/]*\.php|README[^/]*|TEST[^/]*)$ { deny all; }

Your existing PHP-FPM configuration still needs to handle public PHP endpoints. Remove setup.php after installation. Verify protected paths return 403/404 rather than source, configuration or uploaded data.

10. File map

Path Purpose
power/ and rgo/ Separate portal entry points
api.php, app/ Shared PHP business rules and authentication
assets/ Local CSS and JavaScript, including layout editor; no CDN dependency
database/schema.sql First-install database schema
setup.php One-time administrator creation
file.php / report.php Authorized images and printable report
bin/cron.php CLI email queue and maintenance/task reminders
config.example.php Copy to config.php and set your hosting details
storage/ Default protected uploads and cron lock