diff --git a/src/Format.php b/src/Format.php index 8a0b1d5..141fe69 100644 --- a/src/Format.php +++ b/src/Format.php @@ -509,6 +509,9 @@ protected function createField($data) { $field = Field::create($data['t']); $field->setName(rtrim($data['n'])); $field->setLength($data['ll']); + if ($data['t'] == Field::TYPE_NUMERIC && isset($data['dd'])) { + $field->setDecimalCount(2); + } return $field; } diff --git a/src/field/NumericField.php b/src/field/NumericField.php index de679d3..ddde0d5 100644 --- a/src/field/NumericField.php +++ b/src/field/NumericField.php @@ -44,7 +44,7 @@ public function fromData($data) { if (!$this->getDecimalCount()) { return (integer)substr($data, 0, $this->getLength()); } else { - return (float)number_format(substr($data, 0, $this->getLength()), $this->getDecimalCount(), '.', ''); + return (float)number_format((float)substr($data, 0, $this->getLength()), $this->getDecimalCount(), '.', ''); } }