1 <& elements/search.html,
2 'title' => 'Billing event fees',
3 'html_init' => include('.init'),
5 'name' => 'billing events',
7 'count_query' => $count_sql,
13 FS::UI::Web::cust_header(),
17 sub { time2str("%b %d %Y %T", $_[0]->_date) },
20 sub { my $d = $_[0]->fee_cust_bill_date;
21 $d ? time2str("%b %d %Y %T", $d) : '' },
22 \&FS::UI::Web::cust_fields,
24 'align' => 'lrlrr'.FS::UI::Web::cust_aligns(),
31 ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
32 FS::UI::Web::cust_header()
41 FS::UI::Web::cust_colors(),
49 FS::UI::Web::cust_styles(),
55 my $cust_event_fee = shift;
56 my $fee_invnum = $cust_event_fee->fee_invnum;
57 $fee_invnum || ( $cust_event_fee->nextbill ? '(next bill)' : '(not yet)' );
62 ? [ "${p}view/cust_bill.cgi?", 'fee_invnum' ]
67 my $cust_event_fee = shift;
68 $cust_event_fee->custnum
69 ? [ "${p}view/cust_main.cgi?", 'custnum' ]
75 my @scalars = qw(); #qw( agentnum status custnum invnum pkgnum failed );
76 my @lists = qw( eventpart );
81 my $curuser = $FS::CurrentUser::CurrentUser;
84 unless $curuser->access_right('Billing event reports');
86 for my $param (@scalars) {
87 $search{$param} = scalar( $cgi->param($param) )
88 if $cgi->param($param);
92 foreach my $param (@lists) {
93 $search{$param} = [ $cgi->param($param) ];
96 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
97 $search{'beginning'} = $beginning;
98 $search{'ending'} = $ending;
100 my $where = ' WHERE '. FS::cust_event->search_sql_where( \%search );
102 if ( $cgi->param('billpkgnum') eq 'NULL' ) {
103 $where .= ' AND billpkgnum IS NULL';
104 } elsif ( $cgi->param('billpkgnum') eq 'NOT NULL' ) {
105 $where .= ' AND billpkgnum IS NOT NULL';
109 LEFT JOIN cust_event USING (eventnum)
110 LEFT JOIN cust_bill_pkg USING (billpkgnum)
111 LEFT JOIN cust_bill AS fee_cust_bill USING (invnum)
112 LEFT JOIN part_fee ON (cust_event_fee.feepart = part_fee.feepart )
113 '. FS::cust_event->join_sql();
116 'table' => 'cust_event_fee',
117 'select' => join(', ',
121 'cust_bill_pkg.invnum AS fee_invnum',
122 'fee_cust_bill._date AS fee_cust_bill_date',
125 FS::UI::Web::cust_sql_fields(),
128 'extra_sql' => $where,
129 'order_by' => 'ORDER BY eventfeenum ASC', #'ORDER BY _date ASC',
130 'addl_from' => $join,
133 my $count_sql = "SELECT COUNT(*) FROM cust_event_fee $join $where";
134 warn join(',', FS::UI::Web::cust_sql_fields() );
136 my $conf = new FS::Conf;
140 if ( $curuser->access_right('Delete fees') ) {
144 # push @$menubar, 'Re-print these events' =>
145 # "javascript:confirm_print_process()",
146 # 'Re-email these events' =>
147 # "javascript:confirm_email_process()",
150 # push @$menubar, 'Re-fax these events' =>
151 # "javascript:confirm_fax_process()"
152 # if $conf->exists('hylafax');
158 % # action is part of the target URL, don't need to pass it as a param
159 % foreach my $action (qw(print email fax)) {
160 <& /elements/progress-init.html,
162 [ @scalars, @lists, 'beginning', 'ending' ],
163 "../misc/${action}_events.cgi",
164 { 'message' => "Invoices re-${action}ed" }, #would be nice to show the number of them, but...
167 <FORM NAME="<% $action %>_form">
168 % foreach my $param (@scalars, 'beginning', 'ending') {
169 <INPUT TYPE="hidden" NAME="<% $param %>" VALUE="<% $search{$param} |h %>">
171 % foreach my $param (@lists) {
172 % foreach my $value (@{ $search{$param} }) {
173 <INPUT TYPE="hidden" NAME="<% $param %>" VALUE="<% $value |h %>">
177 % } # foreach $action
178 <SCRIPT TYPE="text/javascript">
180 function confirm_print_process() {
181 if ( ! confirm("Are you sure you want to reprint these invoices?") ) {
186 function confirm_email_process() {
187 if ( ! confirm("Are you sure you want to re-email these invoices?") ) {
192 function confirm_fax_process() {
193 if ( ! confirm("Are you sure you want to re-fax these invoices?") ) {