# SmartPay360 Field Sales Clearance MVP

This is a starter MVP module for managing field sales sessions, collections, returns, and end-of-day clearance.

## Assumptions
- Existing SmartPay360 app structure
- Database connection available at `../../config/db.php`
- Layout wrapper available at `../../includes/layout2.php`
- MySQL/MariaDB with mysqli

## Folder
Place this folder as:
`/smartpay360/modules/field_sales/`

## Files included
- `install.sql` - database schema
- `index.php` - dashboard
- `sessions.php` - session list
- `new_session.php` - create session
- `session_view.php` - session details
- `sales_entry.php` - add daily sales lines
- `collections.php` - capture money collected
- `returns.php` - capture stock returns/damages
- `clearance.php` - end-of-day reconciliation page
- `actions/*.php` - form handlers

## Recommended menu
Add to your main menu under Modules:
- Field Sales Dashboard
- Sessions
- New Session

## Notes
This MVP is intentionally simple and safe:
- uses prepared statements
- has basic CSRF protection
- supports Draft -> Submitted -> Approved flow
- calculates shortages/overages during clearance

You can extend it later with:
- route planning
- stock issue integration
- customer visit logs
- attachments for deposit slips
- printable clearance slips
