예제 #1
0
function format_price($price_string, $price_special, $currency, $allow_tax, $tax_rate)
{
    // calculate currencies
    $currencies_query = vam_db_query("SELECT\r\n\t                                          symbol_left,\r\n\t                                          symbol_right,\r\n\t                                          decimal_places,\r\n\t                                          value\r\n\t                                      FROM\r\n\t                                          " . TABLE_CURRENCIES . "\r\n\t                                      WHERE\r\n\t                                          code = '" . $currency . "'");
    $currencies_value = vam_db_fetch_array($currencies_query);
    $currencies_data = array();
    $currencies_data = array('SYMBOL_LEFT' => $currencies_value['symbol_left'], 'SYMBOL_RIGHT' => $currencies_value['symbol_right'], 'DECIMAL_PLACES' => $currencies_value['decimal_places'], 'VALUE' => $currencies_value['value']);
    // round price
    if ($allow_tax == 1) {
        $price_string = $price_string / ((100 + $tax_rate) / 100);
    }
    $price_string = precision($price_string, $currencies_data['DECIMAL_PLACES']);
    if ($price_special == '1') {
        $price_string = $currencies_data['SYMBOL_LEFT'] . ' ' . $price_string . ' ' . $currencies_data['SYMBOL_RIGHT'];
    }
    return $price_string;
}
예제 #2
0
function mfs($testingfile, $solutionfile, $predictionstart, $predictionend, $set)
{
    $testlines = file($testingfile);
    $solutionlines = file($solutionfile);
    $p = precision($testinglines, $solutionlines, $predictionstart, $predictionend, $set);
    $r = recall($testinglines, $solutionlines, $predictionstart, $predictionend, $set);
    return 2 * ($p * $r) / ($p + $r);
}