Ejemplo n.º 1
0
?>

<html>
<head>
<title>Currency Converter - PEAR::Services_ExchangeRates Example</title>
</head>
<body>

<h1>Currency Converter</h1>

<?php 
if (!empty($_POST['amount'])) {
    echo "<h1>";
    echo $conv->format($_POST['amount']) . ' ' . $_POST['from'];
    echo " = ";
    echo $conv->convert($_POST['from'], $_POST['to'], $_POST['amount']) . ' ' . $_POST['to'];
    echo "</h1>";
} else {
    echo "<h1>Enter how much you want to convert!</h1>";
}
$options = array();
foreach ($conv->validCurrencies as $code => $label) {
    $options .= '<option value="' . $code . '">' . $label . '</option>';
}
?>

<h2>I want to convert...</h2>
<form method="POST" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
Ejemplo n.º 2
0
        if ($invoices[$k]->sent_on < $ninety) {
            $invoices[$k]->range = 90;
        } elseif ($invoices[$k]->sent_on < $sixty) {
            $invoices[$k]->range = 60;
        } elseif ($invoices[$k]->sent_on < $forty_five) {
            $invoices[$k]->range = 45;
        } elseif ($invoices[$k]->sent_on < $thirty) {
            $invoices[$k]->range = 30;
        } else {
            $invoices[$k]->range = 0;
        }
        if ($invoices[$k]->currency != $dc) {
            //$invoices[$k]->e_subtotal = $invoices[$k]->subtotal;
            //$invoices[$k]->e_taxes = $invoices[$k]->taxes;
            $invoices[$k]->e_total = number_format($invoices[$k]->total, 2);
            $invoices[$k]->subtotal = $exch->convert($invoices[$k]->currency, $dc, $invoices[$k]->subtotal, false);
            $invoices[$k]->taxes = $exch->convert($invoices[$k]->currency, $dc, $invoices[$k]->taxes, false);
            $invoices[$k]->total = $exch->convert($invoices[$k]->currency, $dc, $invoices[$k]->total, false);
        } else {
            //$invoices[$k]->e_subtotal = false;
            //$invoices[$k]->e_taxes = false;
            $invoices[$k]->e_total = false;
        }
        $subtotal += $invoices[$k]->subtotal;
        $taxes += $invoices[$k]->taxes;
        $total += $invoices[$k]->total;
        $invoices[$k]->subtotal = number_format($invoices[$k]->subtotal, 2);
        $invoices[$k]->taxes = number_format($invoices[$k]->taxes, 2);
        $invoices[$k]->total = number_format($invoices[$k]->total, 2);
    }
} else {