An open API service indexing awesome lists of open source software.

https://github.com/codenitros/boatbookingsystem


https://github.com/codenitros/boatbookingsystem

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

          

# ๐Ÿšค Sharavati Backwater Boating Honnavar Ticket Booking System

A JavaFX 17 desktop application for booking boat ride tickets at Sharavati Backwater Boating Honnavar, with thermal printing, database storage, and Excel export.

---

## โœจ Features

| Feature | Details |
|---|---|
| User Authentication | Login with username/password and role-based access |
| Customer Details | Name + 10-digit Contact Number |
| Passenger Count | Spinner (1โ€“50 people) |
| Ride Duration | Radio buttons: 1 Hour (โ‚น1500) or 2 Hours (โ‚น2500) |
| Life Jackets | Mandatory, โ‚น10 per person |
| Parking | Optional checkbox with vehicle types |
| Vehicle Types | Car โ‚น20 ยท Bus โ‚น50 ยท Tempo Traveller โ‚น35 |
| Boat Assignment | Search and select from registered boats/drivers |
| Live Fee Calc | Total, Driver Amount, Counter Amount update instantly |
| Thermal Printing | Direct print to thermal printer + console preview |
| Database Storage | SQLite for ticket and boat data |
| Excel Export | Backup tickets to Excel file |
| View Tickets | List today's issued tickets |
| Fee Split | Driver: Boat + Jackets; Counter: Parking |

---

## ๐Ÿ› ๏ธ Prerequisites

- **Java 17** (JDK 17+)
- **Maven 3.8+**
- **IntelliJ IDEA** (Community or Ultimate)

---

## ๐Ÿš€ Quick Start in IntelliJ

### 1. Open the Project
```
File โ†’ Open โ†’ select the BoatTicketSystem folder
```
IntelliJ will auto-detect the `pom.xml` and import dependencies.

### 2. Wait for Maven to download dependencies
The first run downloads JavaFX 17, SQLite JDBC, Apache POI, and other libraries (~10-15 MB total).

### 3. Run the app
- **Option A (Maven):** Right-click `pom.xml` โ†’ Run Maven โ†’ `javafx:run`
- **Option B (Main class):** Open `MainApp.java` โ†’ click the green โ–ถ Run button
- **Option C (Run Config):** The `.idea/runConfigurations/BoatTicketSystem.xml` is pre-configured

The app starts with a login screen. Default credentials are admin/admin (or check DatabaseManager for setup).

### If you see module errors, add VM options:
```
--add-opens javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
```
Go to: **Run โ†’ Edit Configurations โ†’ VM Options**

---

## ๐Ÿ“ Project Structure

```
BoatTicketSystem/
โ”œโ”€โ”€ pom.xml โ† Maven dependencies
โ”œโ”€โ”€ build-exe.bat โ† Build script for creating executable
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ assembly/
โ”‚ โ”‚ โ””โ”€โ”€ distribution.xml โ† Assembly descriptor for packaging
โ”‚ โ””โ”€โ”€ main/
โ”‚ โ”œโ”€โ”€ java/
โ”‚ โ”‚ โ”œโ”€โ”€ module-info.java โ† Java module descriptor
โ”‚ โ”‚ โ””โ”€โ”€ com/boatticket/
โ”‚ โ”‚ โ”œโ”€โ”€ MainApp.java โ† Entry point
โ”‚ โ”‚ โ”œโ”€โ”€ controller/
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ BookingController.java โ† Booking UI logic
โ”‚ โ”‚ โ”œโ”€โ”€ db/
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ DatabaseManager.java โ† SQLite database operations
โ”‚ โ”‚ โ”œโ”€โ”€ model/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Ticket.java โ† Ticket data model + fee constants
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ BoatOwner.java โ† Boat owner data model
โ”‚ โ”‚ โ””โ”€โ”€ util/
โ”‚ โ”‚ โ””โ”€โ”€ ThermalPrinterManager.java โ† Thermal printing utilities
โ”‚ โ””โ”€โ”€ resources/com/boatticket/
โ”‚ โ”œโ”€โ”€ login.fxml โ† Login UI layout
โ”‚ โ”œโ”€โ”€ booking.fxml โ† Booking UI layout
โ”‚ โ””โ”€โ”€ styles.css โ† Styling
โ””โ”€โ”€ .idea/runConfigurations/ โ† Pre-built IntelliJ run config
```

