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.

80 lines
1.9 KiB

  1. #!/usr/bin/perl
  2. #script to show list of budgets and bookfunds
  3. #written 4/2/00 by chris@katipo.co.nz
  4. #called as an include by the acquisitions index page
  5. use C4::Acquisitions;
  6. #use CGI;
  7. #my $inp=new CGI;
  8. #print $inp->header;
  9. my ($count,@results)=bookfunds;
  10. open (FILE,'>/usr/local/www/hdl/htdocs/includes/budgets.inc') || die "Cant open file";
  11. print FILE <<printend
  12. <TABLE width="40%" cellspacing=0 cellpadding=5 border=1 >
  13. <FORM ACTION="/cgi-bin/koha/search.pl">
  14. <TR VALIGN=TOP>
  15. <TD bgcolor="99cc33" background="/images/background-mem.gif" colspan=2><b>BUDGETS AND BOOKFUNDS</b></TD></TR>
  16. <TR VALIGN=TOP>
  17. <TD colspan=2><table>
  18. <tr><td>
  19. <b>Budgets</B></TD> <TD><b>Total</B></TD> <TD><b>Spent</B></TD><TD><b>Comtd</B></TD><TD><b>Avail</B></TD></TR>
  20. printend
  21. ;
  22. my $total=0;
  23. my $totspent=0;
  24. my $totcomtd=0;
  25. my $totavail=0;
  26. for (my $i=0;$i<$count;$i++){
  27. my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'});
  28. my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
  29. print FILE <<EOP
  30. <tr><td>
  31. $results[$i]->{'bookfundname'} </TD>
  32. <TD>$results[$i]->{'budgetamount'}</TD> <TD>
  33. EOP
  34. ;
  35. printf FILE ("%.2f", $spent);
  36. print FILE "</TD><TD>";
  37. printf FILE ("%.2f",$comtd);
  38. print FILE "</TD><TD>";
  39. printf FILE ("%.2f",$avail);
  40. print FILE "</TD></TR>";
  41. $total+=$results[$i]->{'budgetamount'};
  42. $totspent+=$spent;
  43. $totcomtd+=$comtd;
  44. $totavail+=$avail;
  45. }
  46. print FILE <<printend
  47. <tr><td colspan=5>
  48. <hr size=1 noshade></TD></TR>
  49. <tr><td>
  50. Total </TD> <TD>$total</TD> <TD>
  51. printend
  52. ;
  53. printf FILE ("%.2f",$totspent);
  54. print FILE "</TD><TD>";
  55. printf FILE ("%.2f",$totcomtd);
  56. print FILE "</TD><TD>";
  57. printf FILE ("%.2f",$totavail);
  58. print FILE "</TD></TR>";
  59. print FILE <<printend
  60. </table><br>
  61. Use your reload button [ctrl + r] to get the most recent figures.
  62. Committed figures are approximate only, as exchange rates will affect the amount actually paid.
  63. </TD></TR>
  64. </form>
  65. </table>
  66. printend
  67. ;
  68. close FILE;