Hello,
In AP -> Charges Code, I have a charge code setup called FREIGHT (among others) like so:
I then have the charge setup in automatic charges for the line like so (against a particular vendor/item for testing purposes):
I now make a PO with the appropriate conditions for the charge and invoice it. Under voucher transactions, I can see that this charge is being applied.
My question is, which class/method in X++ is responsible for reading my charge and applying it on PO invoice? I need to be able to intercept this value I have set up and change it under a certain condition.
I have spent some time in the Markup class, particularly in the calcMarkupAmount method, but it doesn't seem to be where this freight charge is being pulled from.
Can someone please point me in the right direction of where I need to look to be able to intercept this value? Any and all help would be much appreciated.
Thank you.
*This post is locked for comments
Hello,
I have the exact same requirement as yours, i.e. adding defaultdimension field on MarkupTable (Vend only) and merging the default dimension into the ledger dimension of the corresponding accounting distributions on POs.
I tried to override the calculateDefaultDimension method in the ChargeSourceDocLineItem class to merge the dimensions from the custom default dimension found in the corresponding MarkUpTable.
However, I am not too sure how to use the hasDimensionDerivationInputChanged and parmDefaultDimension, and the accJourRulePurchaseOfProductCharge.parmDimensionValuesUsedForSummaryAccount() methods.
Could you guide me please?
Thanks.
you may need to check the MarkupTrans and MarkupTable for charges
Which value do you want to change ?
I think it would be bad practice to change the posted amount.
However I have recently worked with something similar.
I have made a customization where you can set up (financial) default dimensions on charges/markuptrans that are related to purchase order lines.
When posting Invoices, the default dimensions set up on the charges are merged with the default dimensions that the standard system finds and the merged dimensions are pushed to the accounting distribution, that the accounting framework will then use for posting.
If system finds a default dimension set up on the charge when invoice posting runs it will use the accounting distribution (that is the merged dimensions) as default dimension for posting - EVEN if the Global Ledger parameter (Ledger / Setup / Ledger Parameters / (TOC) Ledger / (Field group) Accounting rules / (Field) Values used for summary account is set to Source document (and not Accounting Distributions).
Long story short, you have to dive into to the source document framework and the accounting framework, and do not expect this to be a task that is done in a short period time.
The source document frame work will create accounting distributions for each source document line - and sublines (and for the charges part check out the class ChargeSourceDocumentLineItem and the class hierarchy above it).
Also have a look at the SourceDocumentProcessorFacade class.
When all lines on a source document have reached the state "Completed" then the system will create an accounting event.
The accounting framework then uses the accounting event and the accounting distributions to decide how to post into GL.
The accounting framework uses accounting policies and accounting rules to create sub ledger entries (actually the source document frame works also uses these to create accounting distributions - at least that's my understanding).
When all entries have been made in the sub ledger, a process call transfer to general ledger does the actually final posting into GL.
Accounting policies are classes that extends AccountingPolicy.
Accounting policies determines if GL posting are made for a business event at all (parmAccountingRequired method).
Accounting rules are classes that extends AccountingRule.
Accounting rules gives posting types, side (debit/credit) and an AccountingDimensionsProvider to provide which accounts to post on.
I my scenario I was able to change class ChargeSourceDocLineItem to capture if default dimension were setup on charges and merge them by overriding calculateDefaultDimension, hasDimensionDerivationInputChanged and parmDefaultDimension, and the accJourRulePurchaseOfProductCharge - method parmDimensionValuesUsedForSummaryAccount to achieve what I wanted.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156