deposit slips
[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                         'Payment date',
11                         'Vendor',
12                         'Class',
13                         'Amount',
14                         '',
15                       ],
16      'fields'      => [
17                         sub { time2str('%D', shift->_date) },
18                         sub { time2str('%D', shift->payment_date) },
19                         sub { shift->vend_main->vendname },
20                         sub { shift->vend_main->vend_class->classname },
21                         'charged',
22                         sub { '<A HREF="javascript:areyousure('.
23                                shift->vendbillnum.
24                               ')">delete</A>';
25                             },
26                       ],
27
28 &>
29 <%init>
30
31 die "access denied"
32   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
33
34 my %search = ();
35
36 # begin/end/beginning/ending
37 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '_date');
38 $search{'_date'} = [ $beginning, $ending ];
39
40 ($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, 'payment_date');
41 $search{'payment_date'} = [ $beginning, $ending ];
42
43 $search{'classnum'} = $cgi->param('classnum');
44
45 my $query = FS::vend_bill->search( \%search );
46 my $count_query = delete( $query->{'count_query'} );
47
48 my $html_init .= <<"END";
49 <SCRIPT TYPE="text/javascript">
50   function areyousure(vendbillnum) {
51     if ( confirm('Are you sure you want to delete this payable?') )
52       window.location.href="${p}misc/delete-vend_bill.html?" + vendbillnum;
53     
54   }
55 </SCRIPT>
56 END
57
58 </%init>
59