include discounts in gross sales reports, #25943
[freeside.git] / httemplate / search / report_cust_bill.html
1 <& /elements/header.html, mt($title, @title_arg) &>
2
3 <FORM ACTION="cust_bill.html" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
5 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
6
7 % unless ( $custnum ) {
8
9   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
10
11     <TR>
12       <TH CLASS="background" COLSPAN=2 ALIGN="left">
13         <FONT SIZE="+1">Customer search options</FONT>
14       </TH>
15     </TR>
16
17   <& /elements/tr-select-agent.html,
18                  'curr_value'    => scalar( $cgi->param('agentnum') ),
19                  'label'         => emt('Agent'),
20                  'disable_empty' => 0,
21   &>
22
23   <& /elements/tr-select-cust_main-status.html,
24        'label' => 'Customer status',
25        'field' => 'cust_status',
26   &>
27
28   <& /elements/tr-select-cust_class.html,
29       label         => mt('Customer Class'),
30       field         => 'cust_classnum',
31       multiple      => 1,
32      'pre_options'  => [ 0 => emt('(none)') ],
33   &>
34
35 %   if ( $cust_main ) {
36     <INPUT TYPE="hidden" NAME="payby" VALUE="<% $cust_main->payby %>">
37 %   } else {
38     <& /elements/tr-select-payby.html,
39                   label   => emt('Payment method:'),
40                   payby_type   => 'cust',
41                   multiple     => 1,
42                   all_selected => 1,
43     &>
44 % }
45
46   </TABLE>
47   <BR>
48
49 % }
50
51   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
52
53     <TR>
54       <TH CLASS="background" COLSPAN=2 ALIGN="left">
55         <FONT SIZE="+1">Invoice search options</FONT>
56       </TH>
57     </TR>
58
59   <& /elements/tr-input-beginning_ending.html &>
60
61   <& /elements/tr-input-lessthan_greaterthan.html,
62                 label   => emt('Charged'),
63                 field   => 'charged',
64   &>
65
66   <& /elements/tr-input-lessthan_greaterthan.html,
67                 label   => emt('Owed'),
68                 field   => 'owed',
69   &>
70
71 % if ( $conf->exists('cust_bill-enable_promised_date') ) {
72   <TR>
73     
74     <TD ALIGN="right" STYLE="vertical-align:text-top">
75       <% emt('Promised payment date:') %></TD>
76     <TD>
77       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="null">
78         <% emt('None') %> <BR>
79       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="past">
80         <% emt('In the past') %><BR>
81       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="future">
82         <% emt('In the future') %><BR>
83     </TD>
84   </TR>
85 % }
86
87 </TABLE>
88 <BR>
89
90 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
91
92   <TR>
93     <TH CLASS="background" COLSPAN=2 ALIGN="left">
94       <FONT SIZE="+1">Display options</FONT>
95     </TH>
96   </TR>
97
98
99 <TR>
100     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="open" VALUE="1" CHECKED></TD>
101     <TD><% mt('Show only open invoices') |h %></TD>
102   </TR>
103
104 % unless ( $custnum ) {
105   <TR>
106     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="newest_percust" VALUE="1"></TD>
107     <TD><% mt('Show only the single most recent invoice per-customer') |h %></TD>
108   </TR>
109 % }
110
111 </TABLE>
112
113 <BR>
114 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
115
116 </FORM>
117
118 <& /elements/footer.html &>
119 <%init>
120
121 die "access denied"
122   unless $FS::CurrentUser::CurrentUser->access_right('List invoices');
123
124 my $conf = new FS::Conf;
125
126 my $title = 'Invoice Report';
127 #false laziness w/report_cust_pkg.html
128 my @title_arg = ();
129
130 my $custnum = '';
131 my $cust_main = '';
132 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
133   $custnum = $1;
134   $cust_main = qsearchs({
135     'table'     => 'cust_main', 
136     'hashref'   => { 'custnum' => $custnum },
137     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
138   }) or die "unknown custnum $custnum";
139   $title .= ': [_1]';
140   push @title_arg, $cust_main->name;
141 }
142
143 </%init>