Bug 6934: New features, note added to transaction information, total caculated for...
authorgenevieve <genevieve@inlibro.com>
Fri, 13 Nov 2015 16:50:01 +0000 (11:50 -0500)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 28 Oct 2016 11:50:24 +0000 (11:50 +0000)
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>
koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
reports/cash_register_stats.pl

index 4ec7fe1..26778c0 100644 (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>
index bd9aa0f..8b09661 100755 (executable)
@@ -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,
 );