Options

simple request - Urgent !!!

masqazimasqazi Member Posts: 22
edited 2005-09-19 in Dynamics AX
i am struggling to create a journal and post it thru code... anyone can help me out by giving example code of creating a journal and posting it using X++..

My actual problem is, i want to post transaction related to an LC. So we must post into a separate lc ledger account, and the bank account specified in the LC will be the offset account. on the lc form i will be having a POSTING button. when clicked, it should display a payment journal. how to do this... i know this is a childish request to ask for code..but still
Smile !! it increases your face value.

Comments

  • Options
    masqazimasqazi Member Posts: 22
    16 views and no reply.... Atleast some hints expected
    Smile !! it increases your face value.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I think there are not much Axapta programmes here, more Navision.

    Try www.mbsonline.org
  • Options
    HarishHarish Member Posts: 172
    Hi,

    I would create a journal first and then import the journal lines by code. For some guidance, please have a look at some basic codes in my website -

    http://www.harishm.com/Navision/Code.html

    It is fairly easy to import journal lines by code. If you have any problems/queries please feel free to post here or mail me.

    I am not sure whether you would be interested in this or not. But for the sake of information, there is also another option as well. Either you can do this by writing code or you can try using Atlas XL. It is an Excel add-on using which you can import journals into Axapta. This is quite powerful. You can also use this to generate some complex reports across Axapta. For more info, please visit -
    http://www.globesoftware.com.au/AtHome.htm

    or write to Steve Wright at steve@globesoftware.com.au

    Regards,

    Harish Mohanbabu
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    masqazimasqazi Member Posts: 22
    hi harish..is it possible if u post a code example ..for creating journal and journal line and post it using X++.....i am not getting a way to move ahead...thanks
    Smile !! it increases your face value.
  • Options
    HarishHarish Member Posts: 172
    Hi,

    Apologies for the delay in my response.

    Here is a skeleteon code -
    LedgerJournalTrans                ljt;
    ;
    
    ljt.overwriteSystemfields(true);
    ljt.TransDate = str2date(STRLRTRIM(conpeek(line,1)),123); //DATE
    ljt.JournalNum = conpeek(line,2); // JOURNAL NUMBER
    ljt.AccountType = conpeek(line,3); //ACCOUNT TYPE
    ljt.AccountNum = conpeek(line,4); //ACCOUNT
    ljt.Txt = conpeek(line,5);//DESCRIPTION
    ljt.AmountCurDebit = abs(conpeek(line,6));//DEBIT
    ljt.AmountCurCredit = abs(conpeek(line,7)); //CREDIT
    ljt.OffsetAccountType = conpeek(line,8); //OFFSET ACCT TYPE
    ljt.OffsetAccount = conpeek(line,9);//OFFSET ACCT
    ljt.Voucher = conpeek(line,10);//VOUCHER NO (MANUAL)
    ljt.CurrencyCode = conpeek(line,11);//CURRENCY
    ljt.insert();
    

    Should you wish, you can validate each and every line even while you import. Also in the above code, the voucher number is being imported manually. Alternatively you can get the next number sequence.

    If you are not familiar with importing lines from a CSV file, please refer to the sample code in my website -

    http://www.harishm.com/Navision/Code.html

    Hope this helps :) ,

    Harish Mohanbabu
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    masqazimasqazi Member Posts: 22
    Thanks for the code..

    another request.. i want to have a special type of payment journal for posting LC specific transaction. There will be a button on LC form, and when the user press it, the above special journal should be opened which will automatically have the ledger account type, journal name,offset account info specified in it. any example / idea / hints ???

    2. in axapta, is it sufficient for us to post transaction into the correct ledger account,and the rest of things is taken care by axapta, like cash forecast, vendor balances, financial statements, etc (apart from standard setting we do intially during implementation) ?
    Smile !! it increases your face value.
  • Options
    HarishHarish Member Posts: 172
    Hi,

    Point 1 - I am not sure what you want to do here. But on click of a button, if you just want to open a form and display, you should write something like this -
    FormRun              frm;
    ;
    
    frm = ClassFactory.formRunClass(new args("SalesTable"));
    frm.init();
    frm.run();
    frm.wait();
    

    The above code example would open SalesTable form.

    Point 2 - Yes! Provided the fact that all the things mentioned by you has been correctly set-up/configured, you don't need to do anything.

    Regards,

    Harish Mohanbabu
    Harish Mohanbabu
    Long way to go before I sleep..
  • Options
    masqazimasqazi Member Posts: 22
    Thanks Harish ! your have really taken pain to help me.

    Still my problem seems to be not clear... see in accounts we can use a single journal for all types of transactions or we can customize it for particular transaction. For example, instead of using the simple "General Journal" we use "payment journal" in AR / AP wherein only transactions related to sales / purchases can be entered. similarly when a button is pressed on my form, a customized journal should be opened wherein user can enter transactions related to LC only... how to have this journal ???

    secondly, a new number sequence should be attached to this journal. I am facing problem here also.
    Smile !! it increases your face value.
  • Options
    masqazimasqazi Member Posts: 22
    in my table i have used a field based on "PurchIdBase" extended data type which is purchase order id. then on my form which uses this table, i have place a menuitembutton which refers to a menuitem, which in turn acts on form "PurchTable" the purchase order form.

    when i press the above button, the purchase order form is opened which shows records corresponding to currently selected record in my form. i want to know how this happens and what processes are involved behind the screen.

    ** this request is not related to my actual post.
    Smile !! it increases your face value.
  • Options
    masqazimasqazi Member Posts: 22
    eagerly waiting for response, specially from harish
    Smile !! it increases your face value.
  • Options
    AdministratorAdministrator Member, Moderator, Administrator Posts: 2,496
    masqazi wrote:
    [...]

    ** this request is not related to my actual post.

    So why not creating a new Topic?
Sign In or Register to comment.