Condividi tramite


Storno Design Pattern

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Storno is a German word that is used to describe an account that has plus credit and minus debit.

Amount fields on Transaction tables that could be corrected should use this design pattern.

Note

This design pattern is used for the GeneralJournalAccountEntry table.

Extended Data Type Account Field Settings

You must show the transaction amount where corrections can appear with the following:

  • The DisplaceNegative property set to approximately 10

  • The SignDisplay property set to None

The corrected amounts (Storno) cannot otherwise be shown. The data types AmountMSTDebCred and AmountCurDebCred can be used for this purpose.

IsCorrection Field Settings

Apart from the amount fields as previously defined, a Boolean field named Correct should be defined on the same table as the amount fields.

Set the Correct field to true if the record represents a corrected posting.

Property

Setting

Type

#Enum

Name

#IsCorrection

Label

#@SYS13069 -> Correction

HelpText

#@SYS3643 -> Is the current transaction a reversing entry?

SaveContents

#No

Mandatory

#No

AllowEditOnCreate

#Yes

AllowEdit

#Yes

Visible

#Yes

Table

#GeneralJournalAccountEntry

EnumType

#NoYes

Use Correct Flags

Set the correct flag of the involved amount fields by using the system function corrflagset if the record represents a corrected posting as shown in the following example.

void postLoad() 
{
    if (this.IsCorrection)
    {
        this.FuntionalCurrencyAmount = corrflagset(this.FunctionalCurrencyAmount,1);
        this.TransactionCurrencyAmount = corrflagset(this.TransactionCurrencyAmount,1);
    }
    super(); 
}

The correction flags of a real are manipulated with the corrflagget and corrflagset functions.

Check if the Amount Field has been Corrected

When you use the Amount field, check if it has been corrected as shown in the following example.

if (GeneralJournalAccountEntry.IsCredit)
{
    amountCredit = GeneralJournalAccountEntry.FunctionalCurrencyAmount;
    totalAmountCredit += amountCredit;
}
else
{
    amountDebit += GeneralJournalAccountEntry.FunctionalCurrencyAmount;
    totalAmountDebit += amountDebit;
}

See also

Microsoft Dynamics AX Design Patterns

corrFlagGet Function

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.