#!/usr/bin/perl

#use utf8;
use strict;
use CGI;

use Opals::Context;use POSIX qw(
    floor
);

use Time::localtime;
use Opals::Constant;

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
);


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/printLabels.tmpl',
            reqPermission   => 'tb_report',
        }
);
my $syspref = tmpl_preference($dbh);
my @cookieList = ($cookie);

my $tm = localtime;
my $todayStr = sprintf("%04d-%02d-%02d", $tm->year+1900, ($tm->mon)+1, $tm->mday);
my ($bc,$rid,@ridArr, @ncrArr,$op, $dateExpiry);
  
my $sField  = $cgi->param('sf');
($sField && $sField =~ m/^(title|author|callnumber|barcode)$/i) || ($sField = 'barcode');
     
my $sValue  = $cgi->param('kw0');

if ($permission && $permission->{'tb_report'}) {
    if($sValue && $sValue ne ''){
         $template->param(
            sValue   => $sValue,
        );
    }#if($sField eq 'barcode')
           
 }



    $template->param(
        recMod_msg_12   => "Print Label Set",
        recMod_msg_13   => "Print Barcode Labels",    
        recMod_msg_14   => "Print Spine Labels",
        wLocaTxt        => "With Location",
        woLocTxt        => "Without Location",
        recMod_msg_15   => "Labels with title, author, call number",
        recMod_msg_16   => "Labels with library/school name",
        prt_Opt01       => "8 across, 6 down.",
        prt_Opt02       => "8 across, 6 down.(landscape) ",
        prt_Opt03       => "3 Across, 10 down.",
        prt_Opt04       => "Horizontal Align",
        prt_Opt05       => "Left",
        prt_Opt06       => "Center",
        recMod_msg_19   => "Starting row",
        recMod_msg_20   => "Starting column",
        prtSelTxt       => "Print",

    );
tmpl_write($dbh, $cgi, \@cookieList, $template);


################################################################################


################################################################################








