180 lines
7.9 KiB
HTML
180 lines
7.9 KiB
HTML
<!--
|
|
Copyright since 2025 Mifos Initiative
|
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
-->
|
|
|
|
<!-- TODO: Responsiveness/design enhancement and reduction in form loading time -->
|
|
<div class="container">
|
|
<mat-card>
|
|
<form [formGroup]="openingBalancesForm" (ngSubmit)="submit()">
|
|
<mat-card-content>
|
|
<div #searchFormRef class="layout-row-wrap responsive-column gap-2px">
|
|
<div class="m-r-30 flex-83">
|
|
<mat-form-field class="flex-96">
|
|
<mat-label>{{ 'labels.inputs.Office' | translate }}</mat-label>
|
|
<mat-select required formControlName="officeId">
|
|
@for (office of officeData; track office) {
|
|
<mat-option [value]="office.id">
|
|
{{ office.name }}
|
|
</mat-option>
|
|
}
|
|
</mat-select>
|
|
@if (openingBalancesForm.controls.officeId.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
</div>
|
|
|
|
<div class="flex-15">
|
|
<button mat-raised-button color="primary" (click)="retrieveOpeningBalances()">
|
|
{{ 'labels.buttons.Retrieve' | translate }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
@if (openingBalancesData) {
|
|
<div class="layout-row-wrap gap-2percent responsive-column">
|
|
<mifosx-gl-account-display
|
|
class="flex-100"
|
|
[accountTitle]="'Opening Balances Contra Account'"
|
|
[glAccount]="openingBalancesData.contraAccount"
|
|
[withTitle]="'50%'"
|
|
>
|
|
</mifosx-gl-account-display>
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Currency' | translate }}</mat-label>
|
|
<mat-select required formControlName="currencyCode">
|
|
@for (currency of currencyData; track currency) {
|
|
<mat-option [value]="currency.code">
|
|
{{ currency.displayLabel }}
|
|
</mat-option>
|
|
}
|
|
</mat-select>
|
|
@if (openingBalancesForm.controls.currencyCode.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Currency' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
<mat-form-field class="flex-48" (click)="openingBalancesDatePicker.open()">
|
|
<mat-label>{{ 'labels.inputs.Opening Balances Date' | translate }}</mat-label>
|
|
<input
|
|
matInput
|
|
[min]="minDate"
|
|
[max]="maxDate"
|
|
[matDatepicker]="openingBalancesDatePicker"
|
|
required
|
|
formControlName="transactionDate"
|
|
/>
|
|
<mat-datepicker-toggle matSuffix [for]="openingBalancesDatePicker"></mat-datepicker-toggle>
|
|
<mat-datepicker #openingBalancesDatePicker></mat-datepicker>
|
|
@if (openingBalancesForm.controls.transactionDate.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Opening Balances Date' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
<div class="layout-row-wrap gap-2percent responsive-column flex-100 content">
|
|
<div class="header flex-8">
|
|
{{ 'labels.inputs.Type' | translate }}
|
|
</div>
|
|
<div class="header flex-18">
|
|
{{ 'labels.inputs.GL Code' | translate }}
|
|
</div>
|
|
<div class="header flex-18">
|
|
{{ 'labels.inputs.GL Name' | translate }}
|
|
{{ 'labels.inputs.Account' | translate }}
|
|
</div>
|
|
<div class="header r-amount flex-18">
|
|
{{ 'labels.inputs.Total Debit' | translate }}:
|
|
{{ debitsSum | currency: currencyCode : 'symbol-narrow' : '1.2-2' }}
|
|
</div>
|
|
<div class="header r-amount flex-23">
|
|
{{ 'labels.inputs.Total Credit' | translate }}:
|
|
{{ creditsSum | currency: currencyCode : 'symbol-narrow' : '1.2-2' }}
|
|
</div>
|
|
</div>
|
|
@for (credit of glAccountEntries.controls; track credit; let i = $index) {
|
|
<div class="flex-fill layout-row-wrap responsive-column content" formArrayName="glAccountEntries">
|
|
<div class="flex-fill layout-row-wrap gap-2percent responsive-column" [formGroupName]="i">
|
|
<div class="flex-8">
|
|
{{
|
|
openingBalancesData.glAccounts[i].glAccountType.value !==
|
|
openingBalancesData.glAccounts[i - 1]?.glAccountType.value
|
|
? glAccountTypeLabel(openingBalancesData.glAccounts[i].glAccountType.value)
|
|
: ''
|
|
}}
|
|
</div>
|
|
<div class="flex-13">
|
|
{{ openingBalancesData.glAccounts[i].glAccountCode }}
|
|
</div>
|
|
<div class="flex-29">
|
|
{{ openingBalancesData.glAccounts[i].glAccountName }}
|
|
</div>
|
|
<div class="flex-20">
|
|
<mat-form-field>
|
|
<mat-label>{{ 'labels.inputs.Debit' | translate }}</mat-label>
|
|
<input matInput type="number" formControlName="debit" />
|
|
</mat-form-field>
|
|
</div>
|
|
<div class="flex-20">
|
|
<mat-form-field>
|
|
<mat-label>{{ 'labels.inputs.Credit' | translate }}</mat-label>
|
|
<input matInput type="number" formControlName="credit" />
|
|
</mat-form-field>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</mat-card-content>
|
|
|
|
@if (openingBalancesData) {
|
|
<mat-card-actions class="layout-row gap-5px align-center responsive-column">
|
|
<button type="button" mat-raised-button [routerLink]="['../']">
|
|
{{ 'labels.buttons.Cancel' | translate }}
|
|
</button>
|
|
<button
|
|
mat-raised-button
|
|
color="primary"
|
|
[disabled]="!openingBalancesForm.valid"
|
|
*mifosxHasPermission="'DEFINEOPENINGBALANCE_JOURNALENTRY'"
|
|
>
|
|
{{ 'labels.buttons.Submit' | translate }}
|
|
</button>
|
|
</mat-card-actions>
|
|
}
|
|
</form>
|
|
</mat-card>
|
|
</div>
|
|
|
|
<ng-template #templateSearchFormRef let-popover="popover">
|
|
<h2>{{ 'labels.heading.Migrate opening balances (Office-wise)' | translate }}</h2>
|
|
<p class="mw300">
|
|
{{ 'labels.text.Migrate Opening Balances' | translate }}
|
|
<a [href]="'migrateOpeningBalances' | documentationLink" target="_blank" rel="noopener noreferrer">{{
|
|
'labels.inputs.Migrate opening balances (Office-wise)' | translate
|
|
}}</a>
|
|
</p>
|
|
<div class="layout-row align-end gap-2px responsive-column">
|
|
<button mat-raised-button color="warn" (click)="popover.close(); configurationWizardService.closeConfigWizard()">
|
|
{{ 'labels.buttons.Close' | translate }}
|
|
</button>
|
|
<button mat-raised-button color="primary" (click)="popover.close(); popover.close(); previousStep()">
|
|
{{ 'labels.buttons.Back' | translate }}
|
|
</button>
|
|
<button mat-raised-button color="primary" (click)="popover.close(); popover.close(); nextStep()">
|
|
{{ 'labels.buttons.Next' | translate }}
|
|
</button>
|
|
</div>
|
|
</ng-template>
|