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.

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