Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Reading money from excel sometimes return 0 #12

Open
kabeza opened this issue Feb 9, 2019 · 1 comment
Open

Reading money from excel sometimes return 0 #12

kabeza opened this issue Feb 9, 2019 · 1 comment

Comments

@kabeza
Copy link

kabeza commented Feb 9, 2019

Hi Gerardo
Do you know why I'm getting 0 returned sometimes while reading money amounts from Excel ?
I'm importing data with PHPSpreadSheet and I use Money class in a function, during a foreach

Cells in spreadsheet doesn't have any format. And some amounts have . as decimal separator and others have ,

function moneda($monto)
{
	$currency = new Gerardojbaez\Money\Currency('ARS'); 
	$currency->setPrecision(2); 
	$currency->setThousandSeparator('.'); 
	$currency->setDecimalSeparator(','); 
	$currency->setSymbolPlacement('before');  
	$money = new Gerardojbaez\Money\Money($monto, $currency);
	echo $this->echonew("Monto:".$monto."<br />".$money);
	return $money;
	//echo Money::parse('$1,200.90', 'USD')->toDecimal();
	//return moneyFormat($monto, 'ARS');
}

imagen_115

Thanks

@dsbilling
Copy link

It's probably because "monto" has a $ sign in front of it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants