formatCurrency() public static method

Format a currency or an array of currencies accordingly.
public static formatCurrency ( integer | array $number, boolean $htmlNoWrap = true ) : integer | array | string
$number integer | array one value or an array of decimal numbers
$htmlNoWrap boolean
return integer | array | string formatted string(s)
Beispiel #1
0
 /**
  * Format a number as a money value.
  *
  * @param int $number amount of money
  * @return string formatted string
  */
 public function money($number)
 {
     return Kimai_Format::formatCurrency($number, false);
 }
Beispiel #2
0
     if (isset($kga['customer'])) {
         $filterCustomers = array($kga['customer']['customerID']);
     }
     $view->assign('expenses', get_expenses($in, $out, $filterUsers, $filterCustomers, $filterProjects, 1));
     $view->assign('total', Kimai_Format::formatCurrency(array_reduce($view->expenses, function ($sum, $expense) {
         return $sum + $expense['multiplier'] * $expense['value'];
     }, 0)));
     $ann = expenses_by_user($in, $out, $filterUsers, $filterCustomers, $filterProjects);
     $ann = Kimai_Format::formatCurrency($ann);
     $view->assign('user_annotations', $ann);
     // TODO: function for loops or convert it in template with new function
     $ann = expenses_by_customer($in, $out, $filterUsers, $filterCustomers, $filterProjects);
     $ann = Kimai_Format::formatCurrency($ann);
     $view->assign('customer_annotations', $ann);
     $ann = expenses_by_project($in, $out, $filterUsers, $filterCustomers, $filterProjects);
     $ann = Kimai_Format::formatCurrency($ann);
     $view->assign('project_annotations', $ann);
     $view->assign('activity_annotations', array());
     if (isset($kga['user'])) {
         $view->assign('hideComments', !$kga->getSettings()->isShowComments());
     } else {
         $view->assign('hideComments', true);
     }
     echo $view->render("expenses.php");
     break;
     // =======================================
     // = Erase expense entry via quickdelete =
     // =======================================
 // =======================================
 // = Erase expense entry via quickdelete =
 // =======================================
Beispiel #3
0
 // ==============================================
 // = Get all rates for the project and activity =
 // ==============================================
 case 'allFittingFixedRates':
     $data = array('errors' => array());
     if (!isset($kga['user'])) {
         $data['errors'][] = $kga['lang']['editLimitError'];
     }
     if (!$database->global_role_allows($kga['user']['globalRoleID'], 'ki_timesheets-showRates')) {
         $data['errors'][] = $kga['lang']['editLimitError'];
     }
     if (count($data['errors']) == 0) {
         $rates = $database->allFittingFixedRates($_REQUEST['project'], $_REQUEST['activity']);
         if ($rates !== false) {
             foreach ($rates as $rate) {
                 $line = Kimai_Format::formatCurrency($rate['rate']);
                 $setFor = array();
                 // contains the list of "types" for which this rate was set
                 if ($rate['projectID'] != null) {
                     $setFor[] = $kga['lang']['project'];
                 }
                 if ($rate['activityID'] != null) {
                     $setFor[] = $kga['lang']['activity'];
                 }
                 if (count($setFor) != 0) {
                     $line .= ' (' . implode($setFor, ', ') . ')';
                 }
                 $data['rates'][] = array('value' => $rate['rate'], 'desc' => $line);
             }
         }
     }