Kind: Class
Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-net-profit/mrm-net-profit.component.ts (line 93)
Part of: Pams
MrmNetProfitComponent is a dashboard widget component for loading, initializing, saving, and summarizing MRM net-profit data. It checks authorization access, responds to Angular lifecycle events, calculates totals by year or month, and translates month names for display.
Methods
| Method | Signature | Returns |
|---|---|---|
GetAuthorizationAccess | GetAuthorizationAccess(url: string) | void |
ngOnInit | ngOnInit() | void |
ngOnChanges | ngOnChanges() | void |
ngOnDestroy | ngOnDestroy() | 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 |
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 |
subscription | Subscription |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | MonthsSum[] |
tempMonthSum | MonthsSum |
totalTargets | number |
yearBooking | number |
totalForecasts | number |
tempTotalTarget | TotalTargets |
totalOthers | number |
totalDepreciationAmount | number |
totalTotalCogsAmount | number |
totalTotalCogsAchieved | number |
totalTotalNetProfitAmount | number |
totalTotalNetProfitAchieved | number |
totalTotalDepreciationAmount | number |
totalTotalDepreciationAchieved | number |
totalTotalFORXAmount | number |
totalTotalFORXAchieved | number |
totalTotalEBITAmount | number |
totalIncomeTAXAmount | number |
totalTotalEBITDAAmount | number |
totalTotalEBITAchieved | number |
totalTotalEBITDAAchieved | number |
totalTotalSalesAmount | number |
totalTotalSalesAchieved | number |
Where it refuses work
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 whenthis.allowedtoEnableEdting.MrmNetProfitComponentstops the work with an early return whenthis.allowedtoEdit.
Diagram
mermaidgraph LR Angular[Angular lifecycle] --> Init[ngOnInit] Angular --> Changes[ngOnChanges] Angular --> Destroy[ngOnDestroy] Init --> Access[GetAuthorizationAccess] Access --> Load[getDashboardData] Load --> Initialize[initalizingData] Initialize --> YearTotal[calculateSumByYear] Initialize --> MonthTotal[calculateSumByMonth] Initialize --> MonthLabel[translateMonthName] Widget[Dashboard interaction] --> Save[saveDashboardData]
Usage
tsimport { Component, ViewChild } from '@angular/core';
import { MrmNetProfitComponent } from './mrm-net-profit.component';
@Component({
selector: 'app-dashboard-page',
template: `
<app-mrm-net-profit #netProfitWidget></app-mrm-net-profit>
<button type="button" (click)="refreshNetProfit()">
Refresh net profit
</button>
<button type="button" (click)="saveNetProfit()">
Save dashboard settings
</button>
`
})
export class DashboardPageComponent {
@ViewChild('netProfitWidget')
netProfitWidget!: MrmNetProfitComponent;
refreshNetProfit(): void {
this.netProfitWidget.getDashboardData();
}
saveNetProfit(): void {
this.netProfitWidget.saveDashboardData();
}
}
AI Coding Instructions
- Let Angular invoke
ngOnInit,ngOnChanges, andngOnDestroy; do not call lifecycle hooks from feature code. - Check
GetAuthorizationAccess()before adding data-loading behavior that exposes dashboard values. - Keep data preparation in
initalizingData()aftergetDashboardData()so calculated values use loaded data. - Use
calculateSumByYear()andcalculateSumByMonth()for dashboard totals rather than duplicating aggregation logic in templates. - Keep month display formatting in
translateMonthName()so month labels remain consistent across the widget.
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)
TranslateHandler—Pams/Web/Pams.Web/Client/app/app.module.ts:1
Was this page helpful?