# Gas Station Management ERP: Hyper-Detailed Master Guide

This guide provides the most granular, step-by-step instructions for a Station Owner to configure and run their hosted management system.

---

## 🟢 Phase 1: Security & Personalization (First 10 Minutes)
*Goal: Secure your account and set your brand.*

### 1. Initial Login
*   **URL:** Navigate to your provided hosting link.
*   **Default Credentials:** `admin` / `password123`.
*   **Change Password:** Immediately go to the top-right user menu -> **Profile**.
    *   Enter a strong password.
    *   *Owner's Tip: Use a unique password that you do not share with staff.*

### 2. Branding (System Settings)
Go to **Sidebar -> System Settings**.
*   **Company Name:** Enter the name exactly as it should appear on receipts.   
*   **Currency Symbol:** Enter your symbol (e.g., `$`, `៛`, `฿`).
*   **Logo Upload:** Upload a high-resolution PNG with a transparent background for best results.
*   **Theme Color:** Use the color picker to match your station's brand (e.g., bright yellow, deep green, or red).

---

## 🔵 Phase 2: Telegram Connectivity (The Remote Control)
*Goal: Link the system to your phone for instant oversight.*

1.  **Create your Bot:**
    *   Open Telegram, search for `@BotFather`.
    *   Send `/newbot`. Name it "MyStation_Alert_Bot".
    *   **Copy the API Token** (Example: `712345678:AAH_random_chars`).
2.  **Get your Chat ID:**
    *   Search for `@userinfobot`.
    *   Send it a message. It will reply with your **Id** (e.g., `554433221`).
3.  **ERP Link:**
    *   In the ERP, go to **Settings -> Telegram**.
    *   Paste the **Token** and **Chat ID**.
    *   **Enable Sales Alerts:** You will get a message every time a sale over a certain amount is logged.
    *   **Enable Low Stock Alerts:** You will get a message when a tank hits its low threshold.

---

## 🟡 Phase 3: The "Digital Twin" Setup (The Golden Order)
*Goal: Map your station's physical assets. DO NOT skip the order below.*

### 1. Stations
*   Add a **New Station**. Enter the address and manager contact.
### 2. Fuel Types
*   Add each product: `Diesel`, `Regular 92`, `Super 95`.
*   **Set Price:** Enter the current price per liter. 
    *   *Note: Updating this price here will update it for all future sales immediately.*
### 3. Tanks (The Inventory Brain)
*   Create a tank for each fuel type.
*   **Capacity:** Enter the total volume (e.g., `20000`).
*   **Low Alarm %:** Set to `20`. This triggers the Telegram alert when the tank is 80% empty.
### 4. Nozzles (The Link)
*   Register each nozzle on your dispensers (e.g., "Pump 1 - Left").
*   **Select Tank:** Link it to the specific tank it draws from.
    *   *Critical Logic: When Nozzle 1 is used for a 50L sale, the system automatically subtracts 50L from the linked Tank.*

---

## 🟠 Phase 4: Daily Operational Cycle
*Goal: How staff should use the system every day.*

### 1. Opening the Shift
*   **Action:** Manager goes to **Shifts -> Start New Shift**.
*   **Staff:** Select which Cashiers are on duty.
*   **Starting Readings:** (Optional) Record the mechanical numbers from the physical pump display.

### 2. Logging a Sale (Cashier Workflow)
*   Go to **Transactions -> New Sale**.
*   **Select Nozzle:** The system pre-fills the Fuel Type and current Price.
*   **Enter Volume:** Enter the liters pumped.
*   **Payment Method:** Select Cash, Credit Card, or Fleet.
*   **Save:** The sale is recorded, and inventory is decreased.

### 3. Fuel Deliveries (Refilling)
*   When a truck arrives, go to **Fuel Deliveries -> Add New**.
*   Enter the exact liters received from the delivery note.
*   Select the **Tank** that received the fuel.
*   *Note: This is the only way to increase your inventory in the system.*

---

## 🔴 Phase 5: The "Owner's Audit" (Catching Theft & Leaks)
*Goal: Use math to verify the station's honesty.*

### 1. Daily Tank Dipping
*   At the end of the day, a staff member must use a physical dipstick to measure the fuel level.
*   Enter this reading in **Tank Dipping**.

### 2. Variance Analysis (The Truth Report)
The system performs this calculation:
*   **Theoretical Stock:** `Starting Inventory` + `Deliveries` - `Total Sales`.
*   **Actual Stock:** The measurement from the **Tank Dipping**.
*   **VARIANCE:** `Theoretical` - `Actual`.
    *   **If Variance is 0:** Everything is perfect.
    *   **If Variance is negative (-):** You have missing fuel (Theft or Leak).
    *   **If Variance is positive (+):** There may be an error in delivery logging or a calibration issue.

---

## ⚪ Phase 6: Troubleshooting & Support
*   **Missing Sales?** Check the **Audit Log** to see if a staff member deleted or edited a transaction.
*   **Incorrect Inventory?** Review **Fuel Deliveries** to ensure every truck was logged.
*   **No Alerts?** Check the **Telegram Token** in Settings to ensure it hasn't expired.

---
**Final Pro-Tip:** Do the **Tank Dipping** at the same time every night (e.g., 10:00 PM) for the most accurate Variance reports.
