issues printing issue slips again
[koha.git] / circ / circulation.pl
1 #!/usr/bin/perl
2
3 #written 8/5/2002 by Finlay
4 #script to execute issuing of books
5
6 use strict;
7 use CGI;
8 use C4::Circulation::Circ2;
9 use C4::Search;
10 use C4::Output;
11 use C4::Print;
12
13 my %env;
14 my $headerbackgroundcolor='#99cc33';
15 my $circbackgroundcolor='#ffffcc';
16 my $circbackgroundcolor='white';
17 my $linecolor1='#ffffcc';
18 my $linecolor2='white';
19 my $backgroundimage="/images/background-mem.gif";
20
21 my $branches = getbranches();
22 my $printers = getprinters(\%env);
23
24 my $query = new CGI;
25
26 my $branch = $query->param("branch");
27 my $printer = $query->param("printer");
28
29 ($branch) || ($branch=$query->cookie('branch')) ;
30 ($printer) || ($printer=$query->cookie('printer')) ;
31
32 #set up cookie.....
33 my $info = '';
34 my $branchcookie;
35 my $printercookie;
36 if ($query->param('setcookies')) {
37     $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
38     $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
39 }
40
41 $env{'branchcode'}=$branch;
42 $env{'printer'}=$printer;
43 $env{'queue'}=$printer;
44
45 my @datearr = localtime(time());
46 my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
47 warn $todaysdate;
48
49
50 my $message;
51 my $borrowerslist;
52 # if there is a list of find borrowers....
53 my $findborrower = $query->param('findborrower');
54 if ($findborrower) {
55     my ($borrowers, $flags) = findborrower(\%env, $findborrower);
56     my @borrowers=@$borrowers;
57     if ($#borrowers == -1) {
58         $query->param('findborrower', '');
59         $message =  "No borrower matched '$findborrower'";
60     } elsif ($#borrowers == 0) {
61         $query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
62         $query->param('barcode','');
63     } else {
64         $borrowerslist = \@borrowers;
65     }
66 }
67
68 my $borrowernumber = $query->param('borrnumber');    
69
70 # check and see if we should print
71 my $print=$query->param('print');
72 my $barcode = $query->param('barcode');
73 #if ($barcode eq '' ){
74 #    $print = 'yes';
75 #}
76 if ($print eq 'yes' && $borrowernumber ne ''){
77     printslip(\%env,$borrowernumber);    
78     $query->param('borrnumber','');
79     $borrowernumber='';
80 }
81     
82
83
84 # get the currently issued books......
85 my $borrower;
86 my $flags;
87 if ($borrowernumber) {
88     ($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
89 }
90
91 # get the responses to any questions.....
92 my %responses;
93 foreach (sort $query->param) {
94     if ($_ =~ /response-(\d*)/) {
95         $responses{$1} = $query->param($_);
96     }
97 }
98 if (my $qnumber = $query->param('questionnumber')) {
99     $responses{$qnumber} = $query->param('answer');
100 }
101
102
103 # if the barcode is set    
104
105 my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer);
106
107 my $year=$query->param('year');
108 my $month=$query->param('month');
109 my $day=$query->param('day');
110
111
112 if ($barcode) {
113     $barcode = cuecatbarcodedecode($barcode);
114     my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
115
116     unless ($invalidduedate) {
117         $env{'datedue'}=$datedue;
118         my @time=localtime(time);
119         my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
120         ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message) 
121                      = issuebook(\%env, $borrower, $barcode, \%responses, $date);
122     }
123 }
124
125
126 ##################################################################################
127 # HTML code....
128
129
130 my $rejectedtext;
131 if ($rejected) {
132     if ($rejected == -1) {
133     } else {
134         $rejectedtext = << "EOF";
135 <table border=1 cellpadding=5 cellspacing=0 bgcolor="#dddddd">
136 <tr><th><font color=black size=5>Error Issuing Book</font></th></tr>
137 <tr><td><font color=red size=5>$rejected</font></td></tr>
138 </table>
139 <br>
140 EOF
141     }
142 }
143
144 my $selectborrower;
145 if ($borrowerslist) {
146     $selectborrower = <<"EOF";
147 <form method=post action=/cgi-bin/koha/circ/circulation.pl>
148 <input type=hidden name=branch value=$branch>
149 <input type=hidden name=printer value=$printer>
150 <table border=1 cellspacing=0 cellpadding=5 bgcolor="#dddddd">
151 <tr><th bgcolor=$headerbackgroundcolor background=$backgroundimage>
152 <font color=black><b>Select a borrower</b></font></th></tr>\n
153 <tr><td align=center>
154 <select name=borrnumber size=7>
155 EOF
156     foreach (sort {$a->{'surname'}.$a->{'firstname'} cmp $b->{'surname'}.$b->{'firstname'}} @$borrowerslist){
157         $selectborrower .= <<"EOF";
158 <option value=$_->{'borrowernumber'}>$_->{'surname'}, $_->{'firstname'} ($_->{'cardnumber'})
159 EOF
160     }
161     $selectborrower .= <<"EOF";
162 </select><br>
163 <input type=submit>
164 </td></tr></table>
165 EOF
166 }
167
168 # title....
169 my $title = <<"EOF";
170 <table align="right"><tr><td>
171 <a href=circulation.pl?borrnumber=$borrowernumber&branch=$branch&printer=$printer&print=yes>
172 <img src="/images/button-next-borrower.gif" width="171" height="42" border="0" alt="Next Borrower"></a> &nbsp
173 <a href=returns.pl>
174 <img src="/images/button-returns.gif" width="110" height="42" border="0" alt="Returns"></a>
175 &nbsp<a href=branchtransfers.pl>
176 <img src="/images/button-transfers.gif" width="127" height="42" border="0" alt="Transfers">
177 </a>
178 </td></tr></table>
179 <FONT SIZE=6><em>Circulation: Issues</em></FONT><br>
180 <b>Branch:</b> $branches->{$branch}->{'branchname'} &nbsp 
181 <b>Printer:</b> $printers->{$printer}->{'printername'} <br>
182 <a href=selectbranchprinter.pl>Change Settings</a></td>
183 <input type=hidden name=branch value=$branch>
184 <input type=hidden name=printer value=$printer>
185 <p>
186 EOF
187
188
189
190 my $cardnumberinput = << "EOF";
191 <form method=post action=/cgi-bin/koha/circ/circulation.pl>
192 <table border=1 cellpadding=5 cellspacing=0 bgcolor="#dddddd">
193 <tr><th bgcolor=$headerbackgroundcolor background=$backgroundimage>
194 <font color=black><b>Enter borrower card number<br> or partial last name</b></font></td></tr>
195 <tr><td><input name=findborrower></td></tr>
196   
197 </table>
198 </form>
199 EOF
200
201 my $responsesform = '';
202 foreach (keys %responses) {
203     $responsesform.="<input type=hidden name=response-$_ value=$responses{$_}>\n";
204 }
205 my $questionform;
206 if ($question) {
207     my $stickyduedate=$query->param('stickyduedate');
208     $questionform = <<"EOF";
209 <table border=1 cellpadding=5 cellspacing=0 bgcolor="#dddddd">
210 <tr><th bgcolor=$headerbackgroundcolor background=$backgroundimage>
211 <font color=black><b>Issuing Question</b></font></th></tr>
212 <tr><td><table border=0 cellpadding=10><tr><td> 
213 Attempting to issue $iteminformation->{'title'} 
214 by $iteminformation->{'author'} to $borrower->{'firstname'} $borrower->{'surname'}.
215 <p>
216 $question
217 </td></tr></table></td></tr>
218 <tr><td align=center>
219 <table border=0>
220 <tr><td>
221 <form method=get>
222 <input type=hidden name=borrnumber value=$borrowernumber>
223 <input type=hidden name=barcode value=$barcode>
224 <input type=hidden name=questionnumber value=$questionnumber>
225 <input type=hidden name=day value=$day>
226 <input type=hidden name=month value=$month>
227 <input type=hidden name=year value=$year>
228 <input type=hidden name=stickyduedate value=$stickyduedate>
229 <input type=hidden name=branch value=$branch>
230 <input type=hidden name=printer value=$printer>
231 $responsesform
232 <input type=hidden name=answer value=Y>
233 <input type=submit value=Yes>
234 </form>
235 </td>
236 <td>
237 <form method=get>
238 <input type=hidden name=borrnumber value=$borrowernumber>
239 <input type=hidden name=barcode value=$barcode>
240 <input type=hidden name=questionnumber value=$questionnumber>
241 <input type=hidden name=day value=$day>
242 <input type=hidden name=month value=$month>
243 <input type=hidden name=year value=$year>
244 <input type=hidden name=stickyduedate value=$stickyduedate>
245 <input type=hidden name=branch value=$branch>
246 <input type=hidden name=printer value=$printer>
247 $responsesform
248 <input type=hidden name=answer value=N>
249 <input type=submit value=No>
250 </form>
251 </td>
252 </tr>
253 </table>
254 </td></tr>
255 </table>
256 </td></tr>
257 </table>
258 EOF
259 }
260
261
262 # Barcode entry box, with hidden inputs attached....
263 my $counter = 1;
264 my $dayoptions = '';
265 my $monthoptions = '';
266 my $yearoptions = '';
267 for (my $i=1; $i<32; $i++) {
268     my $selected='';
269     if (($query->param('stickyduedate')) && ($day==$i)) {
270         $selected='selected';
271     }
272     $dayoptions.="<option value=$i $selected>$i";
273 }
274 foreach (('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) {
275     my $selected='';
276     if (($query->param('stickyduedate')) && ($month==$counter)) {
277         $selected='selected';
278     }
279     $monthoptions.="<option value=$counter $selected>$_";
280     $counter++;
281 }
282 for (my $i=$datearr[5]+1900; $i<$datearr[5]+1905; $i++) {
283     my $selected='';
284     if (($query->param('stickyduedate')) && ($year==$i)) {
285         $selected='selected';
286     }
287     $yearoptions.="<option value=$i $selected>$i";
288 }
289 my $selected='';
290 ($query->param('stickyduedate')) && ($selected='checked');
291
292
293 my $barcodeentrytext = <<"EOF";
294 <form method=post action=/cgi-bin/koha/circ/circulation.pl>
295 <table border=1 cellpadding=5>
296 <tr>
297 <td align=center valign=top>
298 <table border=0 cellspacing=0 cellpadding=5>
299 <tr><th align=center background=$backgroundimage>
300 <font color=black><b>Enter Book Barcode</b></font></th></tr>
301 <tr><td align=center>
302 <table border=0>
303 <tr><td>Item Barcode:</td><td><input name=barcode size=10></td><td><input type=submit value=Issue></td></tr>
304 <tr><td colspan=3 align=center>
305 <table border=0 cellpadding=0 cellspacing=0>
306 <tr><td>
307 <select name=day><option value=0>Day$dayoptions</select>
308 </td><td>
309 <select name=month><option value=0>Month$monthoptions</select>
310 </td><td>
311 <select name=year><option value=0>Year$yearoptions</select>
312 </td></tr>
313 </table>
314 <input type=checkbox name=stickyduedate $selected> Sticky Due Date
315 </td></tr>
316 </table>
317 <input type=hidden name=borrnumber value=$borrowernumber>
318 <input type=hidden name=branch value=$branch>
319 <input type=hidden name=printer value=$printer>
320 <input type=hidden name=print value=yes>
321 </td></tr></table>
322 </td></tr></table>
323 </form>
324 EOF
325
326
327 # collect the messages and put into message table....
328 my $messagetable;
329 if ($message) {
330     $messagetable = << "EOF";
331 <table border=1 cellpadding=5 cellspacing=0 bgcolor='#dddddd'>
332 <tr><th bgcolor=$headerbackgroundcolor background=$backgroundimage><font>Messages</font></th></tr>
333 <tr><td> $message </td></tr></table>
334 EOF
335 }
336
337
338
339 # make the issued books table.....
340 my $todaysissues='';
341 my $previssues='';
342 if ($borrower) {
343     my $issueslist = getissues($borrower);
344     my $tcolor = '';
345     my $pcolor = '';
346     foreach my $it (sort keys %$issueslist) {
347         my $dd = $issueslist->{$it}->{'date_due'};
348         my $issuedate = $issueslist->{$it}->{'timestamp'};
349         $issuedate = substr($issuedate, 0, 8);
350
351         my $bookissue = $issueslist->{$it};
352         my $bgcolor='';
353         my $datedue = $bookissue->{'date_due'};
354         #convert to nz style dates
355         #this should be set with some kinda config variable         
356         my @tempdate=split(/-/,$dd);
357         $dd="$tempdate[2]/$tempdate[1]/$tempdate[0]";
358         $datedue=~s/-//g;
359         if ($datedue < $todaysdate) {
360             $dd="<font color=red>$dd</font>\n";
361         }
362         if ($todaysdate == $issuedate) {
363             ($tcolor eq $linecolor1) ? ($tcolor=$linecolor2) : ($tcolor=$linecolor1);
364             $todaysissues .=<< "EOF";
365 <tr><td bgcolor=$tcolor align=center>$dd</td>
366 <td bgcolor=$tcolor align=center>
367 <a href=/cgi-bin/koha/detail.pl?bib=$bookissue->{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$bookissue->{'barcode'}</a></td>
368 <td bgcolor=$tcolor>$bookissue->{'title'}</td>
369 <td bgcolor=$tcolor>$bookissue->{'author'}</td>
370 <td bgcolor=$tcolor align=center>$bookissue->{'dewey'} $bookissue->{'subclass'}</td></tr>
371 EOF
372         } else {
373             ($pcolor eq $linecolor1) ? ($pcolor=$linecolor2) : ($pcolor=$linecolor1);
374             $previssues .= << "EOF";
375 <tr><td bgcolor=$pcolor align=center>$dd</td>
376 <td bgcolor=$pcolor align=center>
377 <a href=/cgi-bin/koha/detail.pl?bib=$bookissue->{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$bookissue->{'barcode'}</a></td>
378 <td bgcolor=$pcolor>$bookissue->{'title'}</td>
379 <td bgcolor=$pcolor>$bookissue->{'author'}</td>
380 <td bgcolor=$pcolor align=center>$bookissue->{'dewey'} $bookissue->{'subclass'}</td></tr>
381 EOF
382         }
383     }
384 }
385
386 my $issuedbookstable;
387 if ($todaysissues) {
388     $issuedbookstable .= <<"EOF";
389 <table border=1 cellpadding=5 cellspacing=0 width=80%>
390 <tr><th colspan=5 bgcolor=$headerbackgroundcolor background=$backgroundimage><font color=black>
391 <b>Todays Issues</b></font></th></tr>
392 <tr><th>Due Date</th><th>Bar Code</th><th>Title</th><th>Author</th><th>Class</th></tr>
393 $todaysissues
394 </table>
395 EOF
396 }
397 if ($previssues) {
398     $issuedbookstable .= <<"EOF";
399 <table border=1 cellpadding=5 cellspacing=0 width=80%>
400 <tr><th colspan=5 bgcolor=$headerbackgroundcolor background=$backgroundimage><font color=black>
401 <b>Previous Issues</b></font></th></tr>
402 <tr><th>Due Date</th><th>Bar Code</th><th>Title</th><th>Author</th><th>Class</th></tr>
403 $previssues
404 </table>
405 EOF
406 }
407
408
409
410
411
412 # actually print the page!
413
414
415 if ($branchcookie && $printercookie) {
416     print $query->header(-type=>'text/html',-expires=>'now', -cookie=>[$branchcookie,$printercookie]);
417 } else {
418     print $query->header();
419 }
420
421 print startpage();
422 print startmenu('circulation');
423
424 print $title;
425
426
427 print $info;
428
429 if ($question) {
430     print $questionform;
431 }
432
433 print $rejectedtext;
434 print $messagetable;
435
436
437 unless ($borrower) {
438     if ($borrowerslist) {
439         print $selectborrower;
440     } else {
441         print $cardnumberinput;
442     }
443 }
444
445
446
447 if ($borrower) {
448     my ($patrontable, $flaginfotable) = patrontable($borrower);
449     print $patrontable;
450     print $flaginfotable;
451     print $barcodeentrytext;
452     print "<p clear=all><br><br>";
453     print $issuedbookstable;
454 }
455
456
457
458
459 print endmenu('circulation');
460 print endpage();
461
462
463 ####################################################################
464 # Extra subroutines,,,
465
466 sub cuecatbarcodedecode {
467     my ($barcode) = @_;
468     chomp($barcode);
469     my @fields = split(/\./,$barcode);
470     my @results = map(decode($_), @fields[1..$#fields]);
471     if ($#results == 2){
472         return $results[2];
473     } else {
474         return $barcode;
475     } 
476
477
478 sub fixdate {
479     my ($year, $month, $day) = @_;
480     my $invalidduedate;
481     my $date;
482     if (($year eq 0) && ($month eq 0) && ($year eq 0)) {
483         $env{'datedue'}='';
484     } else {
485         if (($year eq 0) || ($month eq 0) || ($year eq 0)) {
486             $invalidduedate="Invalid Due Date Specified. Book was not issued.<p>\n";
487         } else {
488             if (($day>30) && (($month==4) || ($month==6) || ($month==9) || ($month==11))) {
489                 $invalidduedate = "Invalid Due Date Specified. Book was not issued. Only 30 days in $month month.<p>\n";
490             } elsif (($day > 29) && ($month == 2)) {
491                 $invalidduedate="Invalid Due Date Specified. Book was not issued.  Never that many days in February!<p>\n";
492             } elsif (($month == 2) && ($day > 28) && (($year%4) && ((!($year%100) || ($year%400))))) {
493                 $invalidduedate="Invalid Due Date Specified. Book was not issued.  $year is not a leap year.<p>\n";
494             } else {
495                 $date="$year-$month-$day";
496             }
497         }
498     }
499     return ($date, $invalidduedate);
500 }
501
502
503 sub patrontable {
504     my ($borrower) = @_;
505     my $flags = $borrower->{'flags'};
506     my $flaginfotable='';
507     my $flaginfotext='';
508     my $flag;
509     my $color='';
510     foreach $flag (sort keys %$flags) {
511         ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
512         $flags->{$flag}->{'message'}=~s/\n/<br>/g;
513         if ($flags->{$flag}->{'noissues'}) {
514             if ($flag eq 'CHARGES') {
515                 $flaginfotext.="<tr><td valign=top><font color=red>$flag</font></td><td bgcolor=$color><b>$flags->{$flag}->{'message'}</b> <a href=/cgi-bin/koha/pay.pl?bornum=$borrower->{'borrowernumber'} onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>\n";
516             } else {
517                 $flaginfotext.="<tr><td valign=top><font color=red>$flag</font></td><td bgcolor=$color>$flags->{$flag}->{'message'}</td></tr>\n";
518             }
519         } else {
520             if ($flag eq 'CHARGES') {
521                 $flaginfotext.="<tr><td valign=top>$flag</td><td> $flags->{$flag}->{'message'} <a href=/cgi-bin/koha/pay.pl?bornum=$borrower->{'borrowernumber'} onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>\n";
522             } elsif ($flag eq 'WAITING') {
523                 my $itemswaiting='';
524                 my $items=$flags->{$flag}->{'itemlist'};
525                 foreach my $item (@$items) {
526                     my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
527                     $itemswaiting.="<a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$iteminformation->{'barcode'}</a> $iteminformation->{'title'} ($branches->{$iteminformation->{'holdingbranch'}}->{'branchname'})<br>\n";
528                 }
529                 $flaginfotext.="<tr><td valign=top>$flag</td><td>$itemswaiting</td></tr>\n";
530             } elsif ($flag eq 'ODUES') {
531                 my $items=$flags->{$flag}->{'itemlist'};
532                 my $itemswaiting="<table border=1 cellspacing=0 cellpadding=2>\n";
533                 my $currentcolor=$color;
534                 {
535                     my $color=$currentcolor;
536                     foreach my $item (@$items) {
537                         ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
538                         my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
539                         $itemswaiting.="<tr><td><font color=red>$iteminformation->{'date_due'}</font></td><td bgcolor=$color><a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$iteminformation->{'barcode'}</a></td><td>$iteminformation->{'title'}</td></tr>\n";
540                     }               
541                 }
542                 $itemswaiting.="</table>\n";
543                 if ($query->param('module') ne 'returns'){
544                   $flaginfotext.="<tr><td valign=top>$flag</td><td>$flags->{$flag}->{'message'}, See below</td></tr>\n";
545                 } else {
546                   $flaginfotext.="<tr><td valign=top>$flag</td><td>$flags->{$flag}->{'message'}</td></tr>\n"; 
547                 }
548             } else {
549                 $flaginfotext.="<tr><td valign=top>$flag</td><td>$flags->{$flag}->{'message'}</td></tr>\n";
550             }
551         }
552     }
553     ($flaginfotext) && ($flaginfotext="<tr><td bgcolor=$headerbackgroundcolor background=$backgroundimage colspan=2><b>Flags</b></td></tr>$flaginfotext\n");
554     $flaginfotext.="</table>";
555     my $patrontable= << "EOF";
556 <br><p>
557     <table border=1 cellpadding=5 cellspacing=0 align=right>
558     <tr><td bgcolor=$headerbackgroundcolor background=$backgroundimage colspan=2><font color=black><b>Patron Information</b></font></td></tr>
559     <tr><td colspan=2>
560     <a href=/cgi-bin/koha/moremember.pl?bornum=$borrower->{'borrowernumber'} onClick="openWindow(this,'Member', 480, 640)">$borrower->{'cardnumber'}</a> $borrower->{'surname'}, $borrower->{'title'} $borrower->{'firstname'}<br>$borrower->{'streetaddress'} $borrower->{'city'} Cat: $borrower->{'categorycode'} </td></tr>
561 EOF
562     return($patrontable, $flaginfotext);
563 }
564
565
566
567 sub printslip {
568     my ($env,$borrowernumber)=@_;
569     my ($borrower, $flags) = getpatroninformation($env,$borrowernumber,0);
570     $env->{'todaysissues'}=1;
571     my ($borrowerissues) = currentissues($env, $borrower);
572     $env->{'nottodaysissues'}=1;
573     $env->{'todaysissues'}=0;
574     my ($borroweriss2)=currentissues($env, $borrower);
575     $env->{'nottodaysissues'}=0;
576     my $i=0;
577     my @issues;
578     foreach (sort keys %$borrowerissues) {
579         $issues[$i]=$borrowerissues->{$_};
580         my $dd=$issues[$i]->{'date_due'};
581         #convert to nz style dates
582         #this should be set with some kinda config variable
583         my @tempdate=split(/-/,$dd);
584         $issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
585         $i++;
586     }
587     foreach (sort keys %$borroweriss2) {
588         $issues[$i]=$borroweriss2->{$_};
589         my $dd=$issues[$i]->{'date_due'};
590         #convert to nz style dates
591         #this should be set with some kinda config variable
592         my @tempdate=split(/-/,$dd);
593         $issues[$i]->{'date_due'}="$tempdate[2]/$tempdate[1]/$tempdate[0]";
594         $i++;
595     }
596     remoteprint($env,\@issues,$borrower);
597 }