Vendor/Customer Name on G/L Entries Table

AELAEL Member Posts: 12
edited 2004-05-06 in Navision Financials
I am a new user of Navision and have a really easy question (I hope!).
Does anyone know how to show the customer/vendor name on the g/l entries table?

I can get the customer/vendor number to show against the entries (using source no.) but not the name.

Thanks!

Comments

  • bostjanlbostjanl Member Posts: 107
    AEL wrote:
    I am a new user of Navision and have a really easy question (I hope!).
    Does anyone know how to show the customer/vendor name on the g/l entries table?

    I can get the customer/vendor number to show against the entries (using source no.) but not the name.

    Thanks!

    Add flowfields (one for costumer and one for vendor name) or add custom function to table, which will return the source name.


    Bostjan
  • eromeineromein Member Posts: 589
    that would be the easiest way to do it!

    But not the best (imho).

    Better to create one new field "name text 30" which is filled with either the customer name or the vendor name.

    Thing is that's pretty difficult to fill this field if you are a beginner.

    So if you wanna know, post a reply ;)
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • trulyjackytrulyjacky Member Posts: 24
    I wanna know, please. :lol:
  • AELAEL Member Posts: 12
    Me too! :D
  • StephenGStephenG Member Posts: 99
    You will need to to add a new field to the "GL Entry" table eg "Source Name" Text 30 or if Attain then Text 50.

    In CodeUnit 12 "Gen. Jnl.-Post Line" you will need to add this code to the end of Function 'InitGLEntry'


    Case GLEntry."Source Type" of
      GLEntry."Source Type"::Customer:
        If Cust.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := Cust.Name;
      GLEntry."Source Type"::Vendor:
        If Vend.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := Vend.Name;
      GLEntry.Source Type"::"Bank Account":
        If Cust.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := BankAcc.Name;
      GLEntry."Source Type"::"Fixed Asset":
        If Cust.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := FixAsset.Description;
    END;
    
    This covers all the Source Type Options. You might have to declare a variable for the FixAsset Table.
    Answer the question and wait for the answer.
  • AELAEL Member Posts: 12
    Thanks Stephen - I think that explains my problem then. My company has not bought the licence to the codeunits.

    I can access the C/AL coding behind reports but not on forms or tables.

    Any suggestions (other than buy the licence!)
  • FabriceGFabriceG Member Posts: 12
    In the form or in the report
    Create un variable Text lenght 30

    In the trigger "OnAfterGetRecord" put this code
    if recVendor.get(TableEntry."Vendor no.) then
    txtvar:=recvendor.name
    else
    txtvar:='';

    After display the variable.
  • StephenGStephenG Member Posts: 99
    Hi AEL

    You can still use the basics of the code i posted on forms (OnAfterGetRecord) or Reports (OnAfterGetDataItem) triggers.

    You'll just have to create a Variable SourceName Text 30 or 50 and possibly variables for The Cust,Vend... Tables, don't forget to clear the variable first.
    Answer the question and wait for the answer.
  • Tommy_SchouTommy_Schou Member Posts: 117
    I would recommend you use StephenG's code to fill a variable on the forms on which you want the cust./vendor-name displayed. Putting the info directly into the various ledger entry tables would result in a LOT of extra data that you really don't need :)

    Create a variable on a form. Fill it according to StephenG's code and put a textbox on the form showing the variable you created. Put the code on AfterGetRecord and be sure to start it with clearing your variable.
    Best regards
    Tommy
  • RobertMoRobertMo Member Posts: 484
    There are 2 bugs in code:

    Case GLEntry."Source Type" of
    GLEntry."Source Type"::Customer:
    If Cust.GET(GLEntry."Source No.") THEN
    GLEntry."Source Name" := Cust.Name;
    GLEntry."Source Type"::Vendor:
    If Vend.GET(GLEntry."Source No.") THEN
    GLEntry."Source Name" := Vend.Name;
    GLEntry.Source Type"::"Bank Account":
    If Cust.GET(GLEntry."Source No.") THEN
    GLEntry."Source Name" := BankAcc.Name;
    GLEntry."Source Type"::"Fixed Asset":
    If Cust.GET(GLEntry."Source No.") THEN
    GLEntry."Source Name" := FixAsset.Description;
    END;

    First Cust should be replaced with BankAcc
    Second Cust should be replaced with FixAsset
    The code should then look like this:
    Case GLEntry."Source Type" of
      GLEntry."Source Type"::Customer:
        If Cust.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := Cust.Name;
      GLEntry."Source Type"::Vendor:
        If Vend.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := Vend.Name;
      GLEntry.Source Type"::"Bank Account":
        If BankAcc.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := BankAcc.Name;
      GLEntry."Source Type"::"Fixed Asset":
        If FixAsset.GET(GLEntry."Source No.") THEN
          GLEntry."Source Name" := FixAsset.Description;
    END;
    
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • StephenGStephenG Member Posts: 99
    :oops: Ooops :oops:

    Remember to check code at least twice when typing on the fly, especially when using copy and paste.
    Answer the question and wait for the answer.
  • RobertMoRobertMo Member Posts: 484
    Don't be :oops: . It's common to all of us who think faster then type. If it would be oposite, you could be the blond sitting and smileing in front of boss' office...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Sign In or Register to comment.