Пример #1
0
 function display()
 {
     global $mod_strings, $app_list_strings;
     $this->displayPopupHtml();
     // Contract Value:
     $html = '
             <table cellpadding="0" cellspacing="0" border="1" width="100%" style="border-collapse:collapse" class="table_clone" id="contract_value">
                 <thead>
                     <tr bgcolor="#CCCCCC">
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_SERVICE'] . '</th>
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_SOLUONG'] . '</th> 
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_GIATOUR'] . '</th>
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_THUE'] . '</th>
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_THANHTIEN'] . '</th>
                         <th align="center">&nbsp;</th>
                     </tr>
                 </thead>
                 <tbody>
         ';
     $html .= $this->bean->get_contract_values_detailview();
     $html .= '</tbody>
                     </table>';
     $this->dv->ss->assign("contract_value", $html);
     // Contract Condition:
     $html = '
               <table cellpadding="0" cellspacing="0" border="0" width="100%" class="table_clone" id="contract_condition">
                     <tbody>
         ';
     $html .= $this->bean->get_contract_condition_detailview();
     $html .= '</tbody>
                     </table>';
     $this->dv->ss->assign("contract_condition", $html);
     $this->dv->ss->assign("tongtien", format_number($this->bean->tongtien));
     parent::display();
 }
Пример #2
0
function print_states($tracker)
{
    global $rulescnt;
    $rulesid = "";
    $bytes = 0;
    $states = 0;
    $packets = 0;
    $evaluations = 0;
    $stcreations = 0;
    $rules = get_pf_rules($rulescnt, $tracker);
    if (is_array($rules)) {
        foreach ($rules as $rule) {
            $bytes += $rule['bytes'];
            $states += $rule['states'];
            $packets += $rule['packets'];
            $evaluations += $rule['evaluations'];
            $stcreations += $rule['state creations'];
            if (strlen($rulesid) > 0) {
                $rulesid .= ",";
            }
            $rulesid .= "{$rule['id']}";
        }
    }
    printf("<a href=\"diag_dump_states.php?ruleid=%s\" data-toggle=\"popover\" data-trigger=\"hover focus\" title=\"%s\" ", $rulesid, gettext("States details"));
    printf("data-content=\"evaluations: %s<br>packets: %s<br>bytes: %s<br>states: %s<br>state creations: %s\" data-html=\"true\">", format_number($evaluations), format_number($packets), format_bytes($bytes), format_number($states), format_number($stcreations));
    printf("%d/%s</a><br>", format_number($states), format_bytes($bytes));
}
 /**
  * @see DashletGenericChart::display()
  */
 public function display()
 {
     global $current_user, $sugar_config;
     require_once 'include/SugarCharts/SugarChartFactory.php';
     $sugarChart = SugarChartFactory::getInstance();
     $sugarChart->base_url = array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search');
     //fixing bug #27097: The opportunity list is not correct after drill-down
     //should send to url additional params: start range value and end range value
     $sugarChart->url_params = array('start_range_date_closed' => $this->pbss_date_start, 'end_range_date_closed' => $this->pbss_date_end);
     $sugarChart->group_by = $this->constructGroupBy();
     $sugarChart->setData($this->getChartData($this->constructQuery()));
     $sugarChart->is_currency = true;
     $sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
     $currency_symbol = $sugar_config['default_currency_symbol'];
     if ($current_user->getPreference('currency')) {
         $currency = BeanFactory::getBean('Currencies', $current_user->getPreference('currency'));
         $currency_symbol = $currency->symbol;
     }
     $subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
     $pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . format_number($sugarChart->getTotal(), 0, 0, array('convert' => true)) . $sugarChart->thousands_symbol;
     if ($this->pbss_chart_type == 'hbar') {
         $sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
     } else {
         $sugarChart->setProperties($pipeline_total_string, $subtitle, 'funnel chart 3D');
     }
     $xmlFile = $sugarChart->getXMLFileName($this->id);
     $sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
     return $this->getTitle('') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
 }
Пример #4
0
function calculate_percentage_change($original_value, $new_value)
{
    if ($original_value == 0) {
        return 'undefined';
    }
    return format_number(($new_value - $original_value) / $original_value * 100) . '%';
}
 function &displayList($layout_def)
 {
     //                $global_currency_obj = get_currency();
     $display = format_number($this->displayListPlain($layout_def), 2, 2, array('convert' => true, 'currency_symbol' => true));
     //                $display =  $global_currency_obj->symbol. round($global_currency_obj->convertFromDollar($this->displayListPlain($layout_def)),2);
     return $display;
 }
