# Store Settings Module - Implementation Summary

## Overview
Complete Store Settings module has been successfully created with database integration, file uploads, and navigation links.

## Database Table Created
**Table Name:** `tblstore_settings`

### Columns:
- `ID` - Auto-increment primary key
- `StoreCode` - Unique store identifier (e.g., ST0002)
- `StoreName` - Store/business name
- `Mobile` - Primary mobile number
- `Email` - Contact email
- `Phone` - Secondary phone (optional)
- `GSTNumber` - GST registration number
- `TaxNumber` - Tax identification (optional)
- `PANNumber` - PAN card number (optional)
- `StoreWebsite` - Website URL (optional)
- `ShowSignatureOnInvoice` - Checkbox (0 or 1)
- `SignatureImage` - Path to signature file
- `BankDetails` - Multi-line bank account details
- `Country` - Country dropdown
- `State` - State dropdown
- `City` - City name
- `Postcode` - Postal/ZIP code
- `Address` - Full address
- `StoreLogo1` - Path to first logo (1000×1000px, max 1024KB)
- `StoreLogo2` - Path to second logo (1000×1000px, max 1024KB)
- `DateAdded` - Timestamp of creation
- `LastUpdated` - Auto-updated timestamp

### Default Data Inserted:
```
StoreCode: ST0002
StoreName: UZRS Software Solutions
Mobile: 8883888012
Email: uzrs2016@gmail.com
GST: 33PMOPS7777H1ZU
Website: uzrssoft.com
Country: India
State: Tamil Nadu
City: Madurai
Postcode: 625532
Address: Lakshmi Illam, 3/24 B, Kalaithevar Street, Theni Road, Usilampatti.
```

## Folder Structure Created

```
StoreSettings/
├── index.php              # Main store settings page
├── api/
│   └── get-store-settings.php  # API to fetch store data
├── css/
│   └── store-settings.css      # Custom styling
└── js/                    # Reserved for future JS
```

## Features Implemented

### 1. Store Settings Form (index.php)
- **Read-only Store Code** - Auto-set to ST0002
- **Store Name** (Required)
- **Mobile & Email** (Required)
- **Phone** (Optional)
- **GST, Tax, PAN Numbers** (Optional)
- **Store Website** (Optional)
- **Bank Details** - Textarea for account info
- **Country & State** - Dropdown selections
- **City & Postcode** - Text inputs
- **Address** - Textarea
- **Show Signature on Invoice** - Checkbox
- **File Uploads:**
  - Signature Image (1000×1000px, max 1024KB)
  - Store Logo 1 (1000×1000px, max 1024KB)
  - Store Logo 2 (1000×1000px, max 1024KB)

### 2. File Upload System
- Uploads saved to `/uploads/store/` directory
- Automatic file validation (size limit: 1024KB)
- Preview of existing uploaded images
- Files named with timestamp to avoid conflicts

### 3. Navigation Integration
✅ **Sidebar Menu** - Added "Store Settings" under SYSTEM section
✅ **Quick Menu** - Automatically includes Store Settings from sidebar

### 4. API Endpoint
- `get-store-settings.php` - Fetches store data as JSON

## How to Access

### From Sidebar:
1. Look under **SYSTEM** section
2. Click **Store Settings**

### From Quick Menu:
1. Click the **Menu** button in page header
2. Select **Store Settings**

### Direct URL:
```
http://localhost/customized/UZRS-inventory/UZRS-inventory/StoreSettings/
```

## Usage Instructions

### Updating Store Settings:
1. Navigate to Store Settings page
2. Fill in all required fields (marked with *)
3. Upload signature and logos (optional)
4. Click "Save Store Settings"
5. Success message will confirm update

### File Upload Guidelines:
- **Accepted formats:** PNG, JPG, JPEG, GIF
- **Maximum size:** 1024KB (1MB)
- **Recommended dimensions:** 1000×1000 pixels
- Images are stored in `uploads/store/` folder

### Bank Details Format:
```
Ac. Name : UZRS SOFTWARE SOLUTIONS
Ac.No: 9250 2000 2281 803
IFSC: UTIB0001234
```

## Security Features
- Session validation (redirects to login if not authenticated)
- SQL injection prevention (mysqli_real_escape_string)
- File upload validation
- Unique store code constraint

## Database Command Used
```sql
CREATE TABLE IF NOT EXISTS tblstore_settings (
    ID INT AUTO_INCREMENT PRIMARY KEY,
    StoreCode VARCHAR(50) NOT NULL UNIQUE,
    StoreName VARCHAR(255) NOT NULL,
    Mobile VARCHAR(20),
    Email VARCHAR(255),
    Phone VARCHAR(20),
    GSTNumber VARCHAR(50),
    TaxNumber VARCHAR(50),
    PANNumber VARCHAR(50),
    StoreWebsite VARCHAR(255),
    ShowSignatureOnInvoice TINYINT(1) DEFAULT 0,
    SignatureImage VARCHAR(255),
    BankDetails TEXT,
    Country VARCHAR(100),
    State VARCHAR(100),
    City VARCHAR(100),
    Postcode VARCHAR(20),
    Address TEXT,
    StoreLogo1 VARCHAR(255),
    StoreLogo2 VARCHAR(255),
    DateAdded DATETIME DEFAULT CURRENT_TIMESTAMP,
    LastUpdated DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

## Future Enhancements (Optional)
- [ ] Multiple store support
- [ ] Email signature configuration
- [ ] Invoice template preview
- [ ] Social media links
- [ ] Opening hours configuration
- [ ] Multi-language support

## Files Modified
1. `/includes/sidebar.php` - Added Store Settings menu link
2. `/includes/sidebar.php` - Added StoreSettings folder detection

## Files Created
1. `/StoreSettings/index.php` - Main page
2. `/StoreSettings/api/get-store-settings.php` - API endpoint
3. `/StoreSettings/css/store-settings.css` - Styling
4. `/uploads/store/` - Upload directory

---
**Created:** November 5, 2025  
**Status:** ✅ Fully Implemented & Tested  
**Database:** uzrs-inventorydb  
**Module Path:** `/StoreSettings/`
