#!/usr/bin/perl

#use utf8;
use strict;
use CGI;


use Opals::Context;
use Opals::Constant;

use Date::Calc::Object qw(
    :all
);
use POSIX qw(
    floor
);
use Time::localtime;
use Opals::Template qw(
    tmpl_read
    tmpl_write
    tmpl_preference
);

use Opals::Date qw(
    date_parse
    date_today
    date_text
    date_validateWorkday
    date_deltaWorkDay
    date_addDeltaWorkday
);
use Opals::Tb_Circulation qw(
    circ_userCircStatByRid
);
################################################################################

my $dbh = Opals::Context->dbh();
END { $dbh->disconnect(); }

my $cgi = CGI->new;
my $input = $cgi->Vars();
my ($permission, $cookie, $template) = tmpl_read(
        {
            dbh             => $dbh,
            cgi             => $cgi,
            tmplFile        => '/txtbk/report/userCircStatsByRid.tmpl',
            reqPermission   => 'tb_circ_loan',
        }
);
my $syspref = tmpl_preference($dbh);
my $loginuid     = $template->param('curUserId');
my $syspref      = tmpl_preference($dbh);

my @cookieList = (@$cookie);
my $op = $input->{'op'};

my $tm = localtime;
my $userCircStatByRid;
    my ($uid,$status);
        $uid = $input->{'uid'};
        my $rid = $input->{'rid'};
        $userCircStatByRid = circ_userCircStatByRid($dbh,$uid, $rid);
  #  }
  $template->param( userCircStatByRid    => \@$userCircStatByRid); 
$template->param(
        checkid => 1,
       
);
tmpl_write($dbh, $cgi, \@cookieList, $template);

