# PaymentDetailsComponent

**Kind:** Class

**Source:** `Pams/Web/Pams.Web/Client/app/components/payments/payment-details/payment-details.component.ts` (line 55)

**Part of:** [Pams](subsystem-pams)

`PaymentDetailsComponent` manages the payment-details view in the PAMS web client. It loads payment records, currencies, authorization state, and opened tabs, then prepares table data and edit controls for the user interface.

**Implements:** `OnInit`, `ComponentCanDeactivate`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `GetAuthorizationAccess` | `GetAuthorizationAccess(url: string)` | `void` |
| `checkAllowedToEdit` | `checkAllowedToEdit()` | `void` |
| `ngOnInit` | `ngOnInit()` | `void` |
| `getRecord` | `getRecord()` | `void` |
| `getOpenedTabs` | `getOpenedTabs()` | `void` |
| `reset` | `reset()` | `void` |
| `openLibrary` | `openLibrary()` | `void` |
| `getCurrencies` | `getCurrencies()` | `void` |
| `fillTableView` | `fillTableView()` | `void` |
| `disablingAllocatedAmount` | `disablingAllocatedAmount()` | `void` |
| `fillColumns` | `fillColumns()` | `void` |
| `cellUpdated_Handler` | `cellUpdated_Handler(e: InvoicesForPayment)` | `void` |
| `ifInOwnCurrency` | `ifInOwnCurrency(dataField: undefined)` | `boolean` |
| `displayFormattedCurrency` | `displayFormattedCurrency(value: undefined, dataField: undefined, rowData: undefined)` | `void` |
| `formatCells` | `formatCells(e: undefined)` | `void` |
| `getClients` | `getClients()` | `void` |
| `getPrinciples` | `getPrinciples()` | `void` |
| `getReceivingMethod` | `getReceivingMethod()` | `void` |
| `selectText` | `selectText(e: undefined)` | `void` |
| `applyFilter` | `applyFilter()` | `void` |
| `onKeyDown` | `onKeyDown(e: KeyboardEvent)` | `void` |
| `getPaymentByPaymentID` | `getPaymentByPaymentID()` | `void` |
| `changeTabs` | `changeTabs(targetTab: undefined)` | `void` |
| `savePayment` | `savePayment(SaveAndLeave: undefined)` | `void` |
| `ValidatePayment` | `ValidatePayment()` | `boolean` |
| `SelectAccount` | `SelectAccount(ID: undefined)` | `void` |
| `DeSelectAccount` | `DeSelectAccount(ID: undefined)` | `void` |
| `GetInvoicesbyAccountID` | `GetInvoicesbyAccountID(withoutNewAllocated: boolean)` | `void` |
| `AutomaticAmountDivision` | `AutomaticAmountDivision()` | `void` |
| `display` | `display(data: undefined)` | `void` |
| `DataChanged` | `DataChanged()` | `void` |
| `gridItem_KeyPress_Number` | `gridItem_KeyPress_Number(event: undefined)` | `void` |
| `chanegRecievingMethod` | `chanegRecievingMethod(e: undefined)` | `void` |
| `getCurrencyRate` | `getCurrencyRate(currency: CurrencyRate)` | `void` |
| `currencyChanged` | `currencyChanged(e: undefined)` | `void` |
| `enteringAmount` | `enteringAmount(e: undefined)` | `void` |
| `ngOnDestroy` | `ngOnDestroy()` | `void` |
| `openPopup` | `openPopup(n: string, t: string, i: string, btnTxt: string)` | `void` |
| `OnOpenedPopup` | `OnOpenedPopup()` | `void` |
| `savePopup` | `savePopup()` | `void` |
| `check` | `check()` | `void` |
| `closePopup` | `closePopup()` | `void` |
| `saveAndClose` | `saveAndClose()` | `void` |
| `close` | `close()` | `void` |
| `leavePage` | `leavePage()` | `void` |
| `ClosewithDonotSave` | `ClosewithDonotSave()` | `void` |
| `canDeactivate` | `canDeactivate()` | `void` |
| `changeRateAssistantList` | `changeRateAssistantList(e: undefined, index: number)` | `void` |
| `selectNumber` | `selectNumber(e: undefined, input: undefined)` | `void` |
| `disSelectNumber` | `disSelectNumber(e: undefined, input: undefined)` | `void` |

## Properties

| Property | Type |
|---|---|
| `alerts` | `AlertsComponent` |
| `sharedPopup` | `SharedPopupComponent` |
| `DataValidator` | `DxValidationGroupComponent` |
| `FileLibrary` | `FilesComponent` |
| `attachedDropdown` | `SharedAttachedDocsComponent` |
| `environment` | `any` |
| `RelatedToType` | `any` |
| `displayedInvoices` | `InvoicesForPayment[]` |
| `allocateddInvoices` | `InvoicesForPayment[]` |
| `checkChangesInvoices` | `InvoicesForPayment[]` |
| `allowedtoEdit` | `boolean` |
| `allowedtoNew` | `boolean` |
| `IsNewPayment` | `boolean` |
| `paymentID` | `number` |
| `_passIdAsInput` | `number` |
| `firstInitialized` | `boolean` |
| `EnableEditingMode` | `boolean` |
| `disabledNewAllocation` | `boolean` |
| `popup` | `any` |
| `receivingPaymentMethod` | `ReceivingMethod[]` |
| `recevingMethodsEnum` | `any` |
| `ModuleEnumId` | `any` |
| `LogModuleId` | `any` |
| `selectedDocs` | `FileData[]` |
| `payment` | `PaymentDetails` |
| `oldPayment` | `PaymentDetails` |
| `CompletelyAllocatedInvoices` | `string[]` |
| `dataSource` | `any` |
| `idColumnsName` | `any` |
| `selectedIDs` | `any[]` |
| `clientList` | `Client[]` |
| `principalList` | `Supplier[]` |
| `NoChange_CanLeave` | `boolean` |
| `Change_Saved_CanLeave` | `boolean` |
| `Change_NoSave_WantLeave` | `boolean` |
| `isLeaving` | `boolean` |
| `allowleave` | `boolean` |
| `Changed` | `boolean` |
| `DateDisplayFormat` | `any` |
| `salesInvoiceType` | `boolean` |
| `tabsSwitch` | `string` |
| `LodingPanalMessage` | `any` |
| `loadingVisible` | `any` |
| `subscription` | `Subscription` |
| `currencyRate` | `CurrencyRate` |
| `defaultCurrency` | `any` |
| `isProcessActiveBoolean` | `boolean` |
| `advColumns` | `AdvColumn[]` |
| `advColumnInvoiceNo` | `AdvColumn` |
| `advColumnInvoiceDate` | `AdvColumn` |

## Where it refuses work

- `PaymentDetailsComponent` stops the work with an early return when `this.allowedtoEdit`.
- `PaymentDetailsComponent` stops the work with an early return when `this.allowedtoNew`.
- `PaymentDetailsComponent` stops the work with an early return when `dataField == "TotalAmount" || dataField == "PaidAmount" || dataField == "DeductionAmount"…`.
- `PaymentDetailsComponent` stops the work with an early return when `!this.ValidatePayment()`.
- `PaymentDetailsComponent` stops the work with an early return when `this.NoChange_CanLeave`.
- `PaymentDetailsComponent` stops the work with an early return when `this.Change_Saved_CanLeave`.

## Diagram

```mermaid
graph LR
    A[PaymentDetailsComponent] --> B[ngOnInit]
    B --> C[GetAuthorizationAccess]
    B --> D[getRecord]
    B --> E[getOpenedTabs]
    B --> F[getCurrencies]
    D --> G[fillTableView]
    C --> H[checkAllowedToEdit]
    G --> I[disablingAllocatedAmount]
    A --> J[openLibrary]
    A --> K[reset]
```

## Usage

```ts
import { TestBed } from '@angular/core/testing';
import { PaymentDetailsComponent } from './payment-details.component';

const fixture = TestBed.createComponent(PaymentDetailsComponent);
const component = fixture.componentInstance;

// Runs component initialization and loads payment-related data.
fixture.detectChanges();

// Open the related library view when needed.
component.openLibrary();

// Reset the payment-details state.
component.reset();
```

## AI Coding Instructions

- Keep initialization work in `ngOnInit()` and preserve the existing loading order for authorization, records, tabs, and currencies.
- Call `checkAllowedToEdit()` after authorization data is available before enabling payment-detail edits.
- Update `fillTableView()` when changing the record shape or table columns so displayed payment data remains aligned with the source record.
- Review `disablingAllocatedAmount()` when changing allocation rules or edit-state behavior.
- Keep `reset()` and `openLibrary()` aligned with the navigation and state-management patterns used by surrounding payment components.

## Used by

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

### Imported by (2)

- `AppRoutingModule` — `Pams/Web/Pams.Web/Client/app/app-routing.module.ts`:1
- `TranslateHandler` — `Pams/Web/Pams.Web/Client/app/app.module.ts`:1
