Skip to content

MRMCashFlowComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-cash-flow/mrm-cash-flow.component.ts (line 147)

Part of: Frontend

MRMCashFlowComponent is an Angular dashboard widget that loads, prepares, and saves MRM cash-flow data. It checks feature subscription access, builds monthly and yearly summaries, and derives currency rates from dashboard header data.

Extends: BaseWidgetComponent

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
ngOnChangesngOnChanges()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
isCurrentMonthisCurrentMonth(month: MonthsSum)boolean
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthsSum, supplierId: number)void
viewSelectedMonthPrepareviewSelectedMonthPrepare(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
yearIdnumber
periodIdnumber
countOfEditablePrevMonthsnumber
withoutOptionBarboolean
editModeboolean
viewDetailsModeboolean
cashFlowDisplaynumber
bookingOrSalesnumber
byGroupsboolean
isPamsDataboolean
selectedTeamnumber
forecastRuleIdnumber
dataBranchData
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetViewRequestany
widgetEditEndany
forecastRulesany[]
currenciesCompanyCurrency[]
selectedYearnumber
currentMonthIndexnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
originalDataBranchData
selectedDataBranchData
monthsSummeryMonthsSum[]
branchCurrencyany
salesCurrencyany
basedOnTendencyboolean
SeriseRangeany[]
echartsIntanceany
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
totalProfitAndLossAmountnumber
totalOthersnumber
totalTotalSGAndAnumber
totalFORXnumber
totalTotalnumber
totalCumulativenumber
totalPercentageUsedBudgetnumber
popupany
searchTextstring
DateDisplayFormatForTypeScriptstring

Where it refuses work

  • MRMCashFlowComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • MRMCashFlowComponent stops the work with an early return when findMonthIndex > -1.
  • MRMCashFlowComponent stops the work with an early return when MonthId == 12.
  • MRMCashFlowComponent stops the work with an early return when month[propertyName] < this.data.BanksSummary[monthIndex - 1][propertyName].
  • MRMCashFlowComponent stops the work with an early return when month[propertyName] < this.data.ReceivablesSummary[monthIndex - 1][propertyName].
  • MRMCashFlowComponent stops the work with an early return when month[propertyName] < this.data.PayablesSummary[monthIndex - 1][propertyName].

Diagram

mermaid
graph LR
  A[Angular lifecycle] --> B[ngOnInit]
  A --> C[ngOnChanges]
  B --> D[checkFeatureSubscription]
  D --> E[getDashboardData]
  E --> F[initalizingData]
  F --> G[fillMonthsSummery]
  G --> H[calculateSumByMonth]
  G --> I[calculateSumByYear]
  E --> J[getCurrencyRateFromHeader]
  F --> K[saveDashboardData]

Usage

ts
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MRMCashFlowComponent } from './mrm-cash-flow.component';

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

  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [MRMCashFlowComponent],
    });

    fixture = TestBed.createComponent(MRMCashFlowComponent);
    component = fixture.componentInstance;
  });

  it('loads and summarizes dashboard cash-flow data', () => {
    fixture.detectChanges();

    if (component.checkFeatureSubscription()) {
      component.getDashboardData();
      component.fillMonthsSummery();
      component.calculateSumByMonth();
      component.calculateSumByYear();
      component.saveDashboardData();
    }
  });
});

AI Coding Instructions

  • Check checkFeatureSubscription() before requesting or displaying cash-flow data.
  • Keep data preparation in initalizingData() and fillMonthsSummery() so monthly and yearly calculations operate on the same state.
  • Call getDashboardData() when relevant dashboard inputs change through ngOnChanges().
  • Read exchange-rate values through getCurrencyRateFromHeader() rather than duplicating header parsing logic.
  • Preserve the existing save flow by updating component data before calling saveDashboardData().

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)

  • DashboardWidgetsModuleFrontend/src/app/components/dashboard/dashboard-widgets.module.ts:1
  • ReportsTabComponentFrontend/src/app/components/reports/reports-library/reports-tab/reports-tab.component.ts:1

Was this page helpful?

Download as PDF