# Inventory Management System

A comprehensive Laravel-based Inventory Management System with full CRUD operations, reports, and financial tracking.

## Features

### 1. Admin Dashboard
- Complete login system with authentication
- Dashboard with statistics overview
- Visual indicators for low stock, purchase dues, sales dues
- Recent purchases and sales tracking

### 2. Supplier Management
- Full CRUD operations for suppliers
- Supplier ledger tracking
- Opening balance management
- Contact information storage

### 3. Product Management
- **Products**: Full product management with SKU, pricing, stock tracking
- **Units**: Unit management (kg, pcs, box, etc.)
- **Categories**: Product category management
- Low stock alerts
- Fractional quantity support

### 4. Purchase Management
- Create purchases with multiple products
- Shipment number tracking
- Fractional quantity support
- Purchase due tracking and payment
- Purchase invoice printing
- Purchase returns
- Automatic stock updates

### 5. Sales Management
- Create sales with multiple products
- Customer/supplier selection
- Shipment number tracking
- Fractional quantity support
- Sales due tracking and payment
- Sales invoice printing
- Sales returns
- Automatic stock updates

### 6. Wastage Management
- Track product wastage
- Fractional quantity support
- Wastage reasons and notes
- Automatic stock deduction

### 7. Inventory System
- Real-time stock tracking
- Low stock alerts
- Stock status filters (low/out/available)
- Stock by category

### 8. Party Ledger
- Complete party/supplier ledger
- Transaction tracking
- Balance calculation
- Date range filtering

### 9. Cashbook
- Cash flow tracking
- Payment and receipt recording
- Balance calculation
- Date range and type filtering

### 10. Profit & Loss Report
- Date range selection
- Total purchases and returns
- Total sales and returns
- Wastage tracking
- Gross profit calculation

### 11. Settings
- Company information
- Tax rate configuration
- Currency settings

### 12. Database Backup
- One-click backup creation
- Download backup files
- Backup management

## Installation

1. Clone the repository
2. Run `composer install`
3. Copy `.env.example` to `.env`
4. Configure your database in `.env`
5. Run `php artisan key:generate`
6. Run `php artisan migrate`
7. Run `php artisan db:seed` (creates admin user)
8. Run `php artisan serve`

## Default Admin Credentials

- **Email**: admin@example.com
- **Password**: password

## Technology Stack

- **Framework**: Laravel 12
- **Database**: SQLite (configurable to MySQL/PostgreSQL)
- **Frontend**: Bootstrap 5, Font Awesome 6
- **PDF Generation**: DomPDF
- **Authentication**: Laravel built-in auth

## Project Structure

```
app/
├── Http/
│   ├── Controllers/
│   │   ├── Auth/
│   │   │   └── AdminController.php
│   │   └── Admin/
│   │       ├── BackupController.php
│   │       ├── CashbookController.php
│   │       ├── CategoryController.php
│   │       ├── DashboardController.php
│   │       ├── InventoryController.php
│   │       ├── PartyLedgerController.php
│   │       ├── ProductController.php
│   │       ├── PurchaseController.php
│   │       ├── PurchaseReturnController.php
│   │       ├── ReportController.php
│   │       ├── SaleController.php
│   │       ├── SaleReturnController.php
│   │       ├── SettingController.php
│   │       ├── SupplierController.php
│   │       ├── UnitController.php
│   │       └── WastageController.php
│   └── Middleware/
│       └── AdminAuth.php
├── Models/
│   ├── Cashbook.php
│   ├── PartyLedger.php
│   ├── Product.php
│   ├── ProductCategory.php
│   ├── Purchase.php
│   ├── PurchaseItem.php
│   ├── PurchaseReturn.php
│   ├── PurchaseReturnItem.php
│   ├── Sale.php
│   ├── SaleItem.php
│   ├── SaleReturn.php
│   ├── SaleReturnItem.php
│   ├── Setting.php
│   ├── Supplier.php
│   ├── Unit.php
│   ├── User.php
│   └── Wastage.php
│   └── WastageItem.php
database/
├── migrations/
│   └── (19 migration files)
resources/
└── views/
    ├── admin/
    │   ├── layouts/
    │   ├── backup/
    │   ├── cashbook/
    │   ├── categories/
    │   ├── inventory/
    │   ├── party_ledger/
    │   ├── products/
    │   ├── purchases/
    │   ├── purchase_returns/
    │   ├── reports/
    │   ├── sales/
    │   ├── sale_returns/
    │   ├── settings/
    │   ├── suppliers/
    │   ├── units/
    │   ├── wastage/
    │   └── dashboard.blade.php
    └── auth/
        └── login.blade.php
```

## Usage

### Navigation Menu
- **Dashboard**: Overview of system statistics
- **Suppliers**: Manage suppliers and view ledgers
- **Products**: Manage products, units, and categories
- **Purchases**: Create and manage purchase orders
- **Sales**: Create and manage sales invoices
- **Inventory**: View current stock levels
- **Wastages**: Track product wastage
- **Party Ledger**: View party transaction history
- **Cashbook**: Track cash transactions
- **Profit & Loss**: View financial reports
- **Settings**: Configure system settings
- **Database Backup**: Backup and restore database

## Key Features Highlights

1. **Fractional Quantity Support**: All quantity fields support decimal values for precise inventory tracking
2. **Real-time Stock Updates**: Stock automatically updates when purchases, sales, or returns are recorded
3. **Due Payment Tracking**: Separate tracking for purchase and sales dues with payment functionality
4. **Dynamic Forms**: Add/remove product rows dynamically in purchase and sale forms
5. **Invoice Printing**: Generate PDF invoices for purchases and sales
6. **Multi-currency Ready**: Settings for currency configuration
7. **Tax Calculation**: Built-in tax calculation in purchases and sales
8. **Comprehensive Reports**: Profit & loss, party ledger, cashbook reports
9. **Database Backup**: One-click database backup with download capability

## Security

- CSRF protection on all forms
- Authentication middleware
- Input validation
- SQL injection protection (via Eloquent ORM)
- XSS protection (via Blade templating)

## Support

For support and questions, please contact the development team.

## License

This project is proprietary and confidential. Unauthorized copying, distribution, or use is strictly prohibited.

---

**Development by**: Your Company Name  
**Copyright**: {{ date('Y') }} All Rights Reserved
