Skip to content

MrmFinanceLgComponent

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-finance-lg/mrm-finance-lg.component.ts (line 72)

Part of: Pams

MrmFinanceLgComponent is an Angular dashboard widget that retrieves and prepares finance data for display. It responds to component lifecycle and resize events, calculates performance values, translates month names, formats prices, and manages cached state.

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
ngOnDestroyngOnDestroy()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
calculatePerformancePercalculatePerformancePer(month: MonthData)number
translateMonthNametranslateMonthName(month: MonthData)string
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
onValueChangedonValueChanged(e: undefined)void
onChartInitonChartInit(e: any, index: number)void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
mouseoverRowSpanmouseoverRowSpan(e: undefined, bIndex: number)void
mouseoutRowSpanmouseoutRowSpan(e: undefined, bIndex: number)void
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, bIndex: number, monthIndex: number, propertyName: string)string
comparingBookingWithPrevSummcomparingBookingWithPrevSumm(month: TotalBookingMonths, index: number)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

Properties

PropertyType
_widgetWidget
_widgetTypestring
withoutOptionBarboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
allowedtoEditboolean
allowedtoEnableEdtingboolean
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
subscriptionSubscription
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsTotalBookingMonths[]
tempTotalMonthTotalBookingMonths

Where it refuses work

  • MrmFinanceLgComponent stops the work with an early return when month.MonthId == 12.
  • MrmFinanceLgComponent stops the work with an early return when month[propertyName] < this.data[bIndex].MrmLGs[monthIndex - 1][propertyName].
  • MrmFinanceLgComponent stops the work with an early return when month.TotalAmountMonth < this.totalBookingMonths[index - 1].TotalAmountMonth.
  • MrmFinanceLgComponent stops the work with an early return when month[propertyName] < this.totalBookingMonths[index - 1][propertyName].
  • MrmFinanceLgComponent stops the work with an early return when month.MonthId >= new Date().getMonth() + 1.
  • MrmFinanceLgComponent stops the work with an early return when month.MonthId <= new Date().getMonth() + 1.

Diagram

mermaid
graph LR
  Lifecycle[Angular lifecycle] --> Init[ngOnInit]
  Lifecycle --> Changes[ngOnChanges]
  Lifecycle --> Destroy[ngOnDestroy]

  Init --> Fetch[getDashboardData]
  Changes --> Fetch
  Fetch --> Initialize[initalizingData]

  Initialize --> Performance[calculatePerformancePer]
  Initialize --> Month[translateMonthName]
  Initialize --> Price[getpriceFormatted]

  Resize[onResize] --> Cache[setChaching]
  Destroy --> Cache

Usage

ts
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MrmFinanceLgComponent } from './mrm-finance-lg.component';

describe('MrmFinanceLgComponent', () => {
  let fixture: ComponentFixture<MrmFinanceLgComponent>;
  let component: MrmFinanceLgComponent;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [MrmFinanceLgComponent],
    }).compileComponents();

    fixture = TestBed.createComponent(MrmFinanceLgComponent);
    component = fixture.componentInstance;

    fixture.detectChanges();
  });

  it('loads and formats dashboard data', () => {
    component.getDashboardData();

    const performance = component.calculatePerformancePer();
    const monthName = component.translateMonthName();
    const formattedPrice = component.getpriceFormatted();

    expect(performance).toBeDefined();
    expect(monthName).toBeDefined();
    expect(formattedPrice).toBeDefined();
  });
});

AI Coding Instructions

  • Keep data retrieval inside getDashboardData() and prepare widget state through initalizingData().
  • Recalculate display-dependent values after input changes and resize events when the rendered layout depends on them.
  • Preserve the existing lifecycle cleanup in ngOnDestroy() and keep cache handling in setChaching().
  • Use calculatePerformancePer(), translateMonthName(), and getpriceFormatted() for display values instead of duplicating formatting logic in templates.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1

Was this page helpful?

Download as PDF
MrmFinanceLgComponent — PAMS Documentation Test