Oihana PHP System

HasTradingMeasures

The ten measures a body of trading figures is made of.

What was sold and what it earned (revenue), what that trade was worth at each of the three costs a merchant keeps — the price paid (purchaseCost), the weighted average cost (averageCost) and the loaded cost price (costPrice) —, the margin over each of them (purchaseMargin, averageMargin, grossMargin), and what physically moved (quantity, volume, weight).

They are declared once rather than once per family : a customer, a supplier, an article and a company are measured by the same ten figures, and ten properties written out four times are forty chances to drift. A family composes the trait and adds only what is its own — who the figures are about, and the dimensions that qualify them.

🔑 A measure carries what its source states, and nothing else. Each is an ObservationSeries : value for the total over the period, values for the run behind it, and either may be absent. A margin published once a year has no monthly detail to give ; a cost published month by month was never totalled. Neither absence is filled in — a summed total and a derived monthly figure are indistinguishable from published ones once written, and a reader has no way back. Summing, dividing, and turning a margin into a rate belong to whoever displays the figures, and stay visible there.

⚠️ Six of the ten are confidential by nature. The three costs and the three margins say what an operator earns on a given counterparty : they are the figures a customer must never read about itself, and an application serving them owes them a permission of their own. Hiding them from a projection is not enough on its own — sorting, filtering, faceting and grouping reconstruct a figure as surely as reading it. The library states the shape ; the guard belongs to the consumer, which alone knows its readers.

A measure is typed null|array|ObservationSeries : the union names a single class, so Reflection::hydrate() resolves a stored row on its own, and the array is where that row sits until it does — the constructor assigns raw, #[HydrateAs] acting through hydrate() alone.

Tags
author

Marc Alcaraz (eKameleon)

since
1.4.0

Table of Contents

Properties

$averageCost  : null|array<string|int, mixed>|ObservationSeries
The trade valued at the weighted average cost of what was sold.
$averageMargin  : null|array<string|int, mixed>|ObservationSeries
The margin over {@see HasTradingMeasures::$averageCost}.
$costPrice  : null|array<string|int, mixed>|ObservationSeries
The trade valued at cost price — the purchase price with the charges that ride along with it loaded on.
$grossMargin  : null|array<string|int, mixed>|ObservationSeries
The margin over {@see HasTradingMeasures::$costPrice} — the gross margin.
$purchaseCost  : null|array<string|int, mixed>|ObservationSeries
The trade valued at the price paid for the goods.
$purchaseMargin  : null|array<string|int, mixed>|ObservationSeries
The margin over {@see HasTradingMeasures::$purchaseCost}.
$quantity  : null|array<string|int, mixed>|ObservationSeries
How much was traded, in the units the items are counted in.
$revenue  : null|array<string|int, mixed>|ObservationSeries
What the trade earned — the amount invoiced.
$volume  : null|array<string|int, mixed>|ObservationSeries
The space the traded goods took up.
$weight  : null|array<string|int, mixed>|ObservationSeries
What the traded goods weighed.

Properties

$averageCost

The trade valued at the weighted average cost of what was sold.

public null|array<string|int, mixed>|ObservationSeries $averageCost

The middle of the three costs : what the goods stood at in inventory when they left it, rather than what the last purchase order paid (HasTradingMeasures::$purchaseCost) or what they end up costing once the charges around them are loaded on (HasTradingMeasures::$costPrice).

Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$averageMargin

The margin over {@see HasTradingMeasures::$averageCost}.

public null|array<string|int, mixed>|ObservationSeries $averageMargin
Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$costPrice

The trade valued at cost price — the purchase price with the charges that ride along with it loaded on.

public null|array<string|int, mixed>|ObservationSeries $costPrice

The cost a margin is read against when the question is whether the trade paid for itself, rather than whether it was bought well.

Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$grossMargin

The margin over {@see HasTradingMeasures::$costPrice} — the gross margin.

public null|array<string|int, mixed>|ObservationSeries $grossMargin

The one a trading business steers by : what the trade earned once the goods it consumed are counted at what they truly cost.

Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$purchaseCost

The trade valued at the price paid for the goods.

public null|array<string|int, mixed>|ObservationSeries $purchaseCost
Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$purchaseMargin

The margin over {@see HasTradingMeasures::$purchaseCost}.

public null|array<string|int, mixed>|ObservationSeries $purchaseMargin
Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$quantity

How much was traded, in the units the items are counted in.

public null|array<string|int, mixed>|ObservationSeries $quantity

⚠️ Homogeneous only within one item. A figure spanning several items adds square metres to cubic metres to pieces ; it is worth reading per article, and worth distrusting as a total. HasTradingMeasures::$volume and HasTradingMeasures::$weight are the two that add up whatever was sold.

Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$revenue

What the trade earned — the amount invoiced.

public null|array<string|int, mixed>|ObservationSeries $revenue
Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$volume

The space the traded goods took up.

public null|array<string|int, mixed>|ObservationSeries $volume
Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class

$weight

What the traded goods weighed.

public null|array<string|int, mixed>|ObservationSeries $weight
Tags
since
1.4.0
Attributes
#[HydrateAs]
\xyz\oihana\schema\statistics\ObservationSeries::class
On this page

Search results