---

## ๐Ÿ’ฐ Fee Structure (all preset โ€” edit in `Ticket.java`)

```java
BOAT_RIDE_FEE_PER_HOUR = 1500 // per hour
BOAT_RIDE_FEE_2HOURS = 2500 // special rate for 2 hours
LIFE_JACKET_FEE = 10 // per jacket (mandatory)
PARKING_FEE_CAR = 20
PARKING_FEE_BUS = 50
PARKING_FEE_TEMPOTRAVELLER = 35
```

To change any fee, open `src/main/java/com/boatticket/model/Ticket.java` and edit the constants at the top.

---

## ๐Ÿ–จ๏ธ Generating a Ticket (Thermal Print)

1. Fill in the booking form (login required)
2. Select boat/driver, duration, parking if needed
3. Click **"Generate Ticket"**
4. The ticket is automatically printed to the default thermal printer
5. A preview is also shown in the console

The thermal ticket includes:
- Unique Ticket ID + booking timestamp
- Customer & ride details
- Boat/driver assignment
- Itemised fee breakdown (Boat, Jackets, Parking)
- Driver Amount + Counter Amount
- Total amount

---

## ๐Ÿ”ง Troubleshooting

**"JavaFX runtime components are missing"**
โ†’ Make sure you're running via Maven (`mvn javafx:run`) or add `--module-path` to VM options.

**Dependencies not downloading**
โ†’ Check internet connection, then: Right-click `pom.xml` โ†’ Maven โ†’ Reload Project.

**Build fails on module-info.java**
โ†’ Ensure your IntelliJ is set to Java 17: File โ†’ Project Structure โ†’ SDK = 17.

---

## ๐Ÿ“ฆ Building a runnable JAR

```bash
mvn clean package
java -jar target/BoatTicketSystem-2.0-SNAPSHOT.jar
```

---

## ๐Ÿš€ Creating a Self-Contained Executable (Windows .exe)

This project is configured to create a self-contained executable that bundles all dependencies into a single JAR file and wraps it in a Windows executable.

### Build the distributable package:

**Option 1: Using the build script (recommended):**
```bash
# Double-click build-exe.bat or run:
build-exe.bat
```

**Option 2: Using Maven directly:**
```bash
mvn clean package
```

This will create:
- `target/BoatTicketSystem-2.0-SNAPSHOT.jar` - Fat JAR with all dependencies
- `target/BoatTicketSystem.exe` - Windows executable
- `target/BoatTicketSystem-2.0-SNAPSHOT-distribution.zip` - Complete distribution package

### What's included in the distribution:

- **Fat JAR** (created with Maven Shade) - Contains all dependencies (~25-35MB)
- **Windows executable** (`.exe`) launcher created with Launch4j
- **Batch file** launcher (`.bat`) as alternative
- **README** and documentation

### Running the application:

1. Extract the `BoatTicketSystem-2.0-SNAPSHOT-distribution.zip` file
2. Double-click `BoatTicketSystem.exe` or run `BoatTicketSystem.bat`
3. The application will start (requires Java 17+ on target machine)

### System Requirements for the executable:

- **Windows 7 SP1 or later** (64-bit recommended)
- **Java 17+** must be installed on the target machine
- **~30-40MB** free disk space for the extracted distribution

### How it works:

1. **Maven Shade Plugin** creates a fat JAR containing all dependencies
2. **Launch4j** wraps the JAR into a Windows executable with proper JRE detection
3. **Maven Assembly** packages everything into a distributable zip file

---

## ๐Ÿ”ง Advanced Build Options

### Build only the fat JAR (without exe):

```bash
mvn clean package -DskipTests
```

### Build only the executable (requires JAR to be built first):

```bash
mvn launch4j:launch4j
```

### Build only the distribution zip:

```bash
mvn assembly:single
```

### Run the application during development:

```bash
mvn javafx:run
```