function help_status()
{
    global $smarty;
    $db_query = "\n\t\t\tSELECT \n\t\t\t\t`round_id`, \n\t\t\t\t`round_engine`, \n\t\t\t\t`name`, \n\t\t\t\t`description`, \n\t\t\t\t`starttime`, \n\t\t\t\t`stoptime`, \n\t\t\t\t`starsystems`, \n\t\t\t\t`planets`, \n\t\t\t\t`resistance`, \n\t\t\t\t`speed`, \n\t\t\t\t`resourcetick`, \n\t\t\t\t`combattick` \n\t\t\tFROM `rounds` \n\t\t\tWHERE `round_id` = '" . $_SESSION['round_id'] . "' \n\t\t\tLIMIT 1";
    $db_result = mysql_query($db_query);
    $round = mysql_fetch_array($db_result, MYSQL_ASSOC);
    $round['speed'] /= 1000;
    // Dynamic attack limit based on elapsed time of current round
    $end_time = 3456000 * $_SESSION['round_speed'];
    $current_time = microfloat() - $round['starttime'];
    $attack_limit = 1 - $current_time / $end_time;
    if ($attack_limit < 0) {
        $attack_limit = 0;
    }
    $round['attack_limit'] = round($attack_limit * 100, 2);
    $round['description'] = nl2br($round['description']);
    $round['starttime'] = format_timestamp($round['starttime']);
    $round['stoptime'] = format_timestamp($round['stoptime']);
    $round['resistance'] = format_number($round['resistance']);
    $round['resourcetick'] = format_time(timeparser($round['resourcetick'] / 1000));
    $round['combattick'] = format_time(timeparser($round['combattick'] / 1000));
    $smarty->assign('round', $round);
    $smarty->display('help_status.tpl');
    exit;
}
Пример #7
0
 public function jquery_item_data()
 {
     /* This function is only used to send JSON data back to a jquery function */
     $params = array('where' => array('mcb_inventory.inventory_id' => $this->input->post('inventory_id')));
     $item = $this->mdl_inventory->get($params);
     $array = array('item_name' => $item->inventory_name, 'item_cost' => format_number($item->inventory_unit_price, FALSE), 'item_description' => $item->inventory_description, 'tax_rate_id' => $item->tax_rate_id);
     echo json_encode($array);
 }
 function displayListPlain($layout_def)
 {
     //Bug40995
     if ($layout_def['precision'] != '') {
         return format_number(parent::displayListPlain($layout_def), $layout_def['precision'], $layout_def['precision']);
     } else {
         return format_number(parent::displayListPlain($layout_def), 2, 2);
     }
 }
Пример #9
0
 /**
  * format the currency field based on system locale values for currency
  * Note that this may be different from the precision specified in the vardefs.
  * @param string $rawfield value of the field
  * @param string $somewhere vardef for the field being processed
  * @return number formatted according to currency settings
  */
 public function formatField($rawField, $vardef)
 {
     // for currency fields, use the user or system precision, not the precision in the vardef
     //this is achived by passing in $precision as null
     $precision = null;
     if ($rawField === '' || $rawField === NULL) {
         return '';
     }
     return format_number($rawField, $precision, $precision);
 }
Пример #10
0
function format_file_size($size)
{
    $b = -1;
    $units = array("kB", "MB", "GB", "TB", "PB", "EB");
    do {
        $size = $size / 1024;
        $b++;
    } while ($size > 99);
    return format_number(floor($size * 100) / 100, 2) . $units[$b];
}
Пример #11
0
 public function formatField($rawField, $vardef)
 {
     if (!empty($vardef['disable_num_format'])) {
         return $rawField;
     }
     if ($rawField === '' || $rawField === NULL) {
         return '';
     }
     return format_number($rawField, 0, 0);
 }
Пример #12
0
 public function data()
 {
     $access = strtolower($this->module . '.' . __CLASS__ . '.' . __FUNCTION__);
     $this->permission->check_permission($access);
     $data['count'] = format_number($this->mp->count_data());
     $data['sidebar_active'] = 'keuangan';
     $data['title'] = 'Keuangan - Data Kasbon';
     $data['content'] = $this->load->view('/data_kasbon', $data, TRUE);
     $this->load->view('template', $data);
 }
