prepayment discounts rt#5318
[freeside.git] / fs_selfservice / FS-SelfService / cgi / myaccount.html
1 <%= $url = "$selfurl?session=$session_id;action="; ''; %>
2 <%= include('header', 'My Account') %>
3
4 Hello <%= $name %>!<BR><BR>
5 <%= $small_custview %>
6 <BR>
7 <%= if ( $access_pkgnum ) {
8       $OUT .= qq!Balance: <B>\$$balance</B><BR><BR>!;
9     }
10     '';
11 %>
12
13 <%= if ( $balance > 0 ) {
14   if (scalar(grep $_, @hide_payment_fields)) {
15     $OUT .= qq! <B><A HREF="${url}make_thirdparty_payment&payby_method=CC">Make a payment</A></B><BR><BR>!;
16   } else {
17     $OUT .= qq! <B><A HREF="${url}make_payment">Make a payment</A></B><BR>!;
18     foreach my $term ( sort { $b <=> $a } keys %discount_terms_hash ) {
19       my $saved = $discount_terms_hash{$term}->[1];
20       my $amount = $discount_terms_hash{$term}->[2];
21       my $savings = ( $amount + $saved > 0 )
22                     ? sprintf('%d', $saved / ( $amount + $saved ) * 100 ) : '0';
23       $OUT .= qq! <B><A HREF="${url}make_term_payment;discount_term=$term;amount=$amount">Save $savings\% by paying for $term months: $amount</A></B><BR>!;
24     }
25     $OUT .= qq! <BR>!;
26   }
27 } %>
28 <%=
29   if ( @open_invoices ) {
30     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
31             '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>';
32     my $link = qq!<A HREF="<%= $url %>myaccount!;
33     my $col1 = "ffffff";
34     my $col2 = "dddddd";
35     my $col = $col1;
36
37     foreach my $invoice ( @open_invoices ) {
38       my $td = qq!<TD BGCOLOR="#$col">!;
39       my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">';
40       $OUT .=
41         "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td</TD>".
42         "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>".
43         qq!<TD BGCOLOR="#$col" ALIGN="right">$a\$!. $invoice->{'owed'}.
44           '</A></TD>'.
45         '</TR>';
46       $col = $col eq $col1 ? $col2 : $col1;
47     }
48     $OUT .= '</TABLE><BR>';
49   } else {
50     $OUT .= 'You have no outstanding invoices.<BR><BR>';
51   }
52 %>
53
54 <%=
55   if ( @support_services ) {
56     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
57             '<TR><TH BGCOLOR="#ff6666" COLSPAN="3">Support Time Remaining</TH>'.
58             '</TR><TR><TH ALIGN="left">#</TH><TH>Package</TH>'.
59             '<TH>Time Remaining</TH></TR>';
60     my $col1 = "ffffff";
61     my $col2 = "dddddd";
62     my $col = $col1;
63
64     foreach my $support ( @support_services ) {
65       my $td = qq!<TD BGCOLOR="#$col">!;
66       my $a = qq!<A HREF="${url}view_support_details;svcnum=!.
67               $support->{'svcnum'}. '">';
68       $OUT .=
69         "<TR>$td$a". $support->{'pkgnum'}. "</A></TD>".
70         $td.$a. $support->{'pkg'}. "</A></TD>".
71         $td.$a. $support->{'time'}. "</A></TD>".
72         '</TR>';
73       $col = $col eq $col1 ? $col2 : $col1;
74     }
75     $OUT .= '</TABLE><BR>';
76   } else {
77     $OUT .= '';
78   }
79 %>
80
81 <%=
82   if ( @tickets ) {
83     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
84             '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Tickets</TH></TR>'.
85             '<TR><TH>#</TH><TH>Subject</TH><TH>Priority</TH><TH>Queue</TH>'.
86             '<TH>Status</TH></TR>';
87     my $col1 = "ffffff";
88     my $col2 = "dddddd";
89     my $col = $col1;
90
91     foreach my $ticket ( @tickets ) {
92       my $td = qq!<TD BGCOLOR="#$col">!;
93       $OUT .=
94         "<TR>$td". $ticket->{'id'}. "</TD>".
95         $td. $ticket->{'subject'}. "</TD>".
96         $td. ($ticket->{'content'} || $ticket->{'priority'}). "</TD>".
97         $td. $ticket->{'queue'}. "</TD>".
98         $td. $ticket->{'status'}. "</TD>".
99         '</TR>';
100       $col = $col eq $col1 ? $col2 : $col1;
101     }
102     $OUT .= '</TABLE>';
103   } else {
104     $OUT .= '';
105   }
106 %>
107
108 <%= include('footer') %>