Print Serial number on Sales Invoice document

themavethemave Member Posts: 1,058
Navision 4.0 non-sp1

we sell a lot of specific cost items on Sales orders, we always sale only one item per sales line,when it is a specific cost item, even though Navision would let you sell multiple items.

We would like to print on the posted sales invoice the serial number just below the part number. there is no direct link to the item tracking code from the sale invoice line table, the sales invoice line table has a link to the shipment line, witch has a link to the item tracking line table.

I can not figure a way to get the serial # into a variable on the sale invoice document so I can print it out.

any ideas ?

This seems like it should be standard functionality, would not everyone need the serial number of items sold to appear on sales documents ?

Comments

  • ara3nara3n Member Posts: 9,256
    If you go to a posted invoice and click on line button and then Item tracking lines and follow the code, it calls several functions and comes to the following function
    CallPostedItemTrackingForm3(InvoiceRowID)
    // Used when calling Item Tracking from invoiced documents:
    ValueEntryRelation.SETCURRENTKEY("Source RowId");
    ValueEntryRelation.SETRANGE("Source RowId",InvoiceRowID);
    IF ValueEntryRelation.FIND('-') THEN BEGIN
      SignFactor := TableSignFactor2(InvoiceRowID);
      REPEAT
        ValueEntry.GET(ValueEntryRelation."Value Entry No.");
        ItemLedgEntry.GET(ValueEntry."Item Ledger Entry No.");
        TempItemLedgEntry := ItemLedgEntry;
        TempItemLedgEntry.Quantity := ValueEntry."Invoiced Quantity";
        IF TempItemLedgEntry.Quantity <> 0 THEN
          AddTempRecordToSet(TempItemLedgEntry,SignFactor);
      UNTIL ValueEntryRelation.NEXT = 0;
      FORM.RUNMODAL(FORM::"Posted Item Tracking Lines",TempItemLedgEntry);
    

    The InvoiceRowID in this case is
    "113";"0";"103022";"";"0";"10000"

    where
    113 is table No.

    103022 is invoice no.
    10000 is invoice line no.

    That is all you need to find value entry from which you then find the item ledger and once you've found the item ledger, you have your serial no.


    :lol:
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mkpjsrmkpjsr Member Posts: 587
    Hi all,

    I have a requirement where i need to sell an item of quantity 5 having different serial numbers and print all five serial nos along with the item no on the sales document/invoice.

    so i have writen the following code to achieve this but its not working,

    globals used are:

    i->int
    SerialNo ->an array of type text having dimension as 10
     ItemLedgerEntry.SETRANGE("Document No.","Sales Invoice Line"."Document No.");
     ItemLedgerEntry.SETRANGE("Item No.","Sales Invoice Line"."No.");
       i:=1;
      IF   ItemLedgerEntry.FIND('-') THEN
        REPEAT
        SerialNo[i]:=ItemLedgerEntry."Serial No.";
        i:=i+1;
        UNTIL (ItemLedgerEntry.NEXT=0);
    
    
    Actually i want to store all serial nos into the array SerialNo.

    Can anybody tell me what wrong i am doing or can suggest me the appropriate solution.
  • ara3nara3n Member Posts: 9,256
    The Item ledger entry will not have same document no as Sales Invoice No. In most cases it will have sales shipment Document No.

    You have to find the sales shipment document and then find the item ledger entry. THe other option is to find the value entries related to sales invoice
    ValueEntry.SETRANGE("Document No.","Sales Invoice Line"."Document No.");
    ValueEntry.SETRANGE("Item No.","Sales Invoice Line"."No.");
       i:=1;
      IF   ValueEntry.FIND('-') THEN
        REPEAT
         ItemLedgerEntry.get(ValueEntry."Item Ledger Entry No.")
        SerialNo[i]:=ItemLedgerEntry."Serial No.";
        i:=i+1;
        UNTIL (ValueEntry.NEXT=0);
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mkpjsrmkpjsr Member Posts: 587
    ara3n wrote:
    The Item ledger entry will not have same document no as Sales Invoice No. In most cases it will have sales shipment Document No.

    Thanx for the reply, yes, i noticed this after my post when i saw the records of Item Ledger entry table.

    Now, I dont want to print the array contents on the report like this: SerialNo[1],SerialNo[2]....and so on, instead i want to run a loop

    is there any alternative to this
  • kitikkitik Member Posts: 230
    You can insert the serial No. into a temporary table and then use an Integer Dataitem to loop the temp table.

    Salut!
    Laura Nicolàs
    Laura Nicolàs
    Author of the book Implementing Dynamics NAV 2013
    Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
  • mkpjsrmkpjsr Member Posts: 587
    kitik wrote:
    You can insert the serial No. into a temporary table and then use an Integer Dataitem to loop the temp table.

    Salut!
    Laura Nicolàs


    Thanx, problem is solved.
Sign In or Register to comment.