Kommersiella fakturaunderlag måste upprätthålla exakt matematisk konsistens ner till minsta valutadelsumma. Nedan visas det operativa JSON-dataskemat som representerar en aktiv fakturasession i Utiliome:
{
"meta": {
"invoiceNumber": "INV-2026-0891",
"issueDate": "2026-11-07",
"dueDate": "2026-12-07",
"currency": "SEK",
"currencySymbol": "kr"
},
"issuer": {
"name": "Apex Cloud Architecture AB",
"address": "Stureplan 4, vån 5",
"city": "114 35 Stockholm",
"taxId": "SE556123456701"
},
"client": {
"name": "Nexus Global Logistics AB",
"address": "Kungsgatan 12",
"city": "411 19 Göteborg",
"taxId": "SE556987654301"
},
"items": [
{
"description": "Infrastruktursäkerhetsgranskning och härdning",
"quantity": 40,
"unitRate": 1850.00,
"amount": 74000.00
},
{
"description": "Konfiguration av Zero-Trust Kubernetes-kluster",
"quantity": 1,
"unitRate": 35000.00,
"amount": 35000.00
}
],
"financials": {
"subtotal": 109000.00,
"discountPercent": 5.0,
"discountAmount": 5450.00,
"taxPercent": 25.0,
"taxAmount": 25887.50,
"total": 129437.50
}
}
För att förhindra avrundningsfel enligt IEEE 754-standarden för flyttal (såsom 0.1 + 0.2 === 0.30000000000000004), utförs beräkningar med heltal i minsta valutaenhet (ören/cent):
const subtotalCents = items.reduce((sum, item) => {
return sum + Math.round(item.quantity * item.unitRate * 100);
}, 0);
const discountCents = Math.round(subtotalCents * (discountPercent / 100));
const taxableCents = subtotalCents - discountCents;
const taxCents = Math.round(taxableCents * (taxPercent / 100));
const totalCents = taxableCents + taxCents;