Displaying auto updated unique title and volume count on the Koha staff client or OPAC

Step - 1

 First Create the SQL Public Report 

Go to: Reports/ Create from SQL and (Copy and paste the following SQL query )

SELECT homebranch, count(DISTINCT biblionumber) AS bibs, 
       count(itemnumber) AS items 
FROM items 
GROUP BY homebranch 
ORDER BY homebranch ASC

Save to public report. (Report is public: 

Step - 2

Go to: Koha administration/System preferences/Staff interface/IntranetUserJS

Copy and paste the following JQuery

Replace your IP address and report ID

http://Your koha IP Address/cgi-bin/koha/svc/report?id=36&annotated=1

//**No.of.Book.Dis in home page**//
 $("#sql_params_Selectthesubject").change(function() {
   var subval = $('#sql_params_Selectthesubject').val();

$(document).ready(function() {
    if ( $('#main_intranet-main').length ) {
    $.getJSON("http://Your koha IP Address/cgi-bin/koha/svc/report?id=36&annotated=1",
        function(data) {
        var branches = data[0].homebranch;
        var bibs = data[0].bibs;
        var items = data[0].items;
        $('div.newsitem').prepend('<div class="newsitem" id="mystats"><table class="table table-striped" style="width: 100%; background: none;"><thead><th colspan="3" style="text-align: center; font-weight: bold; padding: 8px; line-height: 1.42857143; vertical-align: middle; text-transform: uppercase;">Library Statistics</thead><tbody><tr><td><strong>Branch</strong></td><td><strong>Unique Titles</strong></td><td><strong>Total Vols</strong></td></tr><tr><td class="text-center">'+branches+'</td><td class="text-center">'+bibs+'</td><td class="text-center">'+items+'</td></tr></tbody></table></div>');


Step - 3

Go to: Home Page (Successfully Your library unique title and volume displaying)

Information courtesy

Post a Comment