Skip to content

MRMCashFlowComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Pams

MRMCashFlowComponent manages the cash-flow widget in the dashboard. It loads and initializes dashboard data, builds monthly summaries, calculates totals by month and year, saves changes, and reads the currency rate from dashboard header data.

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
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

  • 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].
  • MRMCashFlowComponent stops the work with an early return when month[propertyName] < this.data.LGsSummary[monthIndex - 1][propertyName].

Diagram

mermaid
graph LR
  Init[ngOnInit / ngOnChanges] --> Load[getDashboardData]
  Load --> Initialize[initalizingData]
  Initialize --> Summary[fillMonthsSummery]
  Summary --> MonthTotals[calculateSumByMonth]
  Summary --> YearTotals[calculateSumByYear]
  Initialize --> Currency[getCurrencyRateFromHeader]
  Save[saveDashboardData] --> Load
  Destroy[ngOnDestroy] --> Cleanup[Release subscriptions or state]

Usage

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

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

// Angular runs lifecycle hooks during change detection.
fixture.detectChanges();

// Refresh dashboard cash-flow data after an external dashboard update.
component.getDashboardData();

// Persist changes made to the widget data.
component.saveDashboardData();

AI Coding Instructions

  • Keep data loading in getDashboardData() and initialize derived widget state through initalizingData().
  • Call fillMonthsSummery() after changing source cash-flow data so month totals remain aligned with the displayed data.
  • Use calculateSumByMonth() and calculateSumByYear() for totals rather than duplicating aggregation logic in templates.
  • Read exchange-rate values through getCurrencyRateFromHeader() so calculations use dashboard header configuration.
  • Preserve cleanup behavior in ngOnDestroy() when adding subscriptions, timers, or other component resources.

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