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.

86 lines
2.4 KiB

  1. #!/usr/bin/perl
  2. #written 14/1/2000
  3. #script to display reports
  4. use C4::Stats;
  5. use strict;
  6. use Date::Manip;
  7. use CGI;
  8. use C4::Output;
  9. my $input=new CGI;
  10. my $time=$input->param('time');
  11. print $input->header;
  12. print startpage;
  13. print startmenu('report');
  14. print center;
  15. my $date;
  16. my $date2;
  17. if ($time eq 'yesterday'){
  18. $date=ParseDate('yesterday');
  19. $date2=ParseDate('today');
  20. }
  21. if ($time eq 'today'){
  22. $date=ParseDate('today');
  23. $date2=ParseDate('tomorrow');
  24. }
  25. if ($time eq 'daybefore'){
  26. $date=ParseDate('2 days ago');
  27. $date2=ParseDate('yesterday');
  28. }
  29. if ($time=~ /\//){
  30. $date=ParseDate($time);
  31. $date2=ParseDateDelta('+ 1 day');
  32. $date2=DateCalc($date,$date2);
  33. }
  34. $date=UnixDate($date,'%Y-%m-%d');
  35. $date2=UnixDate($date2,'%Y-%m-%d');
  36. my @payments=TotalPaid($date);
  37. my $count=@payments;
  38. my $total=0;
  39. print mktablehdr;
  40. print mktablerow(5,'#99cc33',bold('Name'),bold('Type'),bold('Date/time'),bold('Amount'), bold('Branch'),'/images/background-mem.gif');
  41. for (my $i=0;$i<$count;$i++){
  42. my $hour=substr($payments[$i]{'timestamp'},8,2);
  43. my $min=substr($payments[$i]{'timestamp'},10,2);
  44. my $sec=substr($payments[$i]{'timestamp'},12,2);
  45. my $time="$hour:$min:$sec";
  46. $payments[$i]{'amount'}*=-1;
  47. $total+=$payments[$i]{'amount'};
  48. # my @charges=getcharges($payments[$i]{'borrowernumber'},$payments[$i]{'timestamp'});
  49. # my $count=@charges;
  50. # for (my $i2=0;$i2<$count;$i2++){
  51. # print mktablerow(6,'red',$charges[$i2]->{'description'},$charges[$i2]->{'accounttype'},
  52. # '',
  53. # $charges[$i2]->{'amount'},$charges[$i2]->{'amountoutstanding'});
  54. # }
  55. my $time2="$payments[$i]{'date'} $time";
  56. my $branch=Getpaidbranch($time2);
  57. print mktablerow(6,'white',"$payments[$i]{'firstname'} <b>$payments[$i]{'surname'}</b>"
  58. ,$payments[$i]{'accounttype'},"$payments[$i]{'date'} $time",$payments[$i]{'amount'}
  59. ,$branch);
  60. }
  61. print mktableft;
  62. print endcenter;
  63. print "<p><b>$total</b>";
  64. #my $issues=Count('issue','C',$date,$date2);
  65. #print "<p>Issues Levin: $issues";
  66. #$issues=Count('issue','F',$date,$date2);
  67. #print "<br>Issues Foxton: $issues";
  68. #$issues=Count('issue','S',$date,$date2);
  69. #print "<br>Issues Shannon: $issues";
  70. #my $returns=Count('return','C',$date,$date2);
  71. #print "<p>Returns Levin: $returns";
  72. #$returns=Count('return','F',$date,$date2);
  73. #print "<br>Returns Foxton: $returns";
  74. #$returns=Count('return','S',$date,$date2);
  75. #print "<br>Returns Shannon: $returns";
  76. print endmenu('report');
  77. print endpage;