Sunday, November 1, 2020

How to Create a General Journal line in D365 FO or Ax 2012 using X++

 

Hi guys, Today we see how to create General Journal line in Ax 2012 or D365 FO.


Here we are using 2 classes.


    AxLedgerJournalTable    axLedgerJournalTable ;

    AxLedgerJournalTrans    axLedgerJournalTrans;


        axLedgerJournalTable.parmJournalName(_Name);

        axLedgerJournalTable.save();


       axLedgerJournalTrans.parmJournalNum(axLedgerJournalTable.ledgerJournalTable().JournalNum);

        axLedgerJournalTrans.parmTransDate(systemDateGet());

        axLedgerJournalTrans.parmCurrencyCode('USD');

        axLedgerJournalTrans.parmTxt(_Description);

        axLedgerJournalTrans.parmAmountCurDebit(_Debit);

        axLedgerJournalTrans.parmExchRate(Currency::exchRate('USD'));

        axLedgerJournalTrans.parmAccountType(str2enum(LedgerJournalACType,_AccountType));

        accPattern = ['110110','110110',2,'BusinessUnit',"001","Department","022"];

        axLedgerJournalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(accPattern));

        offSetPattern = ['112140',"112140",2,'BusinessUnit','003',"Department","024"];

        axLedgerJournalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offSetPattern));


        axLedgerJournalTrans.save();


Keep Daxing!! 

Wednesday, October 21, 2020

Select the batch tab in dialog by default using SysOperation in Ax 2012 X++


Hi guys, Today we see how to select the batch tab in dialog by default using SysOperation in Ax 2012 using X++.

In my Contract class I am not using any EDT. When I run Controller class the Dialog is Open with Empty general Tab. Like Below image.



For Avoiding this

Write Below method in Controller Class:

 protected void dialogPostRun()

{
    sysOperationDialog sysOperationDialog;
    DialogTabPage batchTab;
    FormRun formRun;

    super();

    sysOperationDialog = this.dialog() as SysOperationDialog;

    formRun = sysOperationDialog.formRun();

    batchTab = sysOperationDialog.batchDialogTabPage();

    formRun.selectControl(batchTab.control());
}

OutPut:




Keep Daxing!!