Kind: Class
Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-net-profit/mrm-net-profit.component.ts (line 94)
Part of: Frontend
MrmNetProfitComponent is a dashboard widget component for presenting net-profit data. It checks feature subscription access, loads and saves dashboard data, calculates month and year totals, and formats month and price display values.
Extends: BaseWidgetComponent
Methods
| Method | Signature | Returns |
|---|---|---|
checkFeatureSubscription | checkFeatureSubscription() | boolean |
ngOnInit | ngOnInit() | void |
ngOnChanges | ngOnChanges() | void |
getDashboardData | getDashboardData() | void |
initalizingData | initalizingData(value: BranchData[]) | void |
saveDashboardData | saveDashboardData() | void |
calculateSumByYear | calculateSumByYear() | void |
calculateSumByMonth | calculateSumByMonth(monthIndex: number) | void |
translateMonthName | translateMonthName(month: BranchData) | string |
getpriceFormatted | getpriceFormatted(x: undefined) | string |
onResize | onResize() | void |
setChaching | setChaching() | void |
getChaching | getChaching() | void |
switchChartTypeHandler | switchChartTypeHandler() | void |
switchBasedOnTendencyHandler | switchBasedOnTendencyHandler() | void |
comparingWithPrevMonth | comparingWithPrevMonth(month: BranchData, bIndex: number, propertyName: string) | string |
comparingBookingWithPrevSumm | comparingBookingWithPrevSumm(month: MonthsSum, index: number, propertyName: string) | string |
isCurrentMonth | isCurrentMonth(month: MonthData) | boolean |
getpriceForecastAmount | getpriceForecastAmount(month: MonthData) | number |
expectedCurrencyChange | expectedCurrencyChange(e: undefined) | void |
selectText | selectText(e: undefined) | void |
editSelectedMonthPrepare | editSelectedMonthPrepare(month: MonthData, supplierId: number) | void |
openPopup | openPopup(n: string, t: string, i: string, btnTxt: string) | void |
savePopup | savePopup() | void |
ClosewithDonotSave | ClosewithDonotSave() | void |
OnOpenedPopup | OnOpenedPopup() | void |
closePopup | closePopup() | void |
Properties
| Property | Type |
|---|---|
sharedPopup | SharedPopupComponent |
_widget | Widget |
_widgetType | string |
yearId | number |
periodId | number |
countOfEditablePrevMonths | number |
withoutOptionBar | boolean |
editMode | boolean |
bookingOrSales | number |
withNominal | boolean |
selectedTeam | number |
forecastRuleId | number |
allowedtoEdit | boolean |
allowedtoEnableEdting | boolean |
widgetEditRequest | any |
widgetEditEnd | any |
forecastRules | any[] |
selectedYear | number |
numYearsDatasource | any[] |
todayWidgetsEnum | any |
cachingWidgetData | CachingWidgetData |
data | BranchData[] |
originalData | BranchData[] |
selectedData | BranchData[] |
singleMonths | MonthData |
branchCurrency | any |
basedOnTendency | boolean |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | MonthsSum[] |
tempMonthSum | MonthsSum |
totalTargets | number |
yearBooking | number |
totalForecasts | number |
tempTotalTarget | TotalTargets |
totalOthers | number |
totalDepreciationAmount | number |
totalTotalCogsAmount | number |
totalGrossMarginAmount | number |
totalTotalCogsAchieved | number |
totalTotalNetProfitAmount | number |
totalTotalNetProfitAchieved | number |
totalTotalDepreciationAmount | number |
totalTotalDepreciationAchieved | number |
totalTotalFORXAmount | number |
totalTotalFORXAchieved | number |
totalTotalEBITAmount | number |
totalIncomeTAXAmount | number |
totalProfitAmountBeforeTax | number |
totalTotalEBITDAAmount | number |
Where it refuses work
MrmNetProfitComponentstops the work with an early return whenthis.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).MrmNetProfitComponentstops the work with an early return whenmonth.MonthId == 12.MrmNetProfitComponentstops the work with an early return whenmonth[propertyName] < this.data[bIndex - 1][propertyName].MrmNetProfitComponentstops the work with an early return whenmonth[propertyName] < this.totalBookingMonths[index - 1][propertyName].MrmNetProfitComponentstops the work with an early return whenAppSettings.calculateMonthsBeforeToday(month.YearId, month.MonthId -1) == 0 || AppSetting….
Diagram
mermaidgraph LR A[Angular lifecycle] --> B[ngOnInit] A --> C[ngOnChanges] B --> D[checkFeatureSubscription] C --> E[getDashboardData] D --> E E --> F[initalizingData] F --> G[calculateSumByYear] F --> H[calculateSumByMonth] F --> I[translateMonthName] F --> J[getpriceFormatted] F --> K[saveDashboardData]
Usage
tsimport { MrmNetProfitComponent } from './mrm-net-profit.component';
// Obtain the component instance through Angular component composition,
// a test fixture, or another supported application integration point.
const netProfitWidget = {} as MrmNetProfitComponent;
if (netProfitWidget.checkFeatureSubscription()) {
netProfitWidget.getDashboardData();
netProfitWidget.calculateSumByYear();
netProfitWidget.calculateSumByMonth();
const monthLabel = netProfitWidget.translateMonthName();
const formattedPrice = netProfitWidget.getpriceFormatted();
console.log({ monthLabel, formattedPrice });
}
AI Coding Instructions
- Check
checkFeatureSubscription()before requesting or displaying net-profit dashboard data. - Keep data loading in
getDashboardData()and initialization ininitalizingData()so lifecycle handlers remain focused. - Preserve the existing
initalizingData()method name unless all callers are updated together. - Recalculate totals through
calculateSumByYear()andcalculateSumByMonth()after changing the underlying dashboard data. - Use
translateMonthName()andgetpriceFormatted()for display values instead of duplicating formatting logic.
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)
DashboardWidgetsModule—Frontend/src/app/components/dashboard/dashboard-widgets.module.ts:1
Was this page helpful?