Skip to content

CompanyCurrencyService

reference
1 min readUpdated

Kind: Class

Source: Frontend/src/app/services/organization/company-currency.service.ts (line 15)

Part of: Frontend

CompanyCurrencyService manages company currency data and currency-rate retrieval within the organization area of the frontend. It exposes methods for loading currency records, reading rates, saving or deleting company currency entries, and calculating a currency-rate value.

Methods

MethodSignatureReturns
retrieveFromCurrencyRateToCurrencyretrieveFromCurrencyRateToCurrency(currenciesListWithRates: CurrenciesWithRates[], fromCurrencyCode: string, toCurrencyCode: string)number
getCompanyCurrencyServicegetCompanyCurrencyService(id: number)void
getAllCurrencyWithRatesgetAllCurrencyWithRates()void
getCompanyCurrencyByIdServicegetCompanyCurrencyByIdService(id: number)void
saveCompanyCurrencyServicesaveCompanyCurrencyService(entity: CompanyCurrency)void
deleteCompanyCurrencyServicedeleteCompanyCurrencyService(id: number)void

Diagram

mermaid
graph LR
  Component[Organization Component] --> Service[CompanyCurrencyService]
  Service --> Rates[getAllCurrencyWithRates]
  Service --> CompanyCurrency[getCompanyCurrencyService]
  Service --> CurrencyById[getCompanyCurrencyByIdService]
  Service --> Save[saveCompanyCurrencyService]
  Service --> Delete[deleteCompanyCurrencyService]
  Service --> RateValue[retrieveFromCurrencyRateToCurrency]

Usage

ts
import { Component } from '@angular/core';
import { CompanyCurrencyService } from 'src/app/services/organization/company-currency.service';

@Component({
  selector: 'app-company-currency',
  template: `<!-- currency content -->`,
})
export class CompanyCurrencyComponent {
  constructor(
    private readonly companyCurrencyService: CompanyCurrencyService,
  ) {}

  loadCurrencies(): void {
    const currencies = this.companyCurrencyService.getAllCurrencyWithRates();
    const rateValue: number =
      this.companyCurrencyService.retrieveFromCurrencyRateToCurrency();

    console.log(currencies, rateValue);
  }

  saveCurrency(): void {
    this.companyCurrencyService.saveCompanyCurrencyService();
  }

  removeCurrency(): void {
    this.companyCurrencyService.deleteCompanyCurrencyService();
  }
}

AI Coding Instructions

  • Inject CompanyCurrencyService through the Angular constructor instead of creating it directly.
  • Use getAllCurrencyWithRates() when a screen needs currency entries together with their rates.
  • Keep currency save and delete actions in component handlers or related state-management flows.
  • Treat retrieveFromCurrencyRateToCurrency() as a number value and avoid changing its return contract.

Used by

15 references from 15 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (15)

  • CompanyCurrencyComponentFrontend/src/app/components/configuration/commercial/company-currency/company-currency.component.ts:1
  • NewBranchComponentFrontend/src/app/components/configuration/company/main-branch/new.branch.component.ts:1
  • GenericConfigurationComponentFrontend/src/app/components/configuration/generic-configuration/generic-configuration.component.ts:1
  • BranchDataFrontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-account-payable/mrm-account-payable.component.ts:1
  • BranchDataFrontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-account-receivable/mrm-account-receivable.component.ts:1
  • DirectCostTransactionsDetailsComponentFrontend/src/app/components/job-costing/direct-cost-transactions-details/direct-cost-transactions-details.component.ts:1
  • AccountDetailsComponentFrontend/src/app/components/market/account-details/account-details.component.ts:1
  • DecreasedTableComponentFrontend/src/app/components/market/account-details/decreased-table/decreased-table.component.ts:1

…and 7 more.

Was this page helpful?

Download as PDF