Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

  1. #!/usr/bin/perl
  2. #script to keep total of number of issues;
  3. use C4::Circulation::Fines;
  4. use Date::Manip;
  5. my ($count,$data)=Getoverdues();
  6. #print $count;
  7. my $count2=0;
  8. #$count=1000;
  9. my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
  10. $mon++;
  11. $year=$year+1900;
  12. #my $date=Date_DaysSince999($mon,$mday,$year);
  13. my $date=Date_DaysSince999(2,3,2000);
  14. my $bornum;
  15. my $borrower;
  16. my $max=5;
  17. for (my $i=0;$i<$count;$i++){
  18. my @dates=split('-',$data->[$i]->{'date_due'});
  19. my $date2=Date_DaysSince999($dates[1],$dates[2],$dates[0]);
  20. my $due="$dates[2]/$dates[1]/$dates[0]";
  21. if ($date2 <= $date){
  22. $count2++;
  23. my $difference=$date-$date2;
  24. if ($bornum != $data->[$i]->{'borrowernumber'}){
  25. $bornum=$data->[$i]->{'borrowernumber'};
  26. $borrower=BorType($bornum);
  27. }
  28. my ($amount,$type,$printout)=CalcFine($data->[$i]->{'itemnumber'},$borrower->{'categorycode'},$difference);
  29. if ($amount > $max){
  30. $amount=$max;
  31. }
  32. if ($amount > 0){
  33. UpdateFine($data->[$i]->{'itemnumber'},$bornum,$amount,$type,$due);
  34. if ($amount ==5){
  35. # marklost();
  36. }
  37. print "$printout\t$bornum\t$borrower->{'firstname'}\t$borrower->{'surname'}\t$data->[$i]->{'date_due'}\t$type\t$difference\t$borrower->{'emailaddress'}\t$borrower->{'phone'}\t$borrower->{'streetaddress'}\t$borrower->{'city'}\n";
  38. } else {
  39. # print "0 fine\n";
  40. }
  41. }
  42. }
  43. print "\n $count2\n";