1 <& /elements/header.html,
2 { title => 'Sales Report',
4 <SCRIPT TYPE="text/javascript" SRC="'. $p. 'elements/jquery.js"></SCRIPT>
5 <SCRIPT TYPE="text/javascript" SRC="'. $p. 'elements/spectrum.js"></SCRIPT>
6 <LINK REL="stylesheet" HREF="'. $p. 'elements/spectrum.css" />',
10 <FORM ACTION="cust_bill_pkg.cgi" METHOD="POST">
12 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
15 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Search options') |h %></FONT></TH>
18 <% include('/elements/tr-select-from_to.html' ) %>
21 <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="projection" VALUE="1"></TD>
22 <TD>Show projected data for future months</TD>
25 <SCRIPT TYPE="text/javascript">
27 function agent_changed(obj) {
29 if ( obj.value == '' ) { //breakdown, one color list per agent needed
30 document.getElementById('agent0-label').style.display = '';
31 % for ( 1 .. $#agents ) {
32 document.getElementById('agent<% $_ %>-colors').style.display = '';
34 } else { //aggregate, only one color list needed
35 document.getElementById('agent0-label').style.display = 'none';
36 % for ( 1 .. $#agents ) {
37 document.getElementById('agent<% $_ %>-colors').style.display = 'none';
41 enable_agent_totals(obj);
44 function enable_agent_totals(obj) {
45 %# enable it iff we are breaking down by agent AND something else
46 obj.form.agent_totals.disabled = !(
47 obj.form.agentnum.value == '' && (
48 obj.form.refnum.value == '' ||
49 document.getElementById('class_agg_break_breakdown').checked ||
50 obj.form.use_setup.value == 1 ||
51 obj.form.use_usage.value == 1
56 function class_mode_changed() {
57 var options = document.getElementsByName('class_mode');
59 for(var i=0; i < options.length; i++) {
60 if (options[i].checked) {
61 mode = options[i].value;
65 var div_pkg = document.getElementById('pkg_class');
66 var div_report = document.getElementById('report_class');
67 var span_exact = document.getElementById('exact_match');
69 div_pkg.style.display = '';
70 div_report.style.display = 'none';
71 span_exact.style.display = 'none';
72 } else if (mode == 'report') {
73 div_pkg.style.display = 'none';
74 div_report.style.display = '';
75 span_exact.style.display = '';
78 window.onload = class_mode_changed;
81 <& /elements/tr-select-agent.html,
82 'field' => 'agentnum',
85 'pre_options' => [ 'all' => 'all (aggregate)' ],
86 'empty_label' => 'all (breakdown)',
87 'onchange' => 'agent_changed',
90 <& /elements/tr-select-cust_class.html,
91 'field' => 'cust_classnum',
92 'label' => 'Customer class',
96 <& /elements/tr-select-part_referral.html,
98 'label' => 'Advertising source ',
100 'pre_options' => [ 'all' => 'all (aggregate)' ],
101 'empty_label' => 'all (breakdown)',
102 'onchange' => 'enable_agent_totals'
108 <INPUT TYPE="radio" NAME="class_mode" VALUE="pkg" onchange="class_mode_changed('pkg')" CHECKED>
109 <% emt('Package class') %>
111 <INPUT TYPE="radio" NAME="class_mode" VALUE="report" onchange="class_mode_changed('report')">
112 <% emt('Report class') %>
121 <& /elements/select-pkg_class.html,
122 'field' => 'classnum',
125 'pre_options' => [ #'all' => 'all (aggregate)',
126 # '' => 'all (breakdown)',
127 '0' => '(empty class)' ],
128 'disable_empty' => 1,
129 'onchange' => 'enable_agent_totals',
132 <DIV ID="report_class" STYLE="display: none">
133 <& /elements/select-table.html,
134 'field' => 'report_optionnum',
135 'table' => 'part_pkg_report_option',
136 'name_col' => 'name',
137 'value_col' => 'num',
140 'pre_options' => [ #'all' => 'all (aggregate)',
141 # '' => 'all (breakdown)',
142 '0' => '(empty class)' ],
143 'disable_empty' => 1,
144 'onchange' => 'enable_agent_totals',
150 <INPUT TYPE="radio" NAME="class_agg_break" ID="class_agg_break_aggregate" VALUE="aggregate" onchange="enable_agent_totals(this)" CHECKED>
151 <% emt('Aggregate') %>
153 <INPUT TYPE="radio" NAME="class_agg_break" ID="class_agg_break_breakdown" VALUE="breakdown" onchange="enable_agent_totals(this)">
154 <% emt('Breakdown') %>
156 <SPAN ID="exact_match" style="display:none">
157 <INPUT TYPE="radio" NAME="class_agg_break" ID="class_agg_break_exact" VALUE="exact" onchange="enable_agent_totals(this)">
158 <% emt('Exact match') %>
169 <TH CLASS="background" COLSPAN=2> </TH>
173 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
178 <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="separate_0freq" VALUE="1"></TD>
179 <TD>Separate one-time vs. recurring sales</TD>
183 % foreach ( qw(Setup Usage) ) {
184 <& /elements/tr-select.html,
185 'label' => "$_ fees",
186 'field' => 'use_'.lc($_),
187 'options' => [ 0, 1, 2 ],
188 'labels' => { 0 => 'Combine', 1 => 'Separate', 2 => 'Do not show' },
189 'onchange'=> 'enable_agent_totals',
192 <& /elements/tr-select.html,
193 'label' => 'Discounts',
194 'field' => 'use_discount',
195 'options' => [ 1, 2 ],
196 'labels' => { 1 => 'Separate', 2 => 'Do not show' },
198 <& /elements/tr-select.html,
200 'field' => 'use_taxes',
201 'options' => [ 1, 2 ],
202 'labels' => { 1 => 'Separate', 2 => 'Do not show' },
206 <TD ALIGN="right">Colors</TD>
210 % #no particular long-term attachment to this, just trying to replicate
211 % # historical behavior so people's graphs don't change color suddenly in 3.x
213 % my $hue_increment = 125;
217 % foreach my $agent ( @agents ) {
218 <TR <% $anum ? 'STYLE="display:none"' : '' %>
219 ID="agent<%$anum%>-colors"
221 <TD <% $anum ? '' :'STYLE="display:none"' %>
222 ID="agent<%$anum%>-label"
224 <% $agent->agent |h %>
227 % my $col_scheme = Color::Scheme->new
228 % ->from_hue($hue) #->from_hex($agent->color)
229 % ->scheme('analogic')
233 % my @colors = ($col_scheme->colors)[ 0,4,8,1,5,9 ];#again some some random historical shite
235 % my $name = "agent$anum-color$cnum";
236 % push @names, $name;
238 <INPUT TYPE = "color"
247 % $hue += $hue_increment;
253 <SCRIPT TYPE="text/javascript">
254 $(document).ready(function() {
255 % foreach my $name (@names) {
256 $("#<% $name %>").spectrum({
257 clickoutFiresChange: true
264 <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="agent_totals" VALUE="1" DISABLED="1"></TD>
265 <TD>Show per-agent subtotals</TD>
269 <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="use_override" VALUE="1"></TD>
270 <TD>Separate sub-packages from parents</TD>
274 <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="average_per_cust_pkg" VALUE="1"></TD>
275 <TD>Average per customer package</TD>
279 <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="distribute" VALUE="1"></TD>
280 <TD>Distribute recurring fees over billing period</TD>
285 <BR><INPUT TYPE="submit" VALUE="Display">
288 <% include('/elements/footer.html') %>
292 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
294 my @agents = $FS::CurrentUser::CurrentUser->agents;