LP#1406424: display total of rolled over encumbrances during FPC
authorGalen Charlton <gmc@equinoxOLI.org>
Tue, 8 Jun 2021 14:41:34 +0000 (10:41 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 12 Aug 2021 19:29:26 +0000 (15:29 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/admin/acq/funds/fund-rollover-dialog.component.html
Open-ILS/src/eg2/src/app/staff/admin/acq/funds/fund-rollover-dialog.component.ts
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm

index 8734f55..00f60f2 100644 (file)
@@ -73,6 +73,7 @@
           <li *ngIf="dryRun" i18n>DRY RUN: these changes have not been committed yet.</li>
           <li i18n>{{count}} funds propagated for fiscal year {{year + 1}} for the selected locations</li>
           <li i18n>{{amount_rolled}} unspent money rolled over to fiscal year {{year + 1}} for the selected locations</li>
+          <li i18n>{{encumb_rolled}} in encumbrances rolled over to fiscal year {{year + 1}} for the selected locations</li>
         </ul>
     </div>
   </div>
index c7f995d..24ab41f 100644 (file)
@@ -48,6 +48,7 @@ export class FundRolloverDialogComponent
 
     count: number;
     amount_rolled: number;
+    encumb_rolled: number;
 
     constructor(
         private idl: IdlService,
@@ -114,6 +115,7 @@ export class FundRolloverDialogComponent
 
         this.count = 0;
         this.amount_rolled = 0;
+        this.encumb_rolled = 0;
 
         this.net.request(
             'open-ils.acq',
@@ -128,6 +130,7 @@ export class FundRolloverDialogComponent
                 rolloverResponses.push(r.fund);
                 this.count++;
                 this.amount_rolled += Number(r.rollover_amount);
+                this.encumb_rolled += Number(r.encumb_amount);
             },
             err => {},
             () => {
index f400724..bc27338 100644 (file)
@@ -1426,7 +1426,8 @@ sub process_fiscal_rollover {
         my $fund = $e->retrieve_acq_fund($_) or return $e->die_event;
         $fund->summary(retrieve_fund_summary_impl($e, $fund));
 
-        my $amount = 0;
+        my $rollover_amount = 0;
+        my $encumb_amount = 0;
         if($combined and $U->is_true($fund->rollover)) {
             # see how much money was rolled over
 
@@ -1436,10 +1437,18 @@ sub process_fiscal_rollover {
                 where => {dest_fund => $fund->id, note => { like => 'Rollover%' } }
             })->[0];
 
-            $amount = $sum->{dest_amount} if $sum;
+            $rollover_amount = $sum->{dest_amount} if $sum;
+
+            $sum = $e->json_query({
+                select => {acqfdeb => [{column => 'amount', transform => 'sum'}]}, 
+                from => 'acqfdeb', 
+                where => {fund => $fund->id, encumbrance => 't' }
+            })->[0];
+
+            $encumb_amount = $sum->{amount} if $sum;
         }
 
-        $conn->respond({fund => $fund, rollover_amount => $amount});
+        $conn->respond({fund => $fund, rollover_amount => $rollover_amount, encumb_amount => $encumb_amount});
     }
 
     $self->api_name =~ /dry_run/ and $e->rollback or $e->commit;