Пример #13
0
 function displayList($layout_def)
 {
     $vardef = $this->getVardef($layout_def);
     if (isset($vardef['precision'])) {
         $precision = $vardef['precision'];
     } else {
         $precision = null;
     }
     return format_number(parent::displayListPlain($layout_def), $precision, $precision);
 }
Пример #14
0
function display_currency($amount, $standardize_number = TRUE)
{
    global $CI;
    $amount = format_number($amount, $standardize_number);
    if ($CI->mdl_mcb_data->setting('currency_symbol_placement') == 'before') {
        $amount = $CI->mdl_mcb_data->setting('currency_symbol') . ' ' . $amount;
    } else {
        $amount = $amount . ' ' . $CI->mdl_mcb_data->setting('currency_symbol');
    }
    return $amount;
}
Пример #15
0
 public function testFormatNumber()
 {
     $this->assertSame('100', format_number(100));
     $this->assertSame('1.000', format_number(1000));
     $this->assertSame('3.000.000', format_number(3000000));
     $this->assertSame('10', format_number(10.3));
     $this->assertSame('10,34', format_number(10.34234, 2));
     $this->assertSame('13.340,34', format_number(13340.34234, 2));
     $this->assertSame('123.456.789,3456', format_number(123456789.3456, 4));
     $this->assertSame('123,456,789.3456', format_number(123456789.3456, 4, '.', ','));
 }
Пример #16
0
/**
 * Function untuk menampilkan data harga
 *
 * @param  int $harga  Harga asli
 * @param  int $diskon Harga diskon
 * @return string
 */
function shopHarga($harga, $diskon)
{
    $out = '';
    if ($diskon) {
        $out .= '<del>Rp. ' . format_number($harga) . '</del>';
        $out .= '<span>Rp. ' . format_number($diskon) . '</span>';
    } else {
        $out .= '<span>Rp. ' . format_number($harga) . '</span>';
    }
    return '<div class="price">' . $out . '</div>';
}
Пример #17
0
 public function tambah()
 {
     // $access = strtolower($this->module.'.'.__class__.'.'.__function__);
     // $this->permission->check_permission($access);
     $data['opt_supplier'] = $this->mp->opt_supplier();
     $data['count'] = format_number($this->mp->count_total());
     $data['sidebar_active'] = 'stok_bahan';
     $data['title'] = 'stok_bahan - Distribusi';
     $data['content'] = $this->load->view('/tambah_distribusi', $data, TRUE);
     $this->load->view('template', $data);
 }
Пример #18
0
 public function tambah()
 {
     $access = strtolower($this->module . '.' . __CLASS__ . '.' . __FUNCTION__);
     $this->permission->check_permission($access);
     $data['opt_supplier'] = $this->mp->opt_supplier();
     $data['count'] = format_number($this->mp->count_total());
     $data['sidebar_active'] = 'gudang';
     $data['title'] = 'Gudang - Retur Suplier';
     // $data['suplier'] = $this->mm->get_suplier();
     $data['content'] = $this->load->view('/tambah_retur', $data, TRUE);
     $this->load->view('template', $data);
 }
Пример #19
0
 public function formatField($rawField, $vardef)
 {
     // A null precision uses the user prefs / system prefs by default
     $precision = null;
     if (isset($vardef['precision'])) {
         $precision = $vardef['precision'];
     }
     if ($rawField === '' || $rawField === NULL) {
         return '';
     }
     return format_number($rawField, $precision, $precision);
 }
Пример #20
0
 public function tambah()
 {
     // $access = strtolower($this->module.'.'.__class__.'.'.__function__);
     // $this->permission->check_permission($access);
     // $data['opt_supplier'] = $this->mp->opt_supplier();
     $data['count'] = format_number($this->mp->count_total());
     $data['sidebar_active'] = 'stok_produk';
     $data['title'] = 'stok_produk - Retur Internal';
     // $data['suplier'] = $this->mm->get_suplier();
     $data['content'] = $this->load->view('/tambah_retur_internal', $data, TRUE);
     $this->load->view('template', $data);
 }
