1 <& /elements/header.html, 'Exchange rates' &>
3 <FORM METHOD="POST" ACTION="process/currency_exchange.html">
5 <& /elements/table-grid.html &>
6 % my $bgcolor1 = '#eeeeee';
7 % my $bgcolor2 = '#ffffff';
11 <TH CLASS="grid" BGCOLOR="#cccccc">From</TH>
12 <TH CLASS="grid" BGCOLOR="#cccccc">Rate</TH>
13 <TH CLASS="grid" BGCOLOR="#cccccc">To</TH>
16 %foreach my $currency (@currencies) {
18 % if ( $bgcolor eq $bgcolor1 ) {
19 % $bgcolor = $bgcolor2;
21 % $bgcolor = $bgcolor1;
24 % my %hash = ( 'from_currency' => $currency,
25 % 'to_currency' => $to_currency,
28 % my $currency_exchange = qsearchs('currency_exchange', \%hash)
29 % || new FS::currency_exchange \%hash;
31 % $currency_exchange->rate('1.000000') if length($currency_exchange->rate) == 0;
35 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
36 <% $currency %>: <% code2currency($currency) %>
39 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="right">
41 NAME = "<% "$currency-$to_currency" %>"
42 VALUE = "<% $currency_exchange->rate %>"
48 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
49 <% $to_currency %>: <% code2currency($to_currency) %>
58 <INPUT TYPE="submit" VALUE="Update rates">
61 <& /elements/footer.html &>
65 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
67 my $conf = new FS::Conf;
69 my $to_currency = $conf->config('currency') || 'USD';
71 my @currencies = sort { $a cmp $b } $conf->config('currencies');