Bug 6934: New features, note added to transaction information, total caculated for negative types of transaction

To be more specific, the column note from accountlines is now displayed in the table of the transactions.
The grand total is now calculated for neagtive types like Credit or Payment and isn't counted for Write off types.
Credit (return item) 'CR' has been added to drop down of transaction type

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
genevieve 2015-11-13 11:50:01 -05:00 committed by Kyle M Hall
parent 0c1413d0ff
commit 7b10c7ccb6
2 changed files with 29 additions and 9 deletions

View file

@ -130,6 +130,12 @@ $(document).ready(function() {
<option value="C">Credit</option>
[% END %]
[% IF transaction_type == "CR" %]
<option value="CR" selected="selected">Credit (item returned)</option>
[% ELSE %]
<option value="CR">Credit (item returned)</option>
[% END %]
[% IF transaction_type == "FORW" %]
<option value="FORW" selected="selected">Write off</option>
[% ELSE %]
@ -189,7 +195,7 @@ $(document).ready(function() {
</select>
</li>
<li>
<label>Library</label>
<label>Transaction branch</label>
<select name="branch" id="branch">
<option value="ALL">All</option>
[% FOREACH branchloo IN branchloop %]
@ -245,9 +251,10 @@ $(document).ready(function() {
<th>Manager name</th>
<th>Patron cardnumber</th>
<th>Patron name</th>
<th>Library</th>
<th>Transaction branch</th>
<th>Transaction date</th>
<th>Transaction type</th>
<th>Notes</th>
<th>Amount</th>
<th>Biblio title</th>
<th>Barcode</th>
@ -292,6 +299,7 @@ $(document).ready(function() {
[% END %]
[% END %]
</td>
<td>[% loopresul.note %]</td>
<td style="text-align:right;">[% loopresul.amount %]</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber %]">[% loopresul.title %]</a></td>
<td>[% loopresul.barcode %]</td>
@ -300,9 +308,11 @@ $(document).ready(function() {
[% END %]
<tfoot>
<tr>
<th colspan="6" style="text-align:right;">TOTAL</th>
[% IF transaction_type == "ACT" %]
<th colspan="7" style="text-align:right;">TOTAL</th>
<th style="text-align:right;">[% total %]</th>
<th colspan="3">&nbsp;</th>
[% END %]
</tr>
</tfoot>
</table>

View file

@ -45,7 +45,7 @@ my $do_it = $input->param('do_it');
my $output = $input->param("output");
my $basename = $input->param("basename");
my $transaction_type = $input->param("transaction_type") || 'ACT';
my $branchcode = $input->param("branch") || C4::Context->userenv->{'branch'};
my $manager_branchcode = $input->param("branch") || C4::Context->userenv->{'branch'};
our $sep = $input->param("sep") // ',';
$sep = "\t" if ($sep eq 'tabulation');
@ -88,8 +88,8 @@ if ($do_it) {
}
my $whereBranchCode = '';
if ($branchcode ne 'ALL') {
$whereBranchCode = "AND bo.branchcode = '$branchcode'";
if ($manager_branchcode ne 'ALL') {
$whereBranchCode = "AND m.branchcode = '$manager_branchcode'";
}
### $transaction_type;
@ -98,7 +98,7 @@ if ($do_it) {
SELECT round(amount,2) AS amount, description,
bo.surname AS bsurname, bo.firstname AS bfirstname, m.surname AS msurname, m.firstname AS mfirstname,
bo.cardnumber, br.branchname, bo.borrowernumber,
al.borrowernumber, DATE(al.date) as date, al.accounttype, al.amountoutstanding,
al.borrowernumber, DATE(al.date) as date, al.accounttype, al.amountoutstanding, al.note,
bi.title, bi.biblionumber, i.barcode, i.itype
FROM accountlines al
LEFT JOIN borrowers bo ON (al.borrowernumber = bo.borrowernumber)
@ -124,7 +124,17 @@ if ($do_it) {
### date : $row->{date}
push (@loopresult, $row);
$grantotal += abs($row->{amount});
if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^LR$|^Pay$/)){
pop @loopresult;
next;
}
if($row->{accounttype} =~ /^C$|^CR$|^LR$/){
$grantotal -= abs($row->{amount});
$row->{amount} = '-' . $row->{amount};
}elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
}else{
$grantotal += abs($row->{amount});
}
#}
}
@ -182,7 +192,7 @@ $template->param(
beginDate => dt_from_string($fromDate),
endDate => dt_from_string($toDate),
transaction_type => $transaction_type,
branchloop => C4::Branch::GetBranchesLoop($branchcode),
branchloop => C4::Branch::GetBranchesLoop($manager_branchcode),
manualinv_types => $manualinv_types,
CGIsepChoice => GetDelimiterChoices,
);