Skip to content

MrmCashPositionComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Pams

MrmCashPositionComponent is an Angular dashboard widget that retrieves, initializes, and saves cash-position dashboard data. It checks authorization, obtains currency rates, aggregates monthly values, and calculates a performance percentage for the dashboard view.

Methods

MethodSignatureReturns
GetAuthorizationAccessGetAuthorizationAccess(url: string)void
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
ngOnDestroyngOnDestroy()void
getDashboardDatagetDashboardData()void
saveDashboardDatasaveDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
calculateSumByMonthcalculateSumByMonth(monthIndex: number)void
getCurrencyRatesgetCurrencyRates()void
calculatePerformancePercalculatePerformancePer(month: MonthData)number
translateMonthNametranslateMonthName(month: MonthData)string
getpriceFormattedgetpriceFormatted(x: undefined)string
syncScrollsyncScroll(e: undefined)void
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
onValueChangedonValueChanged(e: undefined)void
onChartInitonChartInit(e: any, index: number)void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
isCurrentMonthisCurrentMonth(month: MonthData)boolean
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, bIndex: number, index: number, propertyName: string)string
comparingMonthsWithPrevSummcomparingMonthsWithPrevSumm(month: TotalBookingMonths, index: number, propertyName: string)string
setValuesetValue(value: number)void
setForecastValuesetForecastValue(value: number)void
setMarginAvaragesetMarginAvarage(value: number)void
isForecastisForecast(month: MonthData)boolean
isAchievedOrCurrentisAchievedOrCurrent(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
mouseoverRowSpanmouseoverRowSpan(e: undefined, bIndex: number)void
mouseoutRowSpanmouseoutRowSpan(e: undefined, bIndex: number)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthData)void
sortingsorting(propertyName: string, propertyType: string, monthIndex: number)void

Properties

PropertyType
scrollOneElementRef
scrollTwoElementRef
scrollThreeElementRef
_widgetWidget
_widgetTypestring
withoutOptionBarboolean
editModeboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
selectedDataBranchData[]
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
currencyRateDatacurrencyRatesData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
subscriptionSubscription
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsTotalBookingMonths[]
tempTotalMonthTotalBookingMonths
sortingDirectionnumber

Where it refuses work

  • MrmCashPositionComponent stops the work with an early return when a[propertyName] < b[propertyName], in 2 places.
  • MrmCashPositionComponent stops the work with an early return when a[propertyName] > b[propertyName], in 2 places.
  • MrmCashPositionComponent stops the work with an early return when month.MonthId == 12.
  • MrmCashPositionComponent stops the work with an early return when this.allowedtoEnableEdting.
  • MrmCashPositionComponent stops the work with an early return when this.allowedtoEdit.
  • MrmCashPositionComponent stops the work with an early return when month[propertyName] < this.data[bIndex].MrmCashPositions[index - 1][propertyName].

Diagram

mermaid
graph LR
  View[Dashboard View] --> Component[MrmCashPositionComponent]
  Component --> Auth[GetAuthorizationAccess]
  Component --> Init[initalizingData]
  Component --> Load[getDashboardData]
  Component --> Rates[getCurrencyRates]
  Rates --> Monthly[calculateSumByMonth]
  Monthly --> Performance[calculatePerformancePer]
  Component --> Save[saveDashboardData]
  Component --> Destroy[ngOnDestroy]

Usage

ts
import { TestBed } from '@angular/core/testing';
import { MrmCashPositionComponent } from './mrm-cash-position.component';

const fixture = TestBed.createComponent(MrmCashPositionComponent);
const cashPositionWidget = fixture.componentInstance;

// Runs Angular lifecycle hooks and loads initial widget state.
fixture.detectChanges();

// Refresh dashboard data when required by the host dashboard.
cashPositionWidget.getDashboardData();

fixture.detectChanges();

const performance = cashPositionWidget.calculatePerformancePer();
console.log('Cash position performance:', performance);

AI Coding Instructions

  • Keep data loading inside getDashboardData() and initialization logic inside initalizingData() so lifecycle methods remain focused on orchestration.
  • Check authorization through GetAuthorizationAccess() before exposing or loading cash-position data.
  • Refresh currency-rate-dependent calculations through getCurrencyRates() before calling calculateSumByMonth() or calculatePerformancePer().
  • Preserve the existing initalizingData() method name when calling or refactoring it, including its current spelling.
  • Release subscriptions, timers, or other resources in ngOnDestroy() when adding asynchronous dashboard behavior.

Used by

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

Imported by (3)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1
  • DashboardTabComponentPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.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