From 66f0553c99a829e2ac36dea974160674fc0f11f0 Mon Sep 17 00:00:00 2001 From: danielebuso Date: Mon, 29 Aug 2022 15:28:01 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Hotfix=20numero=20decimali=20quantit=C3=A0?= =?UTF-8?q?=20linea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FatturaElettronicaBody/DatiBeniServizi/Linea.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/FatturaElettronica/FatturaElettronicaBody/DatiBeniServizi/Linea.php b/src/FatturaElettronica/FatturaElettronicaBody/DatiBeniServizi/Linea.php index cfb642f..c78be8a 100644 --- a/src/FatturaElettronica/FatturaElettronicaBody/DatiBeniServizi/Linea.php +++ b/src/FatturaElettronica/FatturaElettronicaBody/DatiBeniServizi/Linea.php @@ -99,7 +99,7 @@ public function toXmlBlock(\XMLWriter $writer) } $writer->writeElement('Descrizione', $this->descrizione); if ($this->quantita) { - $writer->writeElement('Quantita', fe_number_format($this->quantita, $this->decimaliLinea)); + $writer->writeElement('Quantita', fe_number_format($this->quantita, $this->decimaliQuantita())); $writer->writeElement('UnitaMisura', $this->unitaMisura); } $this->writeXmlField('DataInizioPeriodo', $writer); @@ -137,6 +137,16 @@ public function prezzoTotale($format = true) return fe_number_format($totale, $this->decimaliLinea); } + /** + * Restituisce il numero di decimali della quantita + * + * @return int + */ + public function decimaliQuantita() + { + return max(min(strlen(substr(strrchr($this->quantita, "."), 1)), 8), 2); + } + /** * Imposta il numero riga * From b243873e8820937a3e34e49d3ae7aad318a17d06 Mon Sep 17 00:00:00 2001 From: danielebuso Date: Mon, 29 Aug 2022 15:35:09 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08b6d20..2e02d76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.25] - 2022-08-29 +### Fixed +- Hotfix numero decimali quantità linea #103 by danielebuso + +## [1.1.24] - 2022-05-23 +### Fixed +- Aggiunta gestione natura iva #102 by @snipershady ## [1.1.23] - 2022-04-13 ### Fixed