preloader-matrix

Alfasith

Code to create general journal in Dynamic AX

Hi,

static void CreateGLJournal(Args _args)
{
    AxLedgerJournalTable journalTable;
    AxLedgerJournalTrans journalTrans;
    DimensionDynamicAccount     offsetDimensions, bankaccount;
    DNIPMIPParameters   parameters;
    dimensionStorage    dimensionStorage;
    LedgerAccountContract   ledgerAccountContract;
    DimensionValue  dimvalue;
    LedgerDimensionAccount dimaccount, ledgeracc;
    LedgerJournalTable  ledgerJournalTable;
    LedgerJournalTrans  ledgerJournalTrans;
    DNIPMPfInvestmentLines  DNIPMPfInvestmentLines;
    DNIPMPfInvesmentTable   table;
   // “??CEU-000025”;
    int i;
    ;
    i = 1;
    journalTable = new AxLedgerJournalTable();
    journalTrans = new AxLedgerJournalTrans();

    journalTable.parmJournalName(“GenJrn”);
    journalTable.save();
    select * from parameters;
    while(i<5)
    {
    journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
    journalTrans.parmTransDate(systemDateGet());
    dimvalue = DimensionStorage::getMainAccountNumFromLedgerDimension(parameters.Payment);
    dimaccount = DimensionStorage::getDefaultAccountForMainAccountNum(dimvalue);
    ledgeracc = DimensionDefaultingService::serviceCreateLedgerDimension(dimaccount);
    journalTrans.parmAccountType(LedgerJournalACType::Ledger);
    journalTrans.parmLedgerDimension(ledgeracc);

    journalTrans.parmAmountCurDebit(2000);
    bankaccount = DimensionStorage::getDynamicAccount(‘USA OPER’, LedgerJournalACType::Bank);
    journalTrans.parmOffsetLedgerDimension(bankaccount);
    journalTrans.parmOffsetAccountType(LedgerJournalACType::Bank );
    journalTrans.parmCurrencyCode(“USD”);
    //journalTrans.currentRecord().insert();
    journalTrans.save();
    i++;
    }

    info(strFmt(“Journal %1 created”, journalTable.ledgerJournalTable().JournalNum));

}

Regards,

Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published.