# Cheque Writer - Professional Cheque Management System

A comprehensive web-based application for managing and printing cheques with advanced features including PDC tracking, security deposit management, and detailed reporting.

## Features

- **Professional Cheque Printing** - Print cheques with customizable formats
- **Bank & Payee Management** - Manage multiple banks and payees
- **PDC Tracking System** - Track post-dated cheques
- **Security Deposit Management** - Monitor security deposits
- **Comprehensive Reports** - Generate detailed reports in CSV and PDF formats
- **User Management** - Role-based access control with Superadmin capabilities
- **Multi-Company Support** - Manage multiple companies

## System Requirements

- PHP >= 8.2
- MySQL >= 5.7 or MariaDB >= 10.3
- Composer
- Node.js & NPM (for asset compilation)

### Required PHP Extensions

- PDO
- Mbstring
- OpenSSL
- Tokenizer
- XML
- Ctype
- JSON
- BCMath
- Fileinfo
- GD

### Directory Permissions

The following directories must be writable:
- `storage/framework`
- `storage/logs`
- `bootstrap/cache`

## Installation

### Web-Based Installer (Recommended)

1. **Upload Files**
   - Upload all files to your web server
   - Ensure proper directory permissions

2. **Access Installer**
   - Navigate to `http://yourdomain.com/install` in your browser
   - The installation wizard will guide you through the setup

3. **Follow Installation Steps**
   - **Welcome** - Introduction to the application
   - **Requirements Check** - Verify server meets all requirements
   - **Purchase Code** - Enter your CodeCanyon purchase code
   - **Database Configuration** - Configure database connection
   - **Admin Account** - Create your administrator account
   - **Complete** - Installation finished!

4. **Login**
   - After installation, you'll be redirected to the login page
   - Use the admin credentials you created during installation

### Manual Installation

If you prefer manual installation:

```bash
# 1. Clone or download the repository
cd /path/to/your/webroot

# 2. Install PHP dependencies
composer install --no-dev --optimize-autoloader

# 3. Create environment file
cp .env.example .env

# 4. Generate application key
php artisan key:generate

# 5. Configure database in .env file
# Edit .env and set your database credentials

# 6. Run migrations and seeders
php artisan migrate --seed

# 7. Create admin user (optional, if not using seeder)
php artisan tinker
>>> User::create(['name' => 'Admin', 'username' => 'admin', 'email' => 'admin@example.com', 'password' => Hash::make('password'), 'role' => 'superadmin']);

# 8. Install and build frontend assets
npm install
npm run build

# 9. Set proper permissions
chmod -R 775 storage bootstrap/cache
```

## Configuration

### Environment Variables

Key environment variables in `.env`:

```env
APP_NAME="Cheque Writer"
APP_URL=http://yourdomain.com

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cheque_writer
DB_USERNAME=root
DB_PASSWORD=
```

### Post-Installation Setup

1. **Login** with your admin credentials
2. **Configure Settings** - Go to Settings to configure application preferences
3. **Add Banks** - Add your bank accounts
4. **Add Payees** - Add payees for cheque printing
5. **Add Companies** - Configure company information
6. **Create Users** - Add additional users if needed (Superadmin only)

## Usage

### Creating a Cheque

1. Navigate to **Cheques** → **Create New**
2. Select bank, payee, and company
3. Enter amount and date
4. Add optional memo
5. Save and print

### Tracking PDCs

- Go to **PDC Tracker** to view all post-dated cheques
- Update status as cheques are cleared

### Security Deposits

- Track security deposits in **Security Tracker**
- Monitor deposit and return dates

### Reports

- Access **Reports** section
- Filter by date range, bank, payee, or status
- Export to CSV or PDF

## User Roles

### Superadmin
- Full access to all features
- User management
- System settings
- All CRUD operations

### Regular User
- Create and manage cheques
- View reports
- Manage banks, payees, and companies
- Update own profile

## Troubleshooting

### Installation Issues

**Problem**: "Storage not writable" error  
**Solution**: Run `chmod -R 775 storage bootstrap/cache`

**Problem**: "Database connection failed"  
**Solution**: Verify database credentials in `.env` file and ensure MySQL is running

**Problem**: "Purchase code invalid"  
**Solution**: Ensure you're entering the correct CodeCanyon purchase code

### Runtime Issues

**Problem**: Blank page or 500 error  
**Solution**: 
- Check `storage/logs/laravel.log` for errors
- Ensure all PHP extensions are installed
- Run `php artisan config:clear` and `php artisan cache:clear`

**Problem**: Assets not loading  
**Solution**: Run `npm run build` to compile assets

## Security

- Change default admin password immediately after installation
- Keep `.env` file secure and never commit it to version control
- Regularly update the application and dependencies
- Use HTTPS in production environments

## Support

For support and bug reports, please contact through CodeCanyon.

## License

This application is licensed under CodeCanyon's regular license. One license per domain/installation.

## Credits

Built with Laravel 12 and modern web technologies.

---

**Version**: 1.0.0  
**Last Updated**: December 2025
