Lines 49-55
sub calculate {
Link Here
|
49 |
if ($branch) { |
49 |
if ($branch) { |
50 |
if (C4::Context->preference('item-level_itypes')) { |
50 |
if (C4::Context->preference('item-level_itypes')) { |
51 |
$sth = $dbh->prepare(" |
51 |
$sth = $dbh->prepare(" |
52 |
SELECT description, items.itype as itemtype, COUNT(*) AS total |
52 |
SELECT itemtype, description, items.itype as itemtype, COUNT(*) AS total |
53 |
FROM itemtypes,items |
53 |
FROM itemtypes,items |
54 |
WHERE items.itype=itemtypes.itemtype |
54 |
WHERE items.itype=itemtypes.itemtype |
55 |
AND items.holdingbranch=? |
55 |
AND items.holdingbranch=? |
Lines 59-65
sub calculate {
Link Here
|
59 |
} |
59 |
} |
60 |
else { |
60 |
else { |
61 |
$sth = $dbh->prepare(" |
61 |
$sth = $dbh->prepare(" |
62 |
SELECT description, biblioitems.itemtype, COUNT(*) AS total |
62 |
SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total |
63 |
FROM itemtypes, biblioitems, items |
63 |
FROM itemtypes, biblioitems, items |
64 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
64 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
65 |
AND items.biblioitemnumber=biblioitems.biblioitemnumber |
65 |
AND items.biblioitemnumber=biblioitems.biblioitemnumber |
Lines 71-84
sub calculate {
Link Here
|
71 |
} else { |
71 |
} else { |
72 |
if (C4::Context->preference('item-level_itypes')) { |
72 |
if (C4::Context->preference('item-level_itypes')) { |
73 |
$sth = $dbh->prepare(" |
73 |
$sth = $dbh->prepare(" |
74 |
SELECT description,items.itype AS itemtype, COUNT(*) AS total |
74 |
SELECT itemtype, description,items.itype AS itemtype, COUNT(*) AS total |
75 |
FROM itemtypes,items |
75 |
FROM itemtypes,items |
76 |
WHERE items.itype=itemtypes.itemtype |
76 |
WHERE items.itype=itemtypes.itemtype |
77 |
GROUP BY items.itype |
77 |
GROUP BY items.itype |
78 |
ORDER BY itemtypes.description"); |
78 |
ORDER BY itemtypes.description"); |
79 |
} |
79 |
} |
80 |
else { |
80 |
else { |
81 |
$sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total |
81 |
$sth = $dbh->prepare("SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total |
82 |
FROM itemtypes, biblioitems,items |
82 |
FROM itemtypes, biblioitems,items |
83 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
83 |
WHERE biblioitems.itemtype=itemtypes.itemtype |
84 |
AND biblioitems.biblioitemnumber = items.biblioitemnumber |
84 |
AND biblioitems.biblioitemnumber = items.biblioitemnumber |
Lines 87-103
sub calculate {
Link Here
|
87 |
} |
87 |
} |
88 |
$sth->execute; |
88 |
$sth->execute; |
89 |
} |
89 |
} |
90 |
my ($description,$biblioitems,$total); |
90 |
my ($itemtype, $description,$biblioitems,$total); |
91 |
my $grantotal = 0; |
91 |
my $grantotal = 0; |
92 |
my $count = 0; |
92 |
my $count = 0; |
93 |
while (($description,$biblioitems,$total) = $sth->fetchrow) { |
93 |
while (($itemtype, $description,$biblioitems,$total) = $sth->fetchrow) { |
94 |
my %line; |
94 |
my %line; |
95 |
if($count % 2){ |
95 |
if($count % 2){ |
96 |
$line{toggle} = 1; |
96 |
$line{toggle} = 1; |
97 |
} else { |
97 |
} else { |
98 |
$line{toggle} = 0; |
98 |
$line{toggle} = 0; |
99 |
} |
99 |
} |
100 |
$line{itemtype} = $description; |
100 |
$line{itemtype} = $itemtype; |
101 |
$line{count} = $total; |
101 |
$line{count} = $total; |
102 |
$grantotal += $total; |
102 |
$grantotal += $total; |
103 |
push @results,\%line; |
103 |
push @results,\%line; |