diff options
| author | levinse <levinse> | 2011-07-01 22:02:47 +0000 |
|---|---|---|
| committer | levinse <levinse> | 2011-07-01 22:02:47 +0000 |
| commit | d6ff3967df6ee08263023a4d35865b66bdb8a672 (patch) | |
| tree | ae4d8ed7ba36c2eb6cd853b08226d86c4a93e98b /httemplate/search | |
| parent | 4665d5af02f915679207a369222472a25e137c9d (diff) | |
add employee audit report, RT13350
Diffstat (limited to 'httemplate/search')
| -rw-r--r-- | httemplate/search/employee_audit.html | 45 | ||||
| -rw-r--r-- | httemplate/search/report_employee_audit.html | 39 |
2 files changed, 84 insertions, 0 deletions
diff --git a/httemplate/search/employee_audit.html b/httemplate/search/employee_audit.html new file mode 100644 index 000000000..753c7bff3 --- /dev/null +++ b/httemplate/search/employee_audit.html @@ -0,0 +1,45 @@ +<% include("/elements/header.html", "Employee Audit Report") %> +<% include("/elements/change_history_common.html", + 'history' => \@history, + 'tables' => \%tables, + ) %> +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + +my %tables = ( + cust_pay => 'Payments', + cust_refund => 'Refunds', + cust_credit => 'Credits', + cust_bill => 'Invoices', + cust_main => 'Customers', + cust_pkg => 'Packages', + cust_main_invoice => 'Customer invoice destinations', + cust_pkg_discount => 'Discount applications', +); + +my $history_user = ($cgi->param('usernum') && $cgi->param('usernum') =~ /^(\d+)$/) + ? qsearchs('access_user', { 'usernum' => $1 } ) + : ''; +$history_user = $history_user->username if $history_user; + +my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); + +my @checked_tables = grep { defined($cgi->param($_)) } keys(%tables); + +my @history; +foreach my $table ( @checked_tables ) { + my @extra_sql; + push @extra_sql, "history_user = '$history_user'" if $history_user; + push @extra_sql, "history_date >= $beginning" if $beginning; + push @extra_sql, "history_date <= $ending" if $ending; + my @items = qsearch({ + 'table' => "h_$table", + 'extra_sql' => scalar(@extra_sql) ? "WHERE ".join(' AND ',@extra_sql) : '', + }); + push @history, @items; +} + +</%init> diff --git a/httemplate/search/report_employee_audit.html b/httemplate/search/report_employee_audit.html new file mode 100644 index 000000000..757b8232f --- /dev/null +++ b/httemplate/search/report_employee_audit.html @@ -0,0 +1,39 @@ +<% include('/elements/header.html', 'Employee audit report' ) %> + +<FORM ACTION="employee_audit.html" METHOD="GET"> + <TABLE> + <% include( '/elements/tr-select-user.html' ) %> + <% include( '/elements/tr-input-beginning_ending.html', ) %> + + <% include( '/elements/tr-td-label.html', label => 'Include:' ) %> + <TD> + <% map { include('/elements/checkbox.html', + field => $_, id => $_, postfix => $tables{$_} ) + . "<BR>" + } keys(%tables) + %> + </TD> + </TR> + + </TABLE> +<INPUT TYPE="submit" VALUE="Get Report"> +</FORM> + +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + +my %tables = ( + cust_pay => 'Payments', + cust_refund => 'Refunds', + cust_credit => 'Credits', + cust_bill => 'Invoices', + cust_main => 'Customers', + cust_pkg => 'Packages', + cust_main_invoice => 'Customer invoice destinations', + cust_pkg_discount => 'Discount applications', +); + +</%init> |
