Home > Uncategorized > Reading Sage Purchase Orders

Reading Sage Purchase Orders

Once again, another post about Sage. But – there’s virtually no information on the web about Sage Data Objects, so I thought, I’d fill that void with my findings…
 
Here’s code to read Sage Purchase Orders
 
Dim WS As SageDataObject90.WorkSpace
Dim ppOrder As SageDataObject90.PopRecord
Dim PiOrderLine  As SageDataObject90.PopItem
‘Create instance of Engine and Workspace
Dim SDO As New SageDataObject90.SDOEngine
Dim blnHasFoundCustomer As Boolean
Set WS = SDO.Workspaces.Add("Myconnection")
‘Connect to data files
WS.Connect SageLocation, SageUsername, SagePassword, "ThisIsUnique"
‘Create an instance of InvoicePost & Record object’s
Set ppOrder = WS.CreateObject("PopRecord")
ppOrder.MoveFirst
Do
 DoEvents
 ‘ ppOrder has the following fields
‘ACCOUNT_REF: CAN012
‘ADDRESS_1:76 DUNCRUN ROAD
‘ADDRESS_2: BALLARENA
‘ADDRESS_3: LIMAVADY
‘ADDRESS_4: BT49 OJD
‘ADDRESS_5:
‘AMOUNT_PREPAID:0
‘CARR_DEPT_NUMBER:0
‘CARR_NET:0
‘CARR_NOM_CODE:
‘CARR_TAX:0
‘CARR_TAX_CODE:0
‘CONSIGNMENT_REF:
‘CONTACT_NAME:
‘COURIER:1
‘CURRENCY:0
‘CURRENCY_USED:0
‘DEL_ADDRESS_1:
‘DEL_ADDRESS_2:
‘DEL_ADDRESS_3:
‘DEL_ADDRESS_4:
‘DEL_ADDRESS_5:
‘DELETED_FLAG:0
‘DELIVERY_DATE:
‘DELIVERY_NAME:
‘DISCOUNT_TYPE:0
‘DUE_DATE:
‘EURO_GROSS:126.63
‘EURO_RATE:1.407
‘EXTERNAL_USAGE:0
‘FIRST_ITEM:2
‘FOREIGN_GROSS:90
‘FOREIGN_RATE:1
‘GLOBAL_DEPT_NUMBER:0
‘INVOICE_NUMBER:
‘ITEMS_NET:90
‘ITEMS_TAX:0
‘NAME: G.CANNING
‘NOTES_1:
‘NOTES_2:
‘NOTES_3:
‘ORDER_DATE:2003/08/09
‘ORDER_NUMBER:1
‘ORDER_TYPE:0
‘PAYMENT_REF:
‘PAYMENT_TYPE:3
‘POSTED_CODE:1
‘PRINTED_CODE:0
‘SETTLEMENT_DISC_RATE:0
‘SETTLEMENT_DUE_DAYS:0
‘STATUS:8
‘SUPP_DISC_RATE:0
‘SUPP_ORDER_NUMBER:
‘SUPP_TEL_NUMBER:
‘TAKEN_BY: william
‘TOTAL_BYTES:0
 
  Set PiOrderLine = ppOrder.Link
  PiOrderLine.MoveFirst
  Do
    ‘ PiOrderLine has the following fields
   
    ‘  ADD_DISC_RATE:0
    ‘ COMMENT_1:
    ‘COMMENT_2:
    ‘DELIVERY_DATE:2005/06/01
    ‘DEPT_NUMBER:3
    ‘DESCRIPTION: Mushrooms P / P
    ‘DISCOUNT_AMOUNT:0
    ‘DISCOUNT_RATE:0
    ‘FULL_NET_AMOUNT:36.72
    ‘INVOICE_NUMBER:13
    ‘ITEM_NUMBER:3
    ‘JOB_REFERENCE:
    ‘NET_AMOUNT:36.72
    ‘NEXT_ITEM:0
    ‘NOMINAL_CODE:4100
    ‘OFFSET:0
    ‘PREV_ITEM:0
    ‘QTY_ALLOCATED:0
    ‘QTY_DELIVERED:72
    ‘QTY_DESPATCH:0
    ‘QTY_INVOICED:72
    ‘QTY_ORDER:72
    ‘SERVICE_FILE: Mushrooms P / P
    ‘SERVICE_FILE_SIZE:864904
    ‘SERVICE_FLAG:0
    ‘SERVICE_ITEM_LINES:864904
    ‘STOCK_CODE: MUXX02
    ‘TAX_AMOUNT:0
    ‘TAX_CODE:7
    ‘TAX_FLAG:0
    ‘TAX_RATE:0
    ‘TEXT: Mushrooms P / P
    ‘UNIT_OF_SALE:Each
    ‘UNIT_PRICE:0.51
  Loop Until Not PiOrderLine.MoveNext
 End If
 If ppOrder.IsEOF Then
  Exit Do
 Else
  ppOrder.MoveNext
 End If
Loop
WS.Disconnect
 
 
Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: