simple A/P
[freeside.git] / httemplate / search / vend_bill.html
1 <& elements/search.html,
2      'title'       => 'Payables',
3      'name'        => 'payables',
4      'menubar'     => [ 'Add a payable' => '../edit/vend_bill.html', ],
5      'html_init'   => $html_init,
6      'query'       => $query,
7      'count_query' => $count_query,
8      'count_addl'  => [ '$%.2f total', ],
9      'header'      => [ 'Date',
10                         'Vendor',
11                         'Class',
12                         'Amount',
13                         '',
14                       ],
15      'fields'      => [
16                         sub { time2str('%D', shift->_date) },
17                         sub { shift->vend_main->vendname },
18                         sub { shift->vend_main->vend_class->classname },
19                         'charged',
20                         sub { '<A HREF="javascript:areyousure('.
21                                shift->vendbillnum.
22                               ')">delete</A>';
23                             },
24                       ],
25
26 &>
27 <%init>
28
29 die "access denied"
30   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
31
32 my %search = ();
33
34 # begin/end/beginning/ending
35 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '');
36 $search{'_date'} = [ $beginning, $ending ];
37
38 my $query = FS::vend_bill->search( \%search );
39 my $count_query = delete( $query->{'count_query'} );
40
41 my $html_init .= <<"END";
42 <SCRIPT TYPE="text/javascript">
43   function areyousure(vendbillnum) {
44     if ( confirm('Are you sure you want to delete this payable?') )
45       window.location.href="${p}misc/delete-vend_bill.html?" + vendbillnum;
46     
47   }
48 </SCRIPT>
49 END
50
51 </%init>
52