Connection invoice line > shipment line

DRAMDRAM Member Posts: 14
There are two fileds in the table Sales Invoic Line: Shipment No. and Shipment Line No. We use combine shipment routine and it doesn't populate these two fields. Can anyone explain why and when does the system populate these fields. As it is now it is allmost impossible to verfy that every posted shipment line has been invoiced. In standard system it should be the case, but our provider has done some code changes and we need to verify that everything goes well.

Comments

  • HalMdyHalMdy Member Posts: 429
    See Table 111 - Fct InsertInvLineFromShipLine , there are the two lines to complete Shipment No. ...


    One other thing : change the topic !
  • DRAMDRAM Member Posts: 14
    Table 111 has only orderno and order line no. What we need is to connect Invoic line to the shipment line that is invoiced. The only connection I can find are the two fields in the invoice line table. But they are not populated by combined shipment function. So is there any other way to connect the corresponding records? Does anyone know if standard combined shipment functionality enter any values in those two fields?

    Regards

    Draggan
  • ara3nara3n Member Posts: 9,257
    We had to create new fields in Sales invoice to transfer the shipment line and no. when using combine shipment functionality.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • HalMdyHalMdy Member Posts: 429
    I've said : please look at fct InsertInvLineFromShipLine .

    Here is the Standard code of this fct :
    SETRANGE("Document No.","Document No.");
    
    TempSalesLine := SalesLine;
    IF SalesLine.FIND('+') THEN
      NextLineNo := SalesLine."Line No." + 10000
    ELSE
      NextLineNo := 10000;
    
    IF SalesInvHeader."No." <> TempSalesLine."Document No." THEN
      SalesInvHeader.GET(TempSalesLine."Document Type",TempSalesLine."Document No.");
    
    IF SalesLine."Shipment No." <> "Document No." THEN BEGIN
      SalesLine.INIT;
      SalesLine."Line No." := NextLineNo;
      SalesLine."Document Type" := TempSalesLine."Document Type";
      SalesLine."Document No." := TempSalesLine."Document No.";
      SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
      SalesLine.INSERT;
      NextLineNo := NextLineNo + 10000;
    END;
    
    TransferOldExtLines.ClearLineNumbers;
    
    REPEAT
      ExtTextLine := (TransferOldExtLines.GetNewLineNumber("Attached to Line No.") <> 0);
    
      IF SalesOrderLine.GET(
        SalesOrderLine."Document Type"::Order,"Order No.","Order Line No.")
      THEN BEGIN
        IF (SalesOrderHeader."Document Type" <> SalesOrderLine."Document Type"::Order) OR
           (SalesOrderHeader."No." <> SalesOrderLine."Document No.")
        THEN
          SalesOrderHeader.GET(SalesOrderLine."Document Type"::Order,"Order No.");
    
        IF SalesInvHeader."Prices Including VAT" <> SalesOrderHeader."Prices Including VAT" THEN
          IF "Currency Code" <> '' THEN
            Currency.GET("Currency Code")
          ELSE
            Currency.InitRoundingPrecision;
    
        IF SalesInvHeader."Prices Including VAT" THEN BEGIN
          IF NOT SalesOrderHeader."Prices Including VAT" THEN
            SalesOrderLine."Unit Price" :=
              ROUND(
                SalesOrderLine."Unit Price" * (1 + SalesOrderLine."VAT %" / 100),
                Currency."Unit-Amount Rounding Precision");
        END ELSE BEGIN
          IF SalesOrderHeader."Prices Including VAT" THEN
            SalesOrderLine."Unit Price" :=
              ROUND(
                SalesOrderLine."Unit Price" / (1 + SalesOrderLine."VAT %" / 100),
                Currency."Unit-Amount Rounding Precision");
        END;
      END ELSE BEGIN
        SalesOrderHeader.INIT;
        IF ExtTextLine THEN BEGIN
          SalesOrderLine.INIT;
          SalesOrderLine."Line No." := "Order Line No.";
          SalesOrderLine.Description := Description;
          SalesOrderLine."Description 2" := "Description 2";
        END ELSE
          ERROR(Text001);
      END;
    
      SalesLine := SalesOrderLine;
      SalesLine."Line No." := NextLineNo;
      SalesLine."Document Type" := TempSalesLine."Document Type";
      SalesLine."Document No." := TempSalesLine."Document No.";
      SalesLine."Variant Code" := "Variant Code";
      SalesLine."Location Code" := "Location Code";
      SalesLine."Quantity (Base)" := 0;
      SalesLine.Quantity :=  0;
      SalesLine."Outstanding Qty. (Base)" := 0;
      SalesLine."Outstanding Quantity" := 0;
      SalesLine."Quantity Shipped" :=  0;
      SalesLine."Qty. Shipped (Base)" := 0;
      SalesLine."Quantity Invoiced" := 0;
      SalesLine."Qty. Invoiced (Base)" := 0;
      SalesLine."Purchase Order No." := '';
      SalesLine."Purch. Order Line No." := 0;
      SalesLine."Drop Shipment" := "Drop Shipment";
      SalesLine."Special Order Purchase No." := '';
      SalesLine."Special Order Purch. Line No." := 0;
      SalesLine."Special Order":= FALSE;
    
    // ----- HERE ARE THE LINES ---------------------------------------
      SalesLine."Shipment No." := "Document No.";
      SalesLine."Shipment Line No." := "Line No.";
    //--------------------------------------------------------------------
    
      IF NOT ExtTextLine THEN BEGIN
        SalesLine.VALIDATE(Quantity,Quantity - "Quantity Invoiced");
        SalesLine.VALIDATE("Unit Price",SalesOrderLine."Unit Price");
        SalesLine."Allow Line Disc." := SalesOrderLine."Allow Line Disc.";
        SalesLine."Allow Invoice Disc." := SalesOrderLine."Allow Invoice Disc.";
        SalesLine.VALIDATE("Line Discount %",SalesOrderLine."Line Discount %");
      END;
      SalesLine."Attached to Line No." :=
        TransferOldExtLines.TransferExtendedText(
          SalesOrderLine."Line No.",
          NextLineNo,
          SalesOrderLine."Attached to Line No.");
      SalesLine."Shortcut Dimension 1 Code" := SalesOrderLine."Shortcut Dimension 1 Code";
      SalesLine."Shortcut Dimension 2 Code" := SalesOrderLine."Shortcut Dimension 2 Code";
      SalesLine.INSERT;
    
      ItemTrackingMgt.CopyHandledItemTrkgToInvLine(SalesOrderLine,SalesLine);
    
      FromDocDim.SETRANGE("Table ID",DATABASE::"Sales Line");
      FromDocDim.SETRANGE("Document Type",SalesOrderLine."Document Type"::Order);
      FromDocDim.SETRANGE("Document No.",SalesOrderLine."Document No.");
      FromDocDim.SETRANGE("Line No.",SalesOrderLine."Line No.");
    
      ToDocDim.SETRANGE("Table ID",DATABASE::"Sales Line");
      ToDocDim.SETRANGE("Document Type",SalesLine."Document Type");
      ToDocDim.SETRANGE("Document No.",SalesLine."Document No.");
      ToDocDim.SETRANGE("Line No.", SalesLine."Line No.");
      ToDocDim.DELETEALL;
    
      IF FromDocDim.FIND('-') THEN
        REPEAT
          TempFromDocDim.INIT;
          TempFromDocDim := FromDocDim;
          TempFromDocDim."Table ID" := DATABASE::"Sales Line";
          TempFromDocDim."Document Type" := SalesLine."Document Type";
          TempFromDocDim."Document No." := SalesLine."Document No.";
          TempFromDocDim."Line No." := SalesLine."Line No.";
          TempFromDocDim.INSERT;
        UNTIL FromDocDim.NEXT = 0;
    
      NextLineNo := NextLineNo + 10000;
      IF "Attached to Line No." = 0 THEN
        SETRANGE("Attached to Line No.","Line No.");
    UNTIL (NEXT = 0) OR ("Attached to Line No." = 0);
    
    IF SalesOrderHeader.GET(SalesOrderHeader."Document Type"::Order,"Order No.") THEN BEGIN
      SalesOrderHeader."Get Shipment Used" := TRUE;
      SalesOrderHeader.MODIFY;
    END;
    

    Check your fct if these two lines exist ...
    This fct is called when you make a combine shipment and create the invoice line from the shipment line. There is nothing to change, if nobody has changed this fct of course ...
  • DRAMDRAM Member Posts: 14
    Thanks, I will look into it. Sorry that I missunderstod you the first time.


    Regards
  • HalMdyHalMdy Member Posts: 429
    You welcome ! :wink:
Sign In or Register to comment.