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