| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- function getCards()
- {
- return \App\Models\Card::where('enabled', true)->orderBy('name')->get();
- }
- function getCategories()
- {
- return \App\Models\Category::where('enabled', true)->where('parent_id', null)->orderBy('name')->get();
- }
- function formatPrice($price)
- {
- return "€ " . number_format($price, 2, ",", ".");
- }
- function getVatValue($v, $i)
- {
- $vat = 0;
- //if (env('VAT_MANAGE', 0) == 1)
- //{
- $vats = \App\Models\Vat::select('id', 'name', 'value')->orderBy('value')->get();
- if ($i > 0)
- {
- $iv = 0;
- foreach($vats as $vv)
- {
- if ($vv->id == $i)
- {
- $iv = $vv->value;
- break;
- }
- }
- if ($iv > 0)
- $vat = $v / 100 * $iv;
- }
- //}
- return $vat;
- }
- function mysqlToDate($dt)
- {
- list($date, $hour) = explode(" ", $dt);
- list($year, $month, $day) = explode("-", $date);
- return $day . "/" . $month . "/" . $year;
- }
- function currencyToDouble($val)
- {
- $x = str_replace("€", "", $val);
- $x = str_replace(".", "", $x);
- $x = str_replace(",", ".", $x);
- return floatval(trim($x));
- }
- function getConfiguration($field)
- {
- $ret = "";
- $conf = \App\Models\Configurration::first();
- if ($conf)
- {
- $ret = $conf[$field];
- }
- return $ret;
- }
|