Lines 48-53
my ($template, $loggedinuser, $cookie)
Link Here
|
48 |
my $borrowernumber=$input->param('borrowernumber'); |
48 |
my $borrowernumber=$input->param('borrowernumber'); |
49 |
my $action = $input->param('action') || ''; |
49 |
my $action = $input->param('action') || ''; |
50 |
|
50 |
|
|
|
51 |
# The index of the first record to display |
52 |
my $first_record = $input->param('first') || 0; |
53 |
# The number of records to show |
54 |
my $count_record = $input->param('count') || 20; |
55 |
|
51 |
#get borrower details |
56 |
#get borrower details |
52 |
my $data=GetMember('borrowernumber' => $borrowernumber); |
57 |
my $data=GetMember('borrowernumber' => $borrowernumber); |
53 |
|
58 |
|
Lines 63-76
if ( $data->{'category_type'} eq 'C') {
Link Here
|
63 |
} |
68 |
} |
64 |
|
69 |
|
65 |
#get account details |
70 |
#get account details |
66 |
my ($total,$accts,undef)=GetMemberAccountRecords($borrowernumber); |
71 |
my ($total,$accts,$num_records)=GetMemberAccountRecords($borrowernumber); |
67 |
my $totalcredit; |
72 |
my $totalcredit; |
68 |
if($total <= 0){ |
73 |
if($total <= 0){ |
69 |
$totalcredit = 1; |
74 |
$totalcredit = 1; |
70 |
} |
75 |
} |
71 |
|
76 |
|
|
|
77 |
# Validate the actual boundaries we need, if they're outside a useful range, |
78 |
# just reset them to something we understand. |
79 |
$first_record = 0 if ($first_record < 0 || $first_record >= @$accts); |
80 |
$count_record = 20 if ($count_record < 0); |
81 |
my $last_record = $first_record+$count_record-1; |
82 |
$last_record = @$accts - 1 if ($last_record >= @$accts); |
83 |
|
84 |
# Take an array slice |
85 |
my @accts = @$accts[$first_record .. $last_record]; |
86 |
|
87 |
my ($show_back_link, $back_first_record) = (0, undef); |
88 |
if ($first_record > 0) { |
89 |
$show_back_link = 1; |
90 |
$back_first_record = $first_record-$count_record; |
91 |
$back_first_record = 0 if ($back_first_record < 0); |
92 |
} |
93 |
my ($show_forward_link, $forward_first_record) = (0, undef); |
94 |
if (@$accts > $first_record+$count_record) { |
95 |
$show_forward_link = 1; |
96 |
$forward_first_record = $first_record+$count_record; |
97 |
} |
98 |
|
72 |
my $reverse_col = 0; # Flag whether we need to show the reverse column |
99 |
my $reverse_col = 0; # Flag whether we need to show the reverse column |
73 |
foreach my $accountline ( @{$accts}) { |
100 |
foreach my $accountline (@accts) { |
74 |
$accountline->{amount} += 0.00; |
101 |
$accountline->{amount} += 0.00; |
75 |
if ($accountline->{amount} <= 0 ) { |
102 |
if ($accountline->{amount} <= 0 ) { |
76 |
$accountline->{amountcredit} = 1; |
103 |
$accountline->{amountcredit} = 1; |
Lines 105-111
$template->param(
Link Here
|
105 |
cardnumber => $data->{'cardnumber'}, |
132 |
cardnumber => $data->{'cardnumber'}, |
106 |
categorycode => $data->{'categorycode'}, |
133 |
categorycode => $data->{'categorycode'}, |
107 |
category_type => $data->{'category_type'}, |
134 |
category_type => $data->{'category_type'}, |
108 |
categoryname => $data->{'description'}, |
135 |
categoryname => $data->{'description'}, |
109 |
address => $data->{'address'}, |
136 |
address => $data->{'address'}, |
110 |
address2 => $data->{'address2'}, |
137 |
address2 => $data->{'address2'}, |
111 |
city => $data->{'city'}, |
138 |
city => $data->{'city'}, |
Lines 114-124
$template->param(
Link Here
|
114 |
phone => $data->{'phone'}, |
141 |
phone => $data->{'phone'}, |
115 |
email => $data->{'email'}, |
142 |
email => $data->{'email'}, |
116 |
branchcode => $data->{'branchcode'}, |
143 |
branchcode => $data->{'branchcode'}, |
117 |
branchname => GetBranchName($data->{'branchcode'}), |
144 |
branchname => GetBranchName($data->{'branchcode'}), |
118 |
total => sprintf("%.2f",$total), |
145 |
total => sprintf("%.2f",$total), |
119 |
totalcredit => $totalcredit, |
146 |
totalcredit => $totalcredit, |
120 |
is_child => ($data->{'category_type'} eq 'C'), |
147 |
is_child => ($data->{'category_type'} eq 'C'), |
121 |
reverse_col => $reverse_col, |
148 |
reverse_col => $reverse_col, |
122 |
accounts => $accts ); |
149 |
accounts => [ @accts ], |
|
|
150 |
account_count => $num_records, |
151 |
show_back_link => $show_back_link, |
152 |
show_forward_link => $show_forward_link, |
153 |
back_first_record => $back_first_record, |
154 |
forward_first_record=> $forward_first_record, |
155 |
current_start => ($first_record+1), |
156 |
current_last => ($last_record+1), |
157 |
); |
123 |
|
158 |
|
124 |
output_html_with_http_headers $input, $cookie, $template->output; |
159 |
output_html_with_http_headers $input, $cookie, $template->output; |
125 |
- |
|
|