lp1772955 total billed total paid inaccurate user/mrisher/lp1735828-copy-bucket-show-status
authorMike Risher <mrisher@catalyte.io>
Tue, 28 Jan 2020 23:54:05 +0000 (23:54 +0000)
committerMike Risher <mrisher@catalyte.io>
Thu, 20 Feb 2020 22:39:45 +0000 (22:39 +0000)
Fix the bug on the patron billing UI that's causing the total billed
and total paid amounts to be inaccurate. The bug causes it to include
amounts from bills that have already been completely paid.

Signed-off-by: Mike Risher <mrisher@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
modified:   Open-ILS/web/js/ui/default/staff/circ/patron/bills.js

Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2
Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js

index 7b5106b..d0ac3dc 100644 (file)
@@ -19,7 +19,7 @@
   <eg-grid-action label="[% l('Edit Selected Items') %]" group="[% l('Items') %]"
     handler="spawnHoldingsEdit"></eg-grid-action>
   <eg-grid-action handler="showItems" group="[% l('Show') %]"
-    label="[% l('Show Selected Items') %]"></eg-grid-action>
+    label="[% l('Open in Item Status') %]"></eg-grid-action>
   <eg-grid-action handler="print_labels" group="[% l('Show') %]"
     label="[% l('Print Labels') %]"></eg-grid-action>
   <eg-grid-action label="[% l('Transfer Selected Items to Marked Call Number') %]" group="[% l('Items') %]"
index b2d41cc..9394d2b 100644 (file)
@@ -4,22 +4,24 @@
 
     <div class="row">
       <div class="col-md-4">[% l('Total Owed:') %]</div>
-      <div class="col-md-2 strong-text">{{(summary.balance_owed() || 0) | currency}}</div>
+      <div class="col-md-2 strong-text">{{owed_all() | currency}}</div>
       <div class="col-md-4">[% l('Refunds Available:') %]</div>
       <div class="col-md-2">{{refunds_available() | currency}}</div>
     </div>
     <div class="row">
       <div class="col-md-4">[% l('Total Billed:') %]</div>
-      <div class="col-md-2">{{(summary.total_owed() || 0) | currency}}</div>
+      <div class="col-md-2">{{billed_all() | currency}}</div>
       <div class="col-md-4">[% l('Credit Available:') %]</div>
       <div class="col-md-2">{{patron().credit_forward_balance() | currency}}</div>
     </div>
     <div class="row">
       <div class="col-md-4">[% l('Total Paid/Credited:') %]</div>
-      <div class="col-md-2">{{(summary.total_paid() || 0) | currency}}</div>
+      <div class="col-md-2">{{paid_all() | currency}}</div>
       <div class="col-md-4">[% l('Session Voided:') %]</div>
       <div class="col-md-2">{{session_voided | currency}}</div>
     </div>
+    
+
     <div class="row"><hr/></div>
     <div class="row">
       <div class="col-md-4">[% l('Owed for Selected:') %]</div>
index cb10593..6870dc8 100644 (file)
@@ -292,6 +292,19 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
         return info;
     }
 
+    function all_payment_info() {
+        var info = {owed : 0, billed : 0, paid : 0};
+        angular.forEach($scope.gridControls.allItems(), function(item) {
+            info.owed   += Number(item['summary.balance_owed']) * 100;
+            info.billed += Number(item['summary.total_owed']) * 100;
+            info.paid   += Number(item['summary.total_paid']) * 100;
+        });
+        info.owed /= 100;
+        info.billed /= 100;
+        info.paid /= 100;
+        return info;
+    }
+
     $scope.pending_payment = function() {
         return pending_payment_info().payment;
     }
@@ -307,6 +320,15 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
     $scope.paid_selected = function() {
         return selected_payment_info().paid;
     }
+    $scope.owed_all = function() {
+        return all_payment_info().owed; 
+    }
+    $scope.billed_all = function() {
+        return all_payment_info().billed;
+    }
+    $scope.paid_all = function() {
+        return all_payment_info().paid;
+    }
     $scope.refunds_available = function() {
         var amount = 0;
         angular.forEach($scope.gridControls.allItems(), function(item) {