?
Solved

How to update an invoice item quanity in Sage line 50 using sage data objects

Posted on 2008-11-14
6
Medium Priority
?
619 Views
Last Modified: 2012-05-05
I have created an invoice in sage and i want to programatically update the quantity of a item on that invocie . I have it so that i can update details such as teh date etc already but it doesnt seem to be updating the invoice items for me

any ideas ??
SageInvoice = SageWorkspace.CreateObject("InvoiceRecord") SageInvoice.Fields.Item("INVOICE_NUMBER").Value = 7
If SageInvoice.Find(True) Then
  SageInvoice.Edit()
    SageInvoice.Fields.Item("INVOICE_DATE").Value = CDate(DataSetField(OrdersDSet, i, "enddate"))
   SageInvoiceItem = SageWorkspace.CreateObject("InvoiceItem")
   ' Link Items to Header
   SageInvoiceItem = SageInvoice.Link
   SageInvoiceItem.MoveFirst()
   Do
     If SageInvoiceItem.Fields.Item("STOCK_CODE").Value ="TEST"
           SageInvoiceItem.Fields.Item("QTY_ORDER").Value = 3
           SageInvoiceItem.Fields.Item("NET_AMOUNT").Value = SageInvoiceItem.Fields.Item("UNIT_PRICE").Value * 3
 
        End if
 
   Loop Until SageInvoiceItem.MoveNext = False
 
 SageInvoice.Update
 
End if

Open in new window

0
Comment
Question by:MCLR
  • 3
  • 3
6 Comments
 
LVL 23

Assisted Solution

by:Christopher Kile
Christopher Kile earned 400 total points
ID: 22959217
I don't know anything about Sage, but perhaps the InvoiceItem also has an Update method, as in the attached code snippet?
     If SageInvoiceItem.Fields.Item("STOCK_CODE").Value ="TEST"
           SageInvoiceItem.Fields.Item("QTY_ORDER").Value = 3
           SageInvoiceItem.Fields.Item("NET_AMOUNT").Value = SageInvoiceItem.Fields.Item("UNIT_PRICE").Value * 3
 
          SageInvoiceItem.Update     
     End if

Open in new window

0
 
LVL 1

Author Comment

by:MCLR
ID: 22959230
no it doesnt have one
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 22959868
Are you sure the code is being executed? You might want to post to the application log (just for testing) to verify that QTY_ORDER and NET_AMOUNT are, in fact, being modified.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:MCLR
ID: 22960019
yes its definately being executed and if i run in debug mode and query the value in the  SageInvoiceItem.Fields.Item("QTY_ORDER").Value  after it runs then it is returning the updated value but it isnt updating in sage
0
 
LVL 1

Accepted Solution

by:
MCLR earned 0 total points
ID: 22960195
I found it i needed to add the following line

SageInvoiceItem.Write(SageInvoiceItem.RecordNumber)
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 22960298
Congratulations :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question