fix A/R report
[freeside.git] / httemplate / search / report_rt_ticket.html
1 <% include('/elements/header.html', 'Time worked summary report criteria' ) %>
2
3 <FORM ACTION="rt_ticket.html" METHOD="GET">
4
5 <TABLE>
6
7   <% include ( '/elements/tr-input-beginning_ending.html' ) %>
8
9   <& /elements/tr-select.html,
10       label       => 'Time category:',
11       field       => 'category',
12       options     => [ '', 'development', 'support' ],
13       option_labels => { '' => 'all' },
14       curr_value  => 'development',
15   &>
16
17   <% include ( '/elements/tr-select-otaker.html' ) %>
18
19   <TR>
20     <TD ALIGN="right">Account:</TD>
21     <TD>
22       <SELECT NAME="svcnum">
23         <OPTION VALUE="">(all)
24 %       foreach my $svc_acct (@svc_acct) {
25           <OPTION VALUE="<% $svc_acct->svcnum %>"><% $svc_acct->username %></OPTION>
26 %       }
27       </SELECT>
28     </TD>
29   </TR>
30
31 </TABLE>
32
33 <BR>
34 <INPUT TYPE="submit" VALUE="Search">
35
36 </FORM>
37
38 <% include('/elements/footer.html') %>
39 <%init>
40
41 die "access denied"
42   unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
43
44 my $conf = new FS::Conf;
45
46 my @pkgparts = $conf->config('support_packages');
47
48 my @svc_acct = ();
49 if ( @pkgparts ) {
50   @svc_acct = qsearch({
51     'table'     => 'svc_acct',
52     'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
53                    ' LEFT JOIN cust_pkg USING ( pkgnum ) ',
54     'extra_sql' => 'WHERE pkgpart IN ('. join(',', @pkgparts). ')',
55     'order_by'  => 'ORDER BY username',
56   });
57 }
58
59 # get a list of TimeValue-type custom fields
60 my $CurrentUser = RT::CurrentUser->new();
61 $CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username);
62 die "RT not configured" unless $CurrentUser->id;
63 my $CFs = RT::CustomFields->new($CurrentUser);
64
65 $CFs->Limit(FIELD => 'LookupType',
66             OPERATOR => 'ENDSWITH',
67             VALUE => 'RT::Transaction');
68
69 $CFs->Limit(FIELD => 'Type',
70             VALUE => 'TimeValue');
71
72 </%init>