Skip to content

MrmAccountPayableComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Frontend

MrmAccountPayableComponent is a dashboard widget component that loads, initializes, saves, and aggregates account payable data. It also manages available currencies and checks whether the current feature subscription allows the widget to be used.

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

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

Diagram

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

Usage

ts
import { MrmAccountPayableComponent } from './mrm-account-payable.component';

// Angular creates the component and runs lifecycle hooks.
// Call dashboard actions from event handlers or surrounding dashboard logic.
function refreshPayables(
  component: MrmAccountPayableComponent
): void {
  if (!component.checkFeatureSubscription()) {
    return;
  }

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

// Example action for adding a currency through the widget.
function addCurrency(component: MrmAccountPayableComponent): void {
  component.AddNewCurrency();
  component.saveDashboardData();
}

AI Coding Instructions

  • Keep subscription validation through checkFeatureSubscription() before loading or editing account payable widget data.
  • Use ngOnInit() for initial widget setup and ngOnChanges() when input-driven dashboard state changes.
  • Preserve the existing initialization flow: load dashboard data, run initalizingData(), then calculate yearly and monthly totals.
  • Call saveDashboardData() after changes that should persist, including currency updates from AddNewCurrency().
  • Keep currency retrieval in getCurrencies() so dashboard currency state remains managed by the component.

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