Skip to Content
author's profile photo Former Member
Former Member

Sales item qtys and related serial numbers

Hi all,

I have the below code which is giving all the serial numbers related to a particular Itemcode. But in actual fact I want it to return serial numbers related to the item code and the specific Sales Order only. any suggestions pls?

Thanks.

{Select distinct

T0.DocNum as 'Sales Order No.'

, T0.DocDate as 'Sales Order Date'

, T0.CardName as 'Customer Name'

, T1.ItemCode as 'Item No.'

, T1.Dscription as 'Item Description'

, T1.Quantity as 'Qty'

, T1.Price as 'Unit Price'

, T2.IntrSerial as 'Serial No.'

FROM

ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry

LEFT JOIN OSRI T2 ON T2.ItemCode = T1.ItemCode }

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 16, 2009 at 08:19 AM

    Hi!

    Try this !

    Select distinct

    T0.DocNum as 'Sales Order No.'
    , T0.DocDate as 'Sales Order Date'
    , T0.CardName as 'Customer Name'
    , T1.ItemCode as 'Item No.'
    , T1.Dscription as 'Item Description'
    , T1.Quantity as 'Qty'
    , T1.Price as 'Unit Price'
    , T2.IntrSerial as 'Serial No.'
    
    FROM
    
    ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
    LEFT JOIN OSRI T2 ON T2.ItemCode = T1.ItemCode and
    T0.Docnum='[%0]'

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 16, 2009 at 08:09 PM

    Try this one:

    Select T0.DocNum as 'Sales Order No.', T0.DocDate as 'Sales Order Date', T0.CardName as 'Customer Name', T1.ItemCode as 'Item No.', T1.Dscription as 'Item Description', T1.Quantity as 'Qty', T1.Price as 'Unit Price', T4.IntrSerial as 'Serial No.'

    FROM dbo.ORDR T0 INNER JOIN dbo.RDR1 T1 ON T0.DocEntry = T1.DocEntry

    LEFT JOIN dbo.SRI1 T3 ON T3.ItemCode = T1.ItemCode AND T3.BsDocType = 17 AND T3.BsDocEntry = T1.DocEntry AND T3.BsDocLine = T1.LineNum

    LEFT JOIN dbo.OSRI T4 ON T4.SysSerial = T3.SysSerial AND T4.ItemCode = T3.ItemCode

    WHERE T0.DocDate > [%0\]

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 16, 2009 at 08:16 PM

    Hi Vankri,

    Sales Order table doesn't allocate serial number information and It is only allocated at the delivery level .

    Therefore , you need to run your query against delivery table not against sales order .

    Hope this helps

    Bishal

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.