[Koha-cvs] CVS: koha boraccount.pl,1.8,1.8.4.1

Owen Leonard oleonard at users.sourceforge.net
Wed Feb 16 20:12:05 CET 2005


Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13676

Modified Files:
      Tag: rel_2_2
	boraccount.pl 
Log Message:
- formatting date according to system preference
- formatting currency values
- adding toggle for alternating table row colors
- adding 'credit' variables to determine whether amounts should be displayed as debits or credits (add corresponding styles to stylesheet to take advantage of these)

Index: boraccount.pl
===================================================================
RCS file: /cvsroot/koha/koha/boraccount.pl,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -C2 -r1.8 -r1.8.4.1
*** boraccount.pl	2 Feb 2003 07:18:37 -0000	1.8
--- boraccount.pl	16 Feb 2005 19:11:45 -0000	1.8.4.1
***************
*** 28,31 ****
--- 28,32 ----
  use C4::Output;
  use C4::Interface::CGI::Output;
+ use C4::Date;
  use CGI;
  use C4::Search;
***************
*** 54,67 ****
  $bor{'borrowernumber'}=$bornum;
  my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
! 
  my @accountrows; # this is for the tmpl-loop
  
  for (my $i=0;$i<$numaccts;$i++){
    $accts->[$i]{'amount'}+=0.00;
    $accts->[$i]{'amountoutstanding'}+=0.00;
!   my %row = (   'date'              => $accts->[$i]{'date'},
  		'description'       => $accts->[$i]{'description'},
!   		'amount'            => $accts->[$i]{'amount'},
! 		'amountoutstanding' => $accts->[$i]{'amountoutstanding'} );
  
    if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
--- 55,87 ----
  $bor{'borrowernumber'}=$bornum;
  my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
! my $totalcredit;
! if($total <= 0){
! 	$totalcredit = 1;
! }
  my @accountrows; # this is for the tmpl-loop
  
+ my $toggle;
  for (my $i=0;$i<$numaccts;$i++){
+ 	if($i%2){
+ 		$toggle = 0;
+ 	} else {
+ 		$toggle = 1;
+ 	}
+   $accts->[$i]{'toggle'} = $toggle;
    $accts->[$i]{'amount'}+=0.00;
+   if($accts->[$i]{'amount'} <= 0){
+   	$accts->[$i]{'amountcredit'} = 1;
+   }
    $accts->[$i]{'amountoutstanding'}+=0.00;
!   if($accts->[$i]{'amountoutstanding'} <= 0){
!   	$accts->[$i]{'amountoutstandingcredit'} = 1;
!   }
!   my %row = (   'date'              => format_date($accts->[$i]{'date'}),
!   		'amountcredit' => $accts->[$i]{'amountcredit'},
!   		'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
!   		'toggle' => $accts->[$i]{'toggle'},
  		'description'       => $accts->[$i]{'description'},
!   		'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
! 		'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}) );
  
    if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
***************
*** 77,81 ****
  			surname         => $data->{'surname'},
  			bornum          => $bornum,
! 			total           => $total,
  			accounts        => \@accountrows );
  
--- 97,102 ----
  			surname         => $data->{'surname'},
  			bornum          => $bornum,
! 			total           => sprintf("%.2f",$total),
! 			totalcredit => $totalcredit,
  			accounts        => \@accountrows );
  





More information about the Koha-cvs mailing list