Пример #21
0
 function displayList($layout_def)
 {
     $rawField = parent::displayList($layout_def);
     $vardef = $this->reporter->all_fields[$layout_def['column_key']];
     if ($layout_def['type'] !== 'int' || !empty($vardef['disable_num_format'])) {
         return $rawField;
     }
     if ($rawField === '' || $rawField === null) {
         return '';
     }
     return format_number($rawField, 0, 0);
 }
Пример #22
0
 public function detail()
 {
     // $access = strtolower($this->module.'.'.__class__.'.'.__function__);
     // $this->permission->check_permission($access);
     $id = $this->uri->segment(4);
     $data['count'] = format_number($this->msp->count_data());
     if (!empty($id)) {
         $data['suplier'] = $this->msp->get_suplier($id);
         $data['suplier'] = $data['suplier'][0];
     }
     $data['sidebar_active'] = 'master';
     $data['title'] = 'Master - Detail Suplier';
     $data['content'] = $this->load->view('/detail_suplier', $data, TRUE);
     $this->load->view('template', $data);
 }
/**
 * Smarty {sugar_currency_format} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_currency_format<br>
 * Purpose:  formats a number
 * 
 * @author Wayne Pan {wayne at sugarcrm.com}
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_number_format($params, &$smarty)
{
    global $locale;
    if (!isset($params['var']) || $params['var'] === '') {
        return '';
    }
    if (!isset($params['precision'])) {
        $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits');
    }
    $_contents = format_number($params['var'], $params['precision'], $params['precision'], $params);
    if (!empty($params['assign'])) {
        $smarty->assign($params['assign'], $_contents);
    } else {
        return $_contents;
    }
}
Пример #24
0
 public function testFormatNumber()
 {
     global $current_user;
     $testValue = "100000.50";
     $formattedValue = format_number($testValue);
     $this->assertEquals($formattedValue, "100,000.50", "Assert that 100000.50 becomes 100,000.50. Formatted value is: " . $formattedValue);
     //Switch the num_grp_sep and dec_sep values
     $current_user->setPreference('num_grp_sep', '.');
     $current_user->setPreference('dec_sep', ',');
     $current_user->save();
     //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
     get_number_seperators(true);
     $testValue = "100000.50";
     $formattedValue = format_number($testValue);
     $this->assertEquals($formattedValue, "100.000,50", "Assert that 100000.50 becomes 100.000,50. Formatted value is: " . $formattedValue);
 }
Пример #25
0
/** Translate string
* @param string
* @param int
* @return string
*/
function lang($idf, $number = null)
{
    global $LANG, $translations;
    $translation = $translations[$idf] ? $translations[$idf] : $idf;
    if (is_array($translation)) {
        $pos = 1;
        $translation = $translation[$pos];
    }
    $args = func_get_args();
    array_shift($args);
    $format = str_replace("%d", "%s", $translation);
    if ($format != $translation) {
        $args[0] = format_number($number);
    }
    return vsprintf($format, $args);
}
Пример #26
0
/** Translate string
* @param string
* @param int
* @return string
*/
function lang($idf, $number = null)
{
    global $LANG, $translations;
    $translation = $translations[$idf] ? $translations[$idf] : $idf;
    if (is_array($translation)) {
        $pos = $number == 1 ? 0 : ($LANG == 'cs' || $LANG == 'sk' ? $number && $number < 5 ? 1 : 2 : ($LANG == 'fr' ? !$number ? 0 : 1 : ($LANG == 'pl' ? $number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2 : ($LANG == 'sl' ? $number % 100 == 1 ? 0 : ($number % 100 == 2 ? 1 : ($number % 100 == 3 || $number % 100 == 4 ? 2 : 3)) : ($LANG == 'lt' ? $number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number / 10 % 10 != 1 ? 1 : 2) : ($LANG == 'ru' || $LANG == 'sr' || $LANG == 'uk' ? $number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2) : 1))))));
        // http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
        $translation = $translation[$pos];
    }
    $args = func_get_args();
    array_shift($args);
    $format = str_replace("%d", "%s", $translation);
    if ($format != $translation) {
        $args[0] = format_number($number);
    }
    return vsprintf($format, $args);
}
Пример #27
0
 public function tambah()
 {
     $access = strtolower($this->module . '.' . __CLASS__ . '.' . __FUNCTION__);
     $this->permission->check_permission($access);
     $id = $this->uri->segment(4);
     $data['count'] = format_number($this->mp->count_data());
     if (!empty($id)) {
         $data['paramedik'] = $this->mp->get_paramedik($id);
         $data['paramedik'] = $data['paramedik'][0];
     } else {
         $str = $this->gen_code();
         $data['paramedik'] = (object) array('code' => $str['code'], 'no_urut' => $str['no']);
     }
     $data['sidebar_active'] = 'master';
     $data['title'] = 'Master - Tambah Karyawan';
     $data['content'] = $this->load->view('/input_karyawan', $data, TRUE);
     $this->load->view('template', $data);
 }
Пример #28
0
 function pushFeed($bean, $event, $arguments)
 {
     $text = '';
     if (empty($bean->fetched_row)) {
         $currency = new Currency();
         $currency->retrieve($bean->currency_id);
         $text = '{SugarFeed.CREATED_OPPORTUNITY} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name . '] {SugarFeed.WITH} [Accounts:' . $bean->account_id . ':' . $bean->account_name . '] {SugarFeed.FOR} ' . $currency->symbol . format_number($bean->amount);
     } else {
         if (!empty($bean->fetched_row['sales_stage']) && $bean->fetched_row['sales_stage'] != $bean->sales_stage && $bean->sales_stage == 'Closed Won') {
             $currency = new Currency();
             $currency->retrieve($bean->currency_id);
             $text = '{SugarFeed.WON_OPPORTUNITY} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name . '] {SugarFeed.WITH} [Accounts:' . $bean->account_id . ':' . $bean->account_name . '] {SugarFeed.FOR} ' . $currency->symbol . format_number($bean->amount);
         }
     }
     if (!empty($text)) {
         SugarFeed::pushFeed2($text, $bean);
     }
 }
Пример #29
0
function ByteSize($bytes)
{
    $size = $bytes / 1024;
    if ($size < 1024) {
        $size = format_number(number_format($size, 2), 'es_ES');
        $size .= ' KB';
    } else {
        if ($size / 1024 < 1024) {
            $size = format_number(number_format($size / 1024, 2), 'es_ES');
            $size .= ' MB';
        } else {
            if ($size / 1024 / 1024 < 1024) {
                $size = format_number(number_format($size / 1024 / 1024, 2), 'es_ES');
                $size .= ' GB';
            }
        }
    }
    return $size;
}
Пример #30
0
 function display()
 {
     $this->populateTemplates();
     $this->setDecodeHTML();
     $this->displayPopupHtml();
     global $db, $mod_strings;
     // Contract Value :
     $sql = "select * from contractappendixvalues where contract_appendixs_value_id = '" . $this->bean->id . "' and deleted = 0";
     $result = $db->query($sql);
     $html = "";
     $html .= '<table cellpadding="0" cellspacing="0" border="1" width="100%" style="border-collapse:collapse" class="table_clone" id="giatrihopdong" maxcount="50">';
     $html .= '<tr bgcolor="#CCCCCC">
                         <th align="center">' . $mod_strings['LBL_DICHVU'] . '</th>
                         <th align="center">' . $mod_strings['LBL_SOLUONG'] . '</th>
                         <th align="center">' . $mod_strings['LBL_DONGIA'] . '</th>
                         <th align="center">' . $mod_strings['LBL_THUE'] . '</th>
                         <th align="center">' . $mod_strings['LBL_THANHTIEN'] . '</th>
                         <th align="center">&nbsp;</th>
                     </tr>';
     while ($row = $db->fetchByAssoc($result)) {
         $html .= '<tr>';
         $html .= '<td  style="text-align:center"> ';
         $html .= $row['service'];
         $html .= '</td>';
         $html .= '<td style="text-align:center">';
         $html .= $row['num_of_service'];
         $html .= '</td> ';
         $html .= '<td style="text-align:center">';
         $html .= format_number($row['unit']);
         $html .= '</td>';
         $html .= '<td style="text-align:center">';
         $html .= format_number($row['tax']);
         $html .= '</td>';
         $html .= '<td style="text-align:center">';
         $html .= format_number($row['amount']);
         $html .= '</td>';
         $html .= '</td>';
         $html .= '</tr> ';
     }
     $html .= '</table> ';
     $this->dv->ss->assign("contract_value", $html);
     parent::display();
 }