Permalink
Browse files

Making reports

  • Loading branch information...
1 parent 6d3a0e8 commit 9fc68c124dc38172c872afa9bd2a334b7e69d3f7 @kthakore committed Jan 29, 2011
View
6 implementation/SIMS/SIMS/lib/SIMS/Controller/Report.pm
@@ -58,10 +58,10 @@ sub test_query : Chained('base') : PathPart('test_query') : Args(0) {
{ $c->req->{parameters}->{"condition_$_"} => $c->req->{parameters}->{"text_$_"} };
}
- my @foo =$c->model('DB::Student')->search( $query );
+ my @foo =$c->model('DB::Student')->search( $query )->all();
- $c->res->body( Dumper \@foo);
-
+ $c->stash( result_col => $self->_prepare_columns($c, 'DB::Student'));
+ $c->stash( result_record => \@foo );
$c->stash(template => 'report/index.tt' );
}
View
29 implementation/SIMS/SIMS/root/report/index.tt
@@ -137,12 +137,29 @@ $('#datum').change( function(){
<input type="submit" value="save query" />
<input type="button" value="try query" onclick=" var form = $('#make_query').attr('action', '[%c.uri_for('test_query') %] '); $('<input>').attr({ type: 'hidden', name: 'count', value: condition }).appendTo(form); form.submit()" />
</form>
-[% IF result_data %]
-<table class="flexme">
-</table>
-<script>
-$('.flexme').flexigrid();
-</script>
+[% IF result_col %]
+
+ <table class="flexme">
+ <thead>
+ <tr>
+ [% FOREACH h IN result_col %]
+ <th>[% h.text %]</th>
+ [% END %]
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH record IN result_record %]
+ <tr>
+ [% FOREACH r IN record %]
+ <th>[% result_record.user_id() %]</th>
+ [% END %]
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ <script>
+ $('.flexme').flexigrid();
+ </script>
[% END %]
View
BIN implementation/SIMS/SIMS/sims.db
Binary file not shown.

0 comments on commit 9fc68c1

Please sign in to comment.