View | Details | Raw Unified | Return to bug 3431
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt (-12 / +26 lines)
Lines 1-12 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Item Types</title>
2
<title>Koha &rsaquo; Reports &rsaquo; Catalog by Item Types</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
5
<script type="text/javascript">
6
//<![CDATA[
7
$(document).ready(function() {
8
	$("#itemtypest").tablesorter();
9
});
10
//]]>
11
</script>
4
</head>
12
</head>
5
<body>
13
<body>
6
[% INCLUDE 'header.inc' %]
14
[% INCLUDE 'header.inc' %]
7
[% INCLUDE 'cat-search.inc' %]
15
[% INCLUDE 'cat-search.inc' %]
8
16
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( do_it ) %] &rsaquo; <a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Item Types</a> &rsaquo; Results[% ELSE %] &rsaquo; Item Types[% END %]</div>
17
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( do_it ) %] &rsaquo; <a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by Item Type</a> &rsaquo; Results[% ELSE %] &rsaquo; Catalog by Item Type[% END %]</div>
10
18
11
<div id="doc3" class="yui-t2">
19
<div id="doc3" class="yui-t2">
12
   
20
   
Lines 16-44 Link Here
16
24
17
[% IF ( do_it ) %]
25
[% IF ( do_it ) %]
18
[% FOREACH mainloo IN mainloop %]
26
[% FOREACH mainloo IN mainloop %]
19
	<h1>Reports on item types [% IF ( mainloo.branch ) %] for branch = [% mainloo.branch %][% END %]</h1>
27
	<h1>Reports on item types [% IF ( mainloo.branchname ) %] held at [% mainloo.branchname %][% END %]</h1>
20
	<table>
28
	<table id="itemtypest">
29
		<thead>
21
		<tr>
30
		<tr>
22
			<th>Item type</th>
31
			<th>Item type</th>
23
			<th>count</th>
32
			<th>Count</th>
24
		</tr>
33
		</tr>
34
		</thead>
35
		<tfoot>
36
			<tr>
37
				<th>TOTAL</th>
38
				<th>[% mainloo.total %]</th>
39
			</tr>
40
		</tfoot>
41
		<tbody>
25
			[% FOREACH loopitemtyp IN mainloo.loopitemtype %]
42
			[% FOREACH loopitemtyp IN mainloo.loopitemtype %]
26
				<tr>
43
				<tr>
27
					<td>[% loopitemtyp.itemtype %]</td>
44
					<td>[% loopitemtyp.itemtype %]</td>
28
					<td>[% loopitemtyp.count %]</td>
45
					<td>[% loopitemtyp.count %]</td>
29
				</tr>
46
				</tr>
30
			[% END %]
47
			[% END %]
31
			<tr>
48
		</tbody>
32
				<th>TOTAL</th>
33
				<th>[% mainloo.total %]</th>
34
			</tr>
35
	</table>
49
	</table>
36
[% END %]
50
[% END %]
37
[% ELSE %]
51
[% ELSE %]
38
52
	<h3>View a count of items held at your library grouped by item type</h3>
39
	<form method="post" action="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">
53
	<form method="post" action="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">
40
		<fieldset class="rows"><legend>View catalog group by item types</legend><ol><li><label for="value">Select a branch</label> [% CGIbranch %]
54
		<fieldset class="rows"><ol><li><label for="value">Select a library</label> [% CGIbranch %]
41
		<span class="tip">Select none to see all branches</span></li></ol></fieldset>
55
		<span class="tip">Select none to see all libraries</span></li></ol></fieldset>
42
		<fieldset class="action"><input type="submit" value="Submit" />
56
		<fieldset class="action"><input type="submit" value="Submit" />
43
		<input type="hidden" name="report_name" value="[% report_name %]" />
57
		<input type="hidden" name="report_name" value="[% report_name %]" />
44
		<input type="hidden" name="do_it" value="1" /></fieldset>
58
		<input type="hidden" name="do_it" value="1" /></fieldset>
(-)a/reports/itemtypes.plugin (-7 / +14 lines)
Lines 36-55 sub set_parameters { Link Here
36
	my $dbh = C4::Context->dbh;
36
	my $dbh = C4::Context->dbh;
37
	my $branches=GetBranches();
37
	my $branches=GetBranches();
38
	my @branches;
38
	my @branches;
39
	my $default;
39
	my @select_branch;
40
	my @select_branch;
40
	my %select_branches;
41
	my %select_branches;
41
	push @select_branch,"";
42
	push @select_branch,"";
42
	$select_branches{""} = "";
43
	$select_branches{""} = "";
43
	foreach my $branch (keys %$branches) {
44
	for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
44
		push @select_branch, $branch;
45
		push @select_branch, $branch;
45
		$select_branches{$branch} = $branches->{$branch}->{'branchname'};
46
		$select_branches{$branch} = $branches->{$branch}->{'branchname'};
47
		$default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'});
46
	}
48
	}
47
	my $CGIbranch=CGI::scrolling_list( -name     => 'value',
49
	my $CGIbranch=CGI::scrolling_list( -name     => 'value',
48
				-id => 'value',
50
				-id => 'value',
49
				-values   => \@select_branch,
51
				-values   => \@select_branch,
50
				-labels   => \%select_branches,
52
				-labels   => \%select_branches,
51
				-size     => 1,
53
				-size     => 1,
52
				-multiple => 0 );
54
				-multiple => 0,
55
				-default => $default, );
53
	$template->param(CGIbranch => $CGIbranch);
56
	$template->param(CGIbranch => $CGIbranch);
54
	return $template;
57
	return $template;
55
}
58
}
Lines 66-72 sub calculate { Link Here
66
			FROM itemtypes,items         
69
			FROM itemtypes,items         
67
		WHERE items.itype=itemtypes.itemtype         
70
		WHERE items.itype=itemtypes.itemtype         
68
		AND items.holdingbranch=?            
71
		AND items.holdingbranch=?            
69
		GROUP BY  items.itype");
72
		GROUP BY items.itype
73
		ORDER BY itemtypes.description");
70
74
71
		}
75
		}
72
		else {
76
		else {
Lines 76-82 sub calculate { Link Here
76
		WHERE biblioitems.itemtype=itemtypes.itemtype 
80
		WHERE biblioitems.itemtype=itemtypes.itemtype 
77
		AND items.biblioitemnumber=biblioitems.biblioitemnumber
81
		AND items.biblioitemnumber=biblioitems.biblioitemnumber
78
		AND items.holdingbranch=?
82
		AND items.holdingbranch=?
79
			GROUP BY  biblioitems.itemtype");
83
			GROUP BY  biblioitems.itemtype
84
			ORDER BY itemtypes.description");
80
		}
85
		}
81
		$sth->execute($branch);
86
		$sth->execute($branch);
82
	} else {
87
	} else {
Lines 85-98 sub calculate { Link Here
85
		SELECT description,items.itype AS itemtype, COUNT(*) AS total 
90
		SELECT description,items.itype AS itemtype, COUNT(*) AS total 
86
			FROM itemtypes,items
91
			FROM itemtypes,items
87
		WHERE items.itype=itemtypes.itemtype
92
		WHERE items.itype=itemtypes.itemtype
88
			GROUP BY items.itype");
93
			GROUP BY items.itype
94
			ORDER BY itemtypes.description");
89
		}
95
		}
90
		else {
96
		else {
91
		$sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total
97
		$sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total
92
			FROM itemtypes, biblioitems,items 
98
			FROM itemtypes, biblioitems,items 
93
		WHERE biblioitems.itemtype=itemtypes.itemtype 
99
		WHERE biblioitems.itemtype=itemtypes.itemtype 
94
		AND biblioitems.biblioitemnumber = items.biblioitemnumber
100
		AND biblioitems.biblioitemnumber = items.biblioitemnumber
95
			GROUP BY biblioitems.itemtype");
101
			GROUP BY biblioitems.itemtype
102
			ORDER BY itemtypes.description");
96
		}
103
		}
97
		$sth->execute;
104
		$sth->execute;
98
	}
105
	}
Lines 117-122 sub calculate { Link Here
117
	$globalline{loopitemtype} = \@results;
124
	$globalline{loopitemtype} = \@results;
118
	$globalline{total} = $grantotal;
125
	$globalline{total} = $grantotal;
119
	$globalline{branch} = $branch;
126
	$globalline{branch} = $branch;
127
	$globalline{branchname} = GetBranchName($branch);
120
	push @mainloop,\%globalline;
128
	push @mainloop,\%globalline;
121
	return \@mainloop;
129
	return \@mainloop;
122
}
130
}
123
- 

Return to bug 3431