LP1859701 follow-up fixes for Cash Report
authorJason Etheridge <jason@EquinoxOLI.org>
Mon, 29 Aug 2022 11:38:42 +0000 (07:38 -0400)
committerMichele Morgan <mmorgan@noblenet.org>
Fri, 28 Oct 2022 19:46:54 +0000 (15:46 -0400)
  * restore totals to area outside of grid
  * add Debit Card Payments
  * relabel Credit Payment to Patron Credit Payment in outside-grid area
  * relabel User Payments to Staff User Payments in outside-grid area
  * relabel "patron" columns in Staff User Payments grid to "staff"

Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/cash-reports/cash-reports.component.ts

index 1cf4c64..37023f2 100644 (file)
           <div class="col-sm-2" i18n>Total Credit Card Payments</div>
           <div class="col-sm-10">{{deskTotals.credit_card_payment | currency}}</div>
         </div>
+        <div class="row">
+          <div class="col-sm-2" i18n>Total Debit Card Payments</div>
+          <div class="col-sm-10">{{deskTotals.debit_card_payment | currency}}</div>
+        </div>
         <eg-grid #deskPaymentGrid
           persistKey="admin.local.cash_reports.desk_payments"
           [disableSelect]="true"
           <eg-grid-column label="Cash Payment" name="cash_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Check Payment" name="check_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Credit Card Payment" name="credit_card_payment" i18n-label datatype="money"></eg-grid-column>
+          <eg-grid-column label="Debit Card Payment" name="debit_card_payment" i18n-label datatype="money"></eg-grid-column>
         </eg-grid>
       </div>
     </ng-template>
   </li>
   <li ngbNavItem="userPayments">
-    <a ngbNavLink i18n>User Payments</a>
+    <a ngbNavLink i18n>Staff User Payments</a>
     <ng-template ngbNavContent>
       <div class="mt-3">
         <div class="row">
-          <div class="col-sm-2" i18n>Total Credit Payments</div>
+          <div class="col-sm-2" i18n>Total Patron Credit Payments</div>
           <div class="col-sm-10">{{userTotals.credit_payment | currency}}</div>
         </div>
         <div class="row">
           [sortable]="false">
           <eg-grid-column label="User" name="usr" [index]="true" i18n-label></eg-grid-column>
           <eg-grid-column label="Credit Payment" name="credit_payment" i18n-label datatype="money"></eg-grid-column>
+          <eg-grid-column label="Debit Payment" name="debit_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Forgive Payment" name="forgive_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Work Payment" name="work_payment" i18n-label datatype="money"></eg-grid-column>
           <eg-grid-column label="Goods Payment" name="goods_payment" i18n-label datatype="money"></eg-grid-column>
-          <eg-grid-column label="Patron Card" name="card" i18n-label [cellTemplate]="cardTmpl"></eg-grid-column>
-          <eg-grid-column label="Patron Email" path="user.email" i18n-label></eg-grid-column>
-          <eg-grid-column label="Patron First Name" path="user.first_given_name" i18n-label></eg-grid-column>
-          <eg-grid-column label="Patron Family Name" path="user.family_name" i18n-label></eg-grid-column>
-          <eg-grid-column label="Patron Home OU" path="user.home_ou" i18n-label></eg-grid-column>
+          <eg-grid-column label="Staff Card" name="card" i18n-label [cellTemplate]="cardTmpl"></eg-grid-column>
+          <eg-grid-column label="Staff Email" path="user.email" i18n-label></eg-grid-column>
+          <eg-grid-column label="Staff First Name" path="user.first_given_name" i18n-label></eg-grid-column>
+          <eg-grid-column label="Staff Family Name" path="user.family_name" i18n-label></eg-grid-column>
+          <eg-grid-column label="Staff Home OU" path="user.home_ou" i18n-label></eg-grid-column>
         </eg-grid>
       </div>
     </ng-template>
index f77a147..5ec63b0 100644 (file)
@@ -11,6 +11,7 @@ class DeskTotals {
     cash_payment = 0;
     check_payment = 0;
     credit_card_payment = 0;
+    debit_card_payment = 0;
 }
 
 class UserTotals {
@@ -78,13 +79,17 @@ export class CashReportsComponent implements OnInit {
     }
 
     fillGridData(idlClass, dataSource, data) {
+        let dataForTotal;
         data.subscribe((result) => {
             if (idlClass === this.userIdlClass) {
+                dataForTotal = this.getUserTotal(result);
                 result.forEach((userObject, index) => {
                     result[index].user = userObject.usr();
                     result[index].usr(userObject.usr().usrname());
                     console.log('USER IS', userObject);
                 });
+            } else if(idlClass === this.deskIdlClass) {
+                dataForTotal = this.getDeskTotal(result);
             }
             this[dataSource].data = result;
             this.eraseUserGrid();
@@ -104,10 +109,12 @@ export class CashReportsComponent implements OnInit {
                 this.deskTotals['cash_payment'] += parseFloat(idlObject.cash_payment());
                 this.deskTotals['check_payment'] += parseFloat(idlObject.check_payment());
                 this.deskTotals['credit_card_payment'] += parseFloat(idlObject.credit_card_payment());
+                this.deskTotals['debit_card_payment'] += parseFloat(idlObject.debit_card_payment());
             });
             idlObjectFormat.cash_payment(this.deskTotals['cash_payment']);
             idlObjectFormat.check_payment(this.deskTotals['check_payment']);
             idlObjectFormat.credit_card_payment(this.deskTotals['credit_card_payment']);
+            idlObjectFormat.debit_card_payment(this.deskTotals['debit_card_payment']);
             return idlObjectFormat;
         }
     }