Skip to content

MrmAccountReceivableComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-account-receivable/mrm-account-receivable.component.ts (line 77)

Part of: Frontend

MrmAccountReceivableComponent manages the accounts receivable dashboard widget. It checks feature access, loads currencies and dashboard data, prepares data for display, calculates year and month totals, and saves dashboard configuration changes.

Extends: BaseWidgetComponent

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
getCurrenciesgetCurrencies()void
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData)void
saveDashboardDatasaveDashboardData()void
calculateSumByYearcalculateSumByYear()void
calculateSumByMonthcalculateSumByMonth(monthIndex: number)void
AddNewCurrencyAddNewCurrency(account: number, SalesCom: number)void
onCurrencyChangedonCurrencyChanged(e: undefined, account: number, SalesCom: number, currencyIndex: number)void
translateMonthNametranslateMonthName(MonthId: number)string
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
switchByGroupsHandlerswitchByGroupsHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, accountIndex: number, salesComIndex: number, currencyIndex: number, monthIndex: number, propertyName: string)string
comparingSummeryWithPrevMonthcomparingSummeryWithPrevMonth(month: MonthData, monthIndex: number, propertyName: string)string
isCurrentMonthisCurrentMonth(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthData, supplierId: number)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
bookingOrSalesnumber
byGroupsboolean
selectedTeamnumber
forecastRuleIdnumber
dataBranchData
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
forecastRulesany[]
currenciesCompanyCurrency[]
selectedYearnumber
currentMonthIndexnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
originalDataBranchData
selectedDataBranchData
singleMonthsMonthData
monthsSummeryMonthsSum[]
nonGroupAccountReceivablesMonthData[]
branchCurrencyany
basedOnTendencyboolean
SeriseRangeany[]
echartsIntanceany
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
totalProfitAndLossAmountnumber
totalOthersnumber
totalTotalSGAndAnumber
totalFORXnumber
totalTotalnumber
totalCumulativenumber
totalPercentageUsedBudgetnumber
popupany
searchTextstring
urrenFeaturenumber

Where it refuses work

  • MrmAccountReceivableComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • MrmAccountReceivableComponent stops the work with an early return when MonthId == 12.
  • MrmAccountReceivableComponent stops the work with an early return when month[propertyName] < this.data.Products.Currencies[currencyIndex].Details[monthIndex - 1….
  • MrmAccountReceivableComponent stops the work with an early return when month[propertyName] < this.data.Scrap.Currencies[currencyIndex].Details[monthIndex - 1][p….
  • MrmAccountReceivableComponent stops the work with an early return when month[propertyName] < this.monthsSummery[monthIndex - 1][propertyName].
  • MrmAccountReceivableComponent stops the work with an early return when AppSettings.calculateMonthsBeforeToday(month.YearId, month.MonthId -1) == 0 || AppSetting….

Diagram

mermaid
graph LR
  Init[ngOnInit] --> Subscription[checkFeatureSubscription]
  Subscription --> Currencies[getCurrencies]
  Subscription --> Dashboard[getDashboardData]
  Dashboard --> Initialize[initalizingData]
  Initialize --> YearTotals[calculateSumByYear]
  Initialize --> MonthTotals[calculateSumByMonth]
  Changes[ngOnChanges] --> Dashboard
  CurrencyAction[AddNewCurrency] --> Currencies
  Save[saveDashboardData] --> Dashboard

Usage

ts
import { MrmAccountReceivableComponent } from './mrm-account-receivable.component';

function refreshReceivableWidget(
  widget: MrmAccountReceivableComponent,
): void {
  if (!widget.checkFeatureSubscription()) {
    return;
  }

  widget.getCurrencies();
  widget.getDashboardData();
  widget.calculateSumByYear();
  widget.calculateSumByMonth();
}

// Call from an Angular host component after obtaining the widget instance.
function saveWidgetSettings(widget: MrmAccountReceivableComponent): void {
  widget.saveDashboardData();
}

AI Coding Instructions

  • Keep dashboard loading behind checkFeatureSubscription() so unavailable features do not request or display receivable data.
  • Preserve the Angular lifecycle flow: use ngOnInit() for initial loading and ngOnChanges() when input-driven dashboard state changes.
  • Run initalizingData() before calculating totals when replacing dashboard data, so month and year calculations operate on current state.
  • Refresh currency-related state after AddNewCurrency() by calling getCurrencies() when the UI needs the updated list.
  • Keep saveDashboardData() aligned with the same dashboard state shape returned by getDashboardData().

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)

  • DashboardTabComponentFrontend/src/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1
  • 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