Skip to content

Commit

Permalink
Merge pull request #103 from danielebuso/master
Browse files Browse the repository at this point in the history
Hotfix numero decimali quantità linea
  • Loading branch information
salgua authored Aug 30, 2022
2 parents 1155b24 + b243873 commit 3683dc7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 3683dc7

Please sign in to comment.