-
Notifications
You must be signed in to change notification settings - Fork 688
Set Additional Reporting Currency demo data for financial reporting #28760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tuan-nguyen-fenwick
wants to merge
17
commits into
microsoft:main
Choose a base branch
from
tuan-nguyen-fenwick:uptake/acy-demo-data
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
02e425d
Set Additional Reporting Currency
346f424
Created residual FX accounts
edb7458
Set residual FX accounts to EUR & GBP currencies
d8dc05f
Merged PR 35656: Set Additional Currency Code during G/L Setup demo d…
523359f
Changed hardcoded currency codes to use the currency functions
908b84c
Added "Create Add. Reporting Currency" codeunit and moved data creati…
bb87255
Updated account numbers for residual FX gains/losses
645c982
Merge remote-tracking branch 'origin/main' into uptake/acy-demo-data
8b82005
Removed new residual FX accounts & used existing FX accounts instead
2b6c8b1
Merge remote-tracking branch 'origin/main' into uptake/acy-demo-data
11a923f
Implemented function to retrieve generic and localized currency accounts
ab2e881
Implemented localized currency gains/losses accounts for countries wi…
2976c8b
Removed unused using directives
50bb833
Merge remote-tracking branch 'origin/main' into uptake/acy-demo-data
74eb3df
Renamed GetResidualCurrencyAccountsES function
de2c60f
Removed begin .. end
2d52ab2
Fixed using order
shuyusheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...ffeeDemoDataset/app/DemoData/Finance/2.Master data/CreateAddReportingCurrency.Codeunit.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace Microsoft.DemoData.Finance; | ||
|
|
||
| using Microsoft.Finance.Currency; | ||
| using Microsoft.Finance.GeneralLedger.Setup; | ||
|
|
||
| codeunit 5627 "Create Add. Reporting Currency" | ||
| { | ||
| InherentEntitlements = X; | ||
| InherentPermissions = X; | ||
| Permissions = | ||
| tabledata "General Ledger Setup" = rm, | ||
| tabledata Currency = rm; | ||
|
|
||
| trigger OnRun() | ||
| begin | ||
| ConfigureAdditionalReportingCurrency(); | ||
| UpdateCurrencyResidualAccounts(); | ||
| end; | ||
|
|
||
| procedure ConfigureAdditionalReportingCurrency() | ||
| var | ||
| GeneralLedgerSetup: Record "General Ledger Setup"; | ||
| CreateCurrency: Codeunit "Create Currency"; | ||
| ACYCode: Code[10]; | ||
| begin | ||
| GeneralLedgerSetup.Get(); | ||
| ACYCode := GeneralLedgerSetup."LCY Code" = CreateCurrency.EUR() ? CreateCurrency.USD() : CreateCurrency.EUR(); | ||
| GeneralLedgerSetup."Additional Reporting Currency" := ACYCode; | ||
| GeneralLedgerSetup.Modify(true); | ||
| end; | ||
|
|
||
| procedure UpdateCurrencyResidualAccounts() | ||
| var | ||
| Currency: Record "Currency"; | ||
| CreateCurrency: Codeunit "Create Currency"; | ||
| FXGainsAccount: Code[20]; | ||
| FXLossesAccount: Code[20]; | ||
| begin | ||
| GetResidualCurrencyAccounts(FXGainsAccount, FXLossesAccount); | ||
| Currency.SetFilter(Code, '%1|%2', CreateCurrency.EUR(), CreateCurrency.USD()); | ||
| if Currency.FindSet(true) then | ||
| repeat | ||
| Currency.Validate("Residual Gains Account", FXGainsAccount); | ||
| Currency.Validate("Residual Losses Account", FXLossesAccount); | ||
| Currency.Modify(true); | ||
| until Currency.Next() = 0; | ||
| end; | ||
|
|
||
| local procedure GetResidualCurrencyAccounts(var FXGainsAccount: Code[20]; var FXLossesAccount: Code[20]) | ||
| var | ||
| CreateGLAccount: Codeunit "Create G/L Account"; | ||
| IsHandled: Boolean; | ||
| begin | ||
| OnBeforeGetResidualCurrencyAccounts(FXGainsAccount, FXLossesAccount, IsHandled); | ||
| if IsHandled then | ||
| exit; | ||
|
|
||
| FXGainsAccount := CreateGLAccount.RealizedFXGains(); | ||
| FXLossesAccount := CreateGLAccount.RealizedFXLosses(); | ||
| end; | ||
|
|
||
| [IntegrationEvent(false, false)] | ||
| local procedure OnBeforeGetResidualCurrencyAccounts(var FXGainsAccount: Code[20]; var FXLossesAccount: Code[20]; var IsHandled: Boolean) | ||
| begin | ||
| end; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be sorted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorted