show imported region and rate #s, RT#83146
[freeside.git] / httemplate / edit / prepay_credit.cgi
1 <% include("/elements/header.html",'Generate prepaid cards'. ($agent ? ' for '. $agent->agent : '') ) %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM ACTION="<%popurl(1)%>process/prepay_credit.cgi" METHOD="POST" NAME="OneTrueForm" onSubmit="document.OneTrueForm.submit.disabled=true">
6
7 Generate
8 <INPUT TYPE="text" NAME="num" VALUE="<% $cgi->param('num') || '(quantity)' |h %>" SIZE=10 MAXLENGTH=10 onFocus="if ( this.value == '(quantity)' ) { this.value = ''; }">
9
10 prepaid cards of
11
12 <INPUT TYPE="text" NAME="length" SIZE=3 MAXLENGTH=2 VALUE=8>&nbsp;
13 <SELECT NAME="type">
14 % foreach (qw(alpha alphanumeric numeric)) { 
15   <OPTION<% $cgi->param('type') eq $_ ? ' SELECTED' : '' %>><% $_ %>
16 % } 
17 </SELECT>
18
19 characters each
20
21 <BR>for 
22
23 <& /elements/select-agent.html,
24      'empty_label' => '(any agent)',
25      'curr_value'  => $agentnum,
26 &>
27
28 <TABLE>
29 <TR><TD>Value: 
30 $<INPUT TYPE="text" NAME="amount" SIZE=8 MAXLENGTH=7 VALUE="<% $cgi->param('amount') |h %>">
31 </TD>
32 <TD>and/or
33 <INPUT TYPE="text" NAME="seconds" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('seconds') |h %>">
34 <SELECT NAME="multiplier">
35 % foreach my $multiplier ( keys %multiplier ) { 
36
37   <OPTION VALUE="<% $multiplier %>"<% $cgi->param('multiplier') eq $multiplier ? ' SELECTED' : '' %>><% $multiplier{$multiplier} %>
38 % } 
39
40 </SELECT>
41 </TD></TR>
42 <TR><TD></TD>
43 <TD>and/or
44 <INPUT TYPE="text" NAME="upbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('upbytes') |h %>">
45 <SELECT NAME="upmultiplier">
46 % foreach my $multiplier ( keys %bytemultiplier ) { 
47
48   <OPTION VALUE="<% $multiplier %>"<% $cgi->param('upmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
49 % } 
50
51 </SELECT> upload
52 </TD></TR>
53 <TR><TD></TD>
54 <TD>and/or
55 <INPUT TYPE="text" NAME="downbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('downbytes') |h %>">
56 <SELECT NAME="downmultiplier">
57 % foreach my $multiplier ( keys %bytemultiplier ) { 
58
59   <OPTION VALUE="<% $multiplier %>"<% $cgi->param('downmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
60 % } 
61
62 </SELECT> download
63 </TD></TR>
64 <TR><TD></TD>
65 <TD>and/or
66 <INPUT TYPE="text" NAME="totalbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('totalbytes') |h %>">
67 <SELECT NAME="totalmultiplier">
68 % foreach my $multiplier ( keys %bytemultiplier ) { 
69
70   <OPTION VALUE="<% $multiplier %>"<% $cgi->param('totalmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
71 % } 
72
73 </SELECT> total transfer
74 </TD></TR>
75 </TABLE>
76 <BR><BR>
77 <INPUT TYPE="submit" NAME="submit" VALUE="Generate" onSubmit="this.disabled = true">
78
79 </FORM>
80
81 <% include('/elements/footer.html') %>
82
83 <%init>
84
85 die "access denied"
86   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
87
88 my $agent = '';
89 my $agentnum = '';
90 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
91   $agent = qsearchs('agent', { 'agentnum' => $agentnum=$1 } );
92 }
93
94 tie my %multiplier, 'Tie::IxHash',
95   1    => 'seconds',
96   60   => 'minutes',
97   3600 => 'hours',
98 ;
99
100 tie my %bytemultiplier, 'Tie::IxHash',
101   1          => 'bytes',
102   1024       => 'Kbytes',
103   1048576    => 'Mbytes',
104   1073741824 => 'Gbytes',
105 ;
106
107 $cgi->param('multiplier',     '60')      unless $cgi->param('multiplier');
108 $cgi->param('upmultiplier',   '1048576') unless $cgi->param('upmultiplier');
109 $cgi->param('downmultiplier', '1048576') unless $cgi->param('downmultiplier');
110 $cgi->param('totalmultiplier','1048576') unless $cgi->param('totalmultiplier');
111
112 </%init>