Sort by alphabet.

This commit is contained in:
James Cole
2016-01-20 15:23:36 +01:00
parent c84f4e2bc0
commit c9e4a09da6
11 changed files with 713 additions and 720 deletions

View File

@@ -17,6 +17,17 @@ use Preferences as Prefs;
class Amount
{
/**
* @param $amount
* @param bool $coloured
*
* @return string
*/
public function format($amount, $coloured = true)
{
return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
}
/**
* This method will properly format the given number, in color or "black and white",
* as a currency, given two things: the currency required and the current locale.
@@ -48,48 +59,6 @@ class Amount
return $result;
}
/**
* @param $amount
* @param bool $coloured
*
* @return string
*/
public function format($amount, $coloured = true)
{
return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
}
/**
* @return string
*/
public function getCurrencySymbol()
{
$cache = new CacheProperties;
$cache->addProperty('getCurrencySymbol');
if ($cache->has()) {
return $cache->get();
} else {
$currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'));
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
$cache->store($currency->symbol);
return $currency->symbol;
}
}
/**
* @param string $symbol
* @param float $amount
* @param bool $coloured
*
* @return string
*/
public function formatWithSymbol($symbol, $amount, $coloured = true)
{
return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
}
/**
*
* @param TransactionJournal $journal
@@ -139,6 +108,18 @@ class Amount
return $this->formatAnything($currency, $transaction->amount, $coloured);
}
/**
* @param string $symbol
* @param float $amount
* @param bool $coloured
*
* @return string
*/
public function formatWithSymbol($symbol, $amount, $coloured = true)
{
return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
}
/**
* @return Collection
*/
@@ -173,6 +154,25 @@ class Amount
}
}
/**
* @return string
*/
public function getCurrencySymbol()
{
$cache = new CacheProperties;
$cache->addProperty('getCurrencySymbol');
if ($cache->has()) {
return $cache->get();
} else {
$currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'));
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
$cache->store($currency->symbol);
return $currency->symbol;
}
}
/**
* @return TransactionCurrency
*/