!!! 
All values have to be given in metric ton, mt.
!!!

In Office with `New` a new report can be created for one vessel. Next, choose the vessel you want. On board they can create only reports for their own vessel.
Now all needed data have to filled in.

After On-Hire values were inserted with “Calculate Consumption/Days” you can calculate data from “Consumed during Off-Hire”.
All reports you find in folder “open”. 
 
In this report you have three times  MGO, HFO and FW to insert. Is it correct that all three values have to be filled in at different times and can be different in value.
MGO/HFO and FW need to be entered twice – when Off Hire started and when off hire completed.
And at the end we need to calculate how much MGO, HFO, FW were consumed during off hire period.

# Off-Hire Reports — Multi-Period Functionality

Off-Hire Reports now support **multiple periods** per report. Previously, each Off-Hire event was recorded as a single time range. Now you can split it into separate periods, each with its own date range, percentage, fuel consumption values, position data, and file attachments.

## Multiple Periods per Report

An Off-Hire Report can now contain any number of periods. Each period has:

- **Start date and time**
- **End date and time**
- **Percentage** (0–100%) — the portion of the time range considered off-hire
- **Effective Days** — automatically calculated from the time range and percentage

!!!
Periods are displayed as child nodes in the navigation tree below their Off-Hire Report. Click a period to view its details.
!!!

---

## Fuel Consumption per Period

Fuel fields (MGO, HFO, FW) are now recorded at the **period level** instead of the report level:

| Field | Description |
|-------|-------------|
| Off-Hire MGO / HFO / FW | Fuel remaining at the **start** of the off-hire period |
| On-Hire MGO / HFO / FW | Fuel remaining at the **end** of the off-hire period |

The **Consumed during Off-Hire** calculation automatically aggregates across all periods.

---

## Position per Period

Each period records its own **Off-Hire** and **On-Hire** position:

- **Position type** — selected from the configured position list (e.g. At Sea, In Port)
- **Port** — either selected from the port database or entered manually
- **Latitude / Longitude** — for positions that require coordinates

A **"Same position as Off-Hire"** checkbox allows you to copy the Off-Hire position to the On-Hire side in one click.

---

## Bunker Prices and Bunker Costs

You can now enter **bunker prices** (price per metric ton) at the report level:

| Field | Description |
|-------|-------------|
| MGO Price | Price per mt for Marine Gas Oil |
| HFO Price | Price per mt for Heavy Fuel Oil |
| FW Price | Price per mt for Fresh Water |

The prices are entered via the **Bunker Prices** button on the Report ribbon tab.

When prices are set, the HTML report view displays an **Off-Hire Bunker Costs** section that calculates:

> Consumption (mt) x Price (per mt) = Cost

for each fuel grade, plus a **Total Bunker Costs** line. The currency is the home currency of the vessel.

---

## Period Edit Dialog

To edit a period, double-click it in the tree or use the ribbon button. The dialog contains:

+++ General
- Start / End date and time
- Percentage (off-hire share)
- Effective Days (calculated automatically)
+++ Off-Hire
- Position, Port, Latitude/Longitude
- Fuel: MGO, HFO, FW values at start of off-hire
+++ On-Hire
- "Same position as Off-Hire" checkbox
- Position, Port, Latitude/Longitude (if not same)
- Fuel: MGO, HFO, FW values at end of off-hire
+++ Attachments
- Attach, view, or delete files linked to this period
- Drag & drop files directly into the dialog
+++

!!!warning Save & Cancel
All changes — including attachments — are only persisted when you click **Save**. Clicking **Cancel** discards all changes made during the current editing session, including any attachments added.
!!!

---

## Attachments per Period

Files can now be attached **directly to a specific period**. In the report HTML view, all attachments are shown in a single section, with period attachments grouped under their period name.

**Attaching files:**

| Method | Description |
|--------|-------------|
| **Attach button** (Period Edit Dialog) | Add files via file dialog |
| **Attach button** (Period ribbon tab) | Add files to the selected period |
| **Drag & Drop** (Tree / HTML view) | Drop files onto a period node |
| **Drag & Drop** (Period Edit Dialog) | Drop files into the edit dialog |

| Button | Action |
|--------|--------|
| **Show** | Open the selected attachment |
| **Delete** | Remove the selected attachment |
| **Save** | Download a copy of the selected attachment |

---

## History Tracking

All changes to Off-Hire Reports and their Periods are tracked in the history:

### Report History

Available via **More Actions > Show History** on the Reports ribbon tab. Shows all changes to the report, including:
- Status changes (approval, rejection, reopening)
- Field changes (dates, ports, reason, department)
- Attachment additions and removals

### Period History

Available via **Show Period History** on the Periods ribbon tab (when a period is selected). Shows all changes specific to the selected period:
- Field-by-field tracking: every change to date, time, percentage, fuel, position, or port is logged individually with old and new values
- Period creation and deletion
- Period attachment additions and removals

---

## Updated Calculations

### Consumed during Off-Hire

Consumption is now calculated by summing across all periods:

> Per period: Off-Hire value minus On-Hire value (only when Off-Hire > On-Hire).
> Total: Sum of all period consumptions.

### Effective Days

Sum of effective days across all periods, taking each period's percentage into account.

### Charter Total Loss

Calculated based on the individual period time ranges.

### Bunker Costs

Consumption multiplied by the bunker price entered at report level.

---

## Report Views

### HTML Report View

The report view includes:

- A **Periods table** listing all periods with date, time, percentage, position, fuel values, and effective days
- The **Consumed during Off-Hire** section with values aggregated from all periods
- The **Off-Hire Bunker Costs** section (when bunker prices are set)
- The **Attachments** section showing report and period attachments together

### Period Detail View

When selecting a single period in the tree, the detail view shows three cards:

==- General
Link to the Off-Hire Report, percentage, and effective days.
==- Off-Hire
Date, time, position, port, latitude/longitude, and fuel values (MGO, HFO, FW).
==- On-Hire
Date, time, position, port, latitude/longitude, and fuel values (MGO, HFO, FW).
==-

Below the cards, any **period attachments** are displayed.

---

# Changes at a Glance

| Before | After |
|--------|-------|
| Single time range per report | Multiple periods per report |
| Fuel fields on report level | Fuel fields on period level |
| No position data per period | Position, port, lat/long per period |
| Consumption from report fields | Consumption aggregated from all periods |
| No period-specific attachments | Attachments per period (button + drag & drop) |
| No bunker cost calculation | Bunker prices + cost calculation |
| History only at report level | History at report and period level |

---

# Data Migration

!!!success No data loss
Existing Off-Hire Reports are automatically migrated. The existing data (date range, fuel values, position data) is transferred to the first period of the report. No manual action is required.
!!!

*[PO]: Purchase Order  
*[AZA]: local folder
*[(PO]: Purchase Order  
*[RQ]: Requisition  
*[(RQ]: Requisition  
*[RfQ]: Request for Quotation  
*[(RfQ]: Request for Quotation  
*[SO]: Service Order  
*[(SO]: Service Order  
*[SQ]: Service Requisition  
*[(SQ]: Service Requisition  
*[SRfQ]: Service Request for Quotation  
*[OoB]: Open on Board  
*[(OoB]: Open on Board 
*[ART]: Average Running Time (operation hours per day) 
*[MC]: Master Contract
*[ADS]: Advantage Database Server (database engine used in previous versions of the ZeeBORN software)
*[.replic]: file extension for replication files (aka data transfer files)
