sales report: filter/breakdown by package report class, #24002
[freeside.git] / httemplate / graph / report_cust_bill_pkg.html
1 <% include('/elements/header.html', 'Sales Report' ) %>
2
3 <FORM ACTION="cust_bill_pkg.cgi" METHOD="GET">
4
5 <TABLE>
6
7 <% include('/elements/tr-select-from_to.html' ) %>
8
9 <TR>
10   <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="projection" VALUE="1"></TD>
11   <TD>Show projected data for future months</TD>
12 </TR>
13
14 <SCRIPT TYPE="text/javascript">
15 function enable_agent_totals(obj) {
16 %# enable it iff we are breaking down by agent AND something else
17   obj.form.agent_totals.disabled = !(
18     obj.form.agentnum.value == '' && (
19       obj.form.refnum.value == ''   ||
20       obj.form.classnum.value == 0  ||
21       obj.form.use_setup.value == 1 ||
22       obj.form.use_usage.value == 1
23     )
24   );
25 }
26
27 function mode_changed() {
28   var options = document.getElementsByName('mode');
29   var mode;
30   for(var i=0; i < options.length; i++) {
31     if (options[i].checked) {
32       mode = options[i].value;
33     }
34   }
35     
36   var div_pkg = document.getElementById('pkg_class');
37   var div_report = document.getElementById('report_class');
38   if (mode == 'pkg') {
39     div_pkg.style.display = '';
40     div_report.style.display = 'none';
41   } else if (mode == 'report') {
42     div_pkg.style.display = 'none';
43     div_report.style.display = '';
44   }
45 }
46 window.onload = mode_changed;
47 </SCRIPT>
48
49 <& /elements/tr-select-agent.html,
50   'field'         => 'agentnum',
51   'label'         => 'Agent ',
52   'disable_empty' => 0,
53   'pre_options'   => [ 'all' => 'all (aggregate)' ],
54   'empty_label'   => 'all (breakdown)',
55   'onchange'      => 'enable_agent_totals',
56 &>
57
58 <& /elements/tr-select-cust_class.html,
59   'field'         => 'cust_classnum',
60   'label'         => 'Customer class',
61   'multiple'      => 1,
62 &>
63
64 <& /elements/tr-select-part_referral.html,
65   'field'         => 'refnum',
66   'label'         => 'Advertising source ',
67   'disable_empty' => 0,
68   'pre_options'   => [ 'all' => 'all (aggregate)' ],
69   'empty_label'   => 'all (breakdown)',
70   'onchange'      => 'enable_agent_totals'
71 &>
72
73 <TR>
74   <TD ALIGN="right">
75     <INPUT TYPE="radio" NAME="mode" VALUE="pkg" onchange="mode_changed('pkg')" CHECKED>
76     <% emt('Package class') %>
77     <BR>
78     <INPUT TYPE="radio" NAME="mode" VALUE="report" onchange="mode_changed('report')">
79     <% emt('Report class') %>
80   </TD>
81   <TD>
82     <DIV ID="pkg_class">
83     <& /elements/select-pkg_class.html,
84       'field'       => 'classnum',
85       'pre_options' => [ 'all'  => 'all (aggregate)',
86                             ''  => 'all (breakdown)',
87                            '0'  => '(empty class)' ],
88       'disable_empty' => 1,
89       'onchange'    => 'enable_agent_totals',
90     &>
91     </DIV>
92     <DIV ID="report_class" STYLE="display: none">
93     <& /elements/select-table.html,
94       'field'       => 'report_optionnum',
95       'table'       => 'part_pkg_report_option',
96       'name_col'    => 'name',
97       'value_col'   => 'num',
98       'pre_options' => [ 'all' => 'all (aggregate)',
99                             '' => 'all (breakdown)', 
100                            '0'  => '(empty class)' ],
101       'disable_empty' => 1,
102       'onchange'    => 'enable_agent_totals',
103     &>
104     </DIV>
105   </TD>
106 </TR>
107
108 <!--
109 <TR>
110   <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="separate_0freq" VALUE="1"></TD>
111   <TD>Separate one-time vs. recurring sales</TD>
112 </TR>
113 -->
114
115 % foreach ( qw(Setup Usage) ) {
116 <& /elements/tr-select.html,
117     'label'   => "$_ fees",
118     'field'   => 'use_'.lc($_),
119     'options' => [ 0, 1, 2 ],
120     'labels'  => { 0 => 'Combine', 1 => 'Separate', 2 => 'Do not show' },
121     'onchange'=> 'enable_agent_totals',
122 &>
123 % }
124
125 <TR>
126   <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="agent_totals" VALUE="1" DISABLED="1"></TD>
127   <TD>Show per-agent subtotals</TD>
128 </TR>
129
130 <TR>
131   <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="use_override" VALUE="1"></TD>
132   <TD>Separate sub-packages from parents</TD>
133 </TR>
134
135 <TR>
136   <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="average_per_cust_pkg" VALUE="1"></TD>
137   <TD>Average per customer package</TD>
138 </TR>
139
140 <TR>
141   <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="distribute" VALUE="1"></TD>
142   <TD>Distribute recurring fees over billing period</TD>
143 </TR>
144
145 </TABLE>
146
147 <BR><INPUT TYPE="submit" VALUE="Display">
148 </FORM>
149
150 <% include('/elements/footer.html') %>
151 <%init>
152
153 die "access denied"
154   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
155
156 </%init>