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.

133 lines
3.1 KiB

  1. #!/usr/bin/perl
  2. #wrriten 11/1/2000 by chris@katipo.oc.nz
  3. #part of the koha library system, script to facilitate paying off fines
  4. use strict;
  5. use C4::Output;
  6. use CGI;
  7. use C4::Search;
  8. use C4::Accounts2;
  9. my $input=new CGI;
  10. my $bornum=$input->param('bornum');
  11. if ($bornum eq ''){
  12. $bornum=$input->param('bornum0');
  13. }
  14. #get borrower details
  15. my $data=borrdata('',$bornum);
  16. my $user=$input->remote_user;
  17. #get account details
  18. my %bor;
  19. $bor{'borrowernumber'}=$bornum;
  20. my @names=$input->param;
  21. my %inp;
  22. my $check=0;
  23. for (my $i=0;$i<@names;$i++){
  24. my$temp=$input->param($names[$i]);
  25. if ($temp eq 'wo'){
  26. $inp{$names[$i]}=$temp;
  27. $check=1;
  28. }
  29. if ($temp eq 'yes'){
  30. my $amount=$input->param($names[$i+4]);
  31. my $bornum=$input->param($names[$i+5]);
  32. my $accountno=$input->param($names[$i+6]);
  33. makepayment($bornum,$accountno,$amount,$user);
  34. $check=2;
  35. }
  36. }
  37. my %env;
  38. my $total=$input->param('total');
  39. if ($check ==0){
  40. if ($total ne ''){
  41. recordpayment(\%env,$bornum,$total);
  42. }
  43. my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
  44. print $input->header;
  45. print startpage();
  46. print startmenu('member');
  47. print <<printend
  48. <FONT SIZE=6><em>Pay Fines for $data->{'firstname'} $data->{'surname'}</em></FONT><P>
  49. <center>
  50. <p>
  51. <TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
  52. <TR VALIGN=TOP>
  53. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>FINES & CHARGES</TD>
  54. <td bgcolor="99cc33" background="/images/background-mem.gif" colspan=4><B>AMOUNT OWING</TD>
  55. </TR>
  56. <form action=/cgi-bin/koha/pay.pl method=post>
  57. printend
  58. ;
  59. for (my $i=0;$i<$numaccts;$i++){
  60. if ($accts->[$i]{'amountoutstanding'} > 0){
  61. $accts->[$i]{'amount'}+=0.00;
  62. $accts->[$i]{'amountoutstanding'}+=0.00;
  63. print <<printend
  64. <tr VALIGN=TOP >
  65. <TD><input type=radio name=payfine$i value=no checked>Unpaid
  66. <input type=radio name=payfine$i value=yes>Pay
  67. <input type=radio name=payfine$i value=wo>Writeoff
  68. <input type=hidden name=itemnumber$i value=$accts->[$i]{'itemnumber'}>
  69. <input type=hidden name=accounttype$i value=$accts->[$i]{'accounttype'}>
  70. <input type=hidden name=amount$i value=$accts->[$i]{'amount'}>
  71. <input type=hidden name=out$i value=$accts->[$i]{'amountoutstanding'}>
  72. <input type=hidden name=bornum$i value=$bornum>
  73. <input type=hidden name=accountno$i value=$accts->[$i]{'accountno'}>
  74. </td>
  75. <TD>$accts->[$i]{'description'} $accts->[$i]{'title'}</td>
  76. <TD>$accts->[$i]{'accounttype'}</td>
  77. <td>$accts->[$i]{'amount'}</td>
  78. <TD>$accts->[$i]{'amountoutstanding'}</td>
  79. </tr>
  80. printend
  81. ;
  82. }
  83. }
  84. print <<printend
  85. <tr VALIGN=TOP >
  86. <TD></td>
  87. <TD colspan=2><b>Total Due</b></td>
  88. <TD><b>$total</b></td>
  89. </tr>
  90. <tr VALIGN=TOP >
  91. <TD></td>
  92. <TD colspan=3><b>AMOUNT PAID</b></td>
  93. <TD><input type=text name=total value="" SIZE=7></td>
  94. </tr>
  95. <tr VALIGN=TOP >
  96. <TD colspan=5 align=right>
  97. <INPUT TYPE="image" name="submit" VALUE="pay" height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></td>
  98. </tr>
  99. </form>
  100. </table>
  101. <br clear=all>
  102. <p> &nbsp; </p>
  103. printend
  104. ;
  105. print endmenu('member');
  106. print endpage();
  107. } else {
  108. my $quety=$input->query_string;
  109. print $input->redirect("/cgi-bin/koha/sec/writeoff.pl?$quety");
  110. }