jenner/LstGen

Error Message Fatal error: Uncaught Error: Call to undefined method BigDecimal::toFloat() in ...

Closed this issue · 2 comments

Hi Jenner, thank you for your great work on making this Software.

I have a problem with the implementation of the sample PHP-Code:

$brutto = 500000; // Brutto in ¢ent
$lst = new Lohnsteuer2023();
$lst->setRe4($brutto);
$lst->setPkv(1);
$lst->setAlter1(0);
$lst->setAf(0);
$lst->setF(1);
$lst->setPvs(0);
$lst->setR(0);
$lst->setLzzhinzu(0);
$lst->setPvz(0);
$lst->setStkl(1);
$lst->setLzz(2);
$lst->setKrv(2);
$lst->main();
$steuer = floor($lst->getLstlzz()->toFloat() + $lst->getStv()->toFloat() + $lst->getSts()->toFloat());
$soli = floor($lst->getSolzlzz()->toFloat() + $lst->getSolzs()->toFloat() + $lst->getSolzv()->toFloat()) / 100;
$stges = $steuer + $soli;
echo "steuer: $steuer\nsoli: $soli\nstges: $stges\n";`

I always get the error message: Fatal error: Uncaught Error: Call to undefined method BigDecimal::toFloat() in ... on line x, where x is the line where toFloat() is first used in the sample code.

I am convinced that i produce these error through something myself, but did you have an idea what i could change to get it up and running?

Thank you very much!

jenner commented

Hi, you're right, it should be rather floatValue(), I guess the README is a bit outdated :(

Thank you very much, that solved it!