Skip to content

MrmCashFlowForecastedComponent

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-cash-flow-forecasted/mrm-cash-flow-forecasted.component.ts (line 105)

Part of: Pams

MrmCashFlowForecastedComponent is an Angular dashboard widget that loads, prepares, and displays forecasted cash-flow data. It responds to lifecycle changes, calculates totals by year and month, reads the currency rate from dashboard headers, and saves dashboard state when needed.

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
ngOnDestroyngOnDestroy()void
getDashboardDatagetDashboardData()void
fillMonthsSummeryfillMonthsSummery()void
initalizingDatainitalizingData(value: BranchData)void
saveDashboardDatasaveDashboardData()void
calculateSumByYearcalculateSumByYear()void
calculateSumByMonthcalculateSumByMonth(monthIndex: number)void
getCurrencyRateFromHeadergetCurrencyRateFromHeader(currencyCode: string)number
setCurrencyTotalToHeadersetCurrencyTotalToHeader(cashFlowObjIndex: number, currencyCode: string, amount: number)void
resetCurrencyTotalresetCurrencyTotal(cashFlowObjIndex: number)void
calculateEditingSumByMonthcalculateEditingSumByMonth(cashFlowObjIndex: number, itemIndex: number, currencyIndex: number, monthIndex: number)void
translateMonthNametranslateMonthName(MonthId: number)string
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
switchVendorTypeIdHandlerswitchVendorTypeIdHandler()void
switchByGroupsHandlerswitchByGroupsHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
comparingWithPrevMonthcomparingWithPrevMonth(month: CashFlowItemMonthlyDetail, cashFlowObjIndex: number, monthIndex: number, propertyName: string)string
comparingSummeryWithPrevMonthcomparingSummeryWithPrevMonth(month: MonthsSum, monthIndex: number, propertyName: string)string
comparingEditingWithPrevMonthcomparingEditingWithPrevMonth(month: CashFlowItemMonthlyDetail, cashFlowObjIndex: number, itemIndex: number, currencyIndex: number, monthIndex: number, propertyName: string)string
isForecastedMonthisForecastedMonth(month: CashFlowItemMonthlyDetail)boolean
isCurrentMonthisCurrentMonth(month: CashFlowItemMonthlyDetail)boolean
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthsSum, supplierId: number)void
fromNowfromNow(DateTime: any)void
mouseoverRowSpanmouseoverRowSpan(e: undefined, bIndex: number)void
mouseoutRowSpanmouseoutRowSpan(e: undefined, bIndex: number)void
openPopupopenPopup(n: string, t: string, i: string, btnTxt: string)void
savePopupsavePopup()void
ClosewithDonotSaveClosewithDonotSave()void
OnOpenedPopupOnOpenedPopup()void
closePopupclosePopup()void

Properties

PropertyType
sharedPopupSharedPopupComponent
_widgetWidget
_widgetTypestring
withoutOptionBarboolean
editModeboolean
cashFlowDisplaynumber
bookingOrSalesnumber
byGroupsboolean
isPamsDataboolean
selectedTeamnumber
forecastRuleIdnumber
dataBranchData
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
forecastRulesany[]
currenciesCompanyCurrency[]
selectedYearnumber
currentMonthIndexnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
originalDataBranchData
selectedDataBranchData
monthsSummeryMonthsSum[]
branchCurrencyany
salesCurrencyany
basedOnTendencyboolean
subscriptionSubscription
SeriseRangeany[]
echartsIntanceany
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
totalProfitAndLossAmountnumber
totalOthersnumber
totalTotalSGAndAnumber
totalFORXnumber
totalTotalnumber
totalCumulativenumber
totalPercentageUsedBudgetnumber
popupany
searchTextstring

Where it refuses work

  • MrmCashFlowForecastedComponent stops the work with an early return when findMonthIndex > -1.
  • MrmCashFlowForecastedComponent stops the work with an early return when MonthId == 12.
  • MrmCashFlowForecastedComponent stops the work with an early return when month[propertyName] < this.data.BanksSummary[monthIndex - 1][propertyName].
  • MrmCashFlowForecastedComponent stops the work with an early return when month[propertyName] < this.data.ReceivablesSummary[monthIndex - 1][propertyName].
  • MrmCashFlowForecastedComponent stops the work with an early return when month[propertyName] < this.data.PayablesSummary[monthIndex - 1][propertyName].
  • MrmCashFlowForecastedComponent stops the work with an early return when month[propertyName] < this.data.LGsSummary[monthIndex - 1][propertyName].

Diagram

mermaid
graph LR
  Init[ngOnInit] --> Load[getDashboardData]
  Changes[ngOnChanges] --> Load
  Load --> Initialize[initalizingData]
  Initialize --> Months[fillMonthsSummery]
  Months --> ByYear[calculateSumByYear]
  Months --> ByMonth[calculateSumByMonth]
  Currency[getCurrencyRateFromHeader] --> ByYear
  Currency --> ByMonth
  Initialize --> Save[saveDashboardData]
  Destroy[ngOnDestroy] --> Cleanup[Release subscriptions and resources]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { MrmCashFlowForecastedComponent } from './mrm-cash-flow-forecasted.component';

@Component({
  selector: 'app-dashboard-page',
  template: `
    <app-mrm-cash-flow-forecasted></app-mrm-cash-flow-forecasted>

    <button type="button" (click)="refreshCashFlowForecast()">
      Refresh forecast
    </button>
  `
})
export class DashboardPageComponent {
  @ViewChild(MrmCashFlowForecastedComponent)
  private cashFlowForecast?: MrmCashFlowForecastedComponent;

  refreshCashFlowForecast(): void {
    this.cashFlowForecast?.getDashboardData();
  }
}

AI Coding Instructions

  • Keep data-loading work in getDashboardData() and allow Angular lifecycle hooks to trigger refreshes during initialization and input changes.
  • Preserve the existing calculation flow: initialize data, populate month summaries, then calculate totals by year and month.
  • Use getCurrencyRateFromHeader() when calculations depend on the dashboard currency context instead of hard-coding conversion values.
  • Clean up subscriptions, timers, or other allocated resources in ngOnDestroy().
  • Retain the existing method names, including fillMonthsSummery() and initalizingData(), unless all callers are updated together.

Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (2)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1
  • ReportsTabComponentPams/Web/Pams.Web/Client/app/components/dashboard/reports-library/reports-tab/reports-tab.component.ts:1

Was this page helpful?

Download as PDF