Export item data from invoice

Hi,

i would like to made the report "Part Sales by Customer Report" with access.

I made the invoice from order. I extract all data from the table oelineitem, but i can't have the information of the qty and the item for each invoice.

For example, :

I create 3 invoice from 1 order, i would like to display the quantity of a certain item for each invoice, but in oelineitem i only have one rows for tthe item with the total qty that is inthe order.

how can i do to have the single qty for invoice for this item?

  • 0

    The OElineItem table has the line items for kits, invoices, orders, quotes and returns.  To get the invoice line items you would need to filter on the oelineitem.Type.   An oelineitem.type = "I" are invoices, oelineitem.type = "O" are orders, etc.  

    In the OE, transfer, custom exports create a template and use the OE invoices line items data source.  Select the fields you need including the oelineitem Shipqty, oelineitem unitprice and oelineitem extendedprice.  This will show the shipped quantity on each invoice.  Filter on the item you are looking for.

  • 0 in reply to CShular

    In oelineitem I have only fktype 0 because I convert the order into invoice. I haven't any other type of value.

    In OEInvoice I have only the Header information from the invoice, but where are the items information? In OELineitem i suppose.

    When I insert an order for one item (500 pcs) and I create 3 invoices for 200 200 100 pcs and after I create a report and join oeinvoice whit oeline item i have 3 rows with 500 pcs and not three rows for 200 200 and 100.

    Have you understood my problem?

  • 0

    I understand you want to use Access, but did you try the report that built in to BW, in OE ?

    I believe its in BW 2011, 2012 & 2013

    OE -> Reports -> Part Sales by Customer  (uses the newer report writer)

    This is a highly customizable report.   Just asking...

  • 0 in reply to Vince Settipane

    I use access for merge this data with other db.

    Another problem in this case is this:

    I create 3 items rows in sales order, then i delete these and write other 5 rows. Into the db the previous order lines aren't deleted and when a made a query in oesalesline I see 3+5 rows but in the sage report i see only the 5 recent rows

  • 0 in reply to fabio

    this is the SQL that the report works off

    SELECT CUST.ID AS ARCustomer_ID, ITEM.ID AS OELineItem_ID, INV.InvoiceDate,

     INV.InvoiceNo, CUST.Name, CUST.SKARCustomer, INV.SKARInvoice,

     ITEM.Type, ITEM.ShipQty, ITEM.UnitPrice, ITEM.UnitDiscount,

     PART.Description1, ITEM.FKType, INV.SortLink

    FROM ARCustomer CUST

     INNER JOIN ARInvoice INV ON (INV.FKARCustomer = CUST.SKARCustomer)

     LEFT OUTER JOIN OELineItem ITEM ON (ITEM.FKEntity = INV.SortLink)

     LEFT OUTER JOIN ICPart PART ON (PART.SKICPart = ITEM.FKICPart)

    WHERE (INV.SortLink > 0)

     AND (ITEM.Type = 6)

     AND (ITEM.FKType = 'I')

    ORDER BY ARCustomer_ID, OELineItem_ID, INV.InvoiceDate

    is your close ?

  • 0 in reply to fabio

    When you convert the order to an invoice(s) it creates new oelineitem records for each invoice. These have an oelineitem fktype = "I".

    To get the invoice line items you would need to link the ARinvoice SKARinvoice to the OEInvoice FKARInvoice (if you want to filter on invoice number). Then link the OEinvoice SKoeinvoice to the OElineitem FKentity and filter on fktype = "I".   This will give you the line items for each invoice.  You can pull the ship quantity from the oelineitem shipqty

  • 0 in reply to CShular

    My version of sage bw 2012 don't modify the fktype. It has one value '0' in all rows. I modify the sql query removing the filter "type"

  • 0 in reply to fabio

    If you follow Cshular post's from 11/21 6;56pm,  the OELineItem.FKType field is filled with I, O, Q, R , W

  • 0 in reply to Vince Settipane

    also OELineItems.Type = 6  (Parts)  , 7=Visible Comments, 8 = hidden comment, 9 = labor, 10 = non stock