![]() |
|||
|
|||
|
|
sage line 50 sage line 100 sage line 50 training 50 line pos sage sage line 50 financial controller 100 line sage software 50 line sage software training 50 accounting line sage software sage line 50 software sage line sage line 50 training course 50 controller financial line sage v12 sage line 50 note 100 50 line sage 50 cheap discount line sage Searches done in April 2006 Count Search Term sage software sage accounting software sage payroll software sage software inc 100 line sage software 50 line sage software training act sage software sage payroll software training sage software training 50 accounting line sage software sage software mas 90 sage line 50 software accounting sage sales software sage payroll software course sage account software discount sage software sage accounting software uk sage book keeping software form sage software sage line50 software C# .NET Visual Basic .NET VB.NET Component OCX DLL Return to Sage Data Objects for .NET homepage How to Post a Service InvoiceTo use the new SDO in Visual Basic you must add it to the list of References so that Visual Basic knows what the Sage Line 50 Data Objects are when you refer to them. Follow these steps: In Visual Basic 4 (32-bit) Choose the Tools menu followed by References. Find the 'Sage Data Objects 5.0' item, check it and click OK. In Visual Basic 5/6 Choose the Project menu followed by References. Find the 'Sage Data Objects 5.0' item, check it and click OK. If you cannot see the 'Sage Data Objects 5.0' item in the References list, choose Browse and locate the directory where the SDOENG50.DLL and SDOENG50.TLB files are located. Select the SDOENG50.TLB file and click OK. This will add the "Sage Data Objects" to the Reference list in Visual Basic and at the same time register the objects in the Windows registry. Visual Basic Code Example This example demonstrates the new Text property when adding the text to a Service Invoice.
Const szConnect = "c:\line50\accdata\"
Dim SDO As SageDataObject50.SDOEngine
Dim WS As SageDataObject50.WorkSpace
Dim InvPost As SageDataObject50.InvoicePost
Dim InvItem As SageDataObject50.InvoiceItem
Dim SalesRec As SageDataObject50.SalesRecord
'Declare program variables
Dim iCtr As Integer
'Create instance of Engine and Workspace
Set SDO = New SageDataObject50.SDOEngine
Set WS = SDO.Workspaces.Add("Myconnection")
'Connect to data files
WS.Connect szConnect, "manager", "", "ThisIsUnique"
'Create an instance of InvoicePost & Record object's
Set SalesRec = WS.CreateObject("SalesRecord")
Set InvPost = WS.CreateObject("InvoicePost")
'Set the type of invoice so we can find the next available number
InvPost.Type = sdoLedgerService
'Use the GetNextNumber Method to generate the next available number
InvPost.Header("Invoice_Number") = CLng(InvPost.GetNextNumber)
'Loop for Number of Items on the Invoice
For iCtr = 1 To 5
Set InvItem = InvPost.Items.Add()
' This is the text for the line
InvItem.Text = CStr("This is the text for line number " & iCtr)
InvItem("Text") = CStr("Posting Text")
InvItem("Service_Item_Lines") = CLng(1)
InvItem("Net_Amount") = CDbl(100)
InvItem("Full_Net_Amount") = CDbl(100)
InvItem("Tax_Amount") = CDbl(17.5)
InvItem("Nominal_Code") = CStr(SalesRec("Def_Nom_Code"))
InvItem("Tax_Code") = CInt(SalesRec("Def_Tax_Code"))
InvItem("Tax_Rate") = CDbl(17.5)
Next iCtr
'Populate Invoice Header Information
InvPost.Header("Invoice_Date") = Date
InvPost.Header("Notes_1") = ""
InvPost.Header("Notes_2") = ""
InvPost.Header("Notes_3") = ""
InvPost.Header("Taken_By") = ""
InvPost.Header("Order_Number") = ""
InvPost.Header("Cust_Order_Number") = ""
InvPost.Header("Payment_Ref") = ""
InvPost.Header("Global_Nom_Code") = ""
InvPost.Header("Global_Details") = ""
InvPost.Header("Invoice_Type_Code") = sdoServiceInvoice
InvPost.Header("Items_Net") = CDbl(500)
InvPost.Header("Items_Tax") = CDbl(87.5)
'Read the first customer
SalesRec.MoveFirst
InvPost.Header("Account_Ref") = CStr(SalesRec("Account_Ref"))
InvPost.Header("Name") = CStr(SalesRec("Name"))
InvPost.Header("Address_1") = CStr(SalesRec("Address_1"))
InvPost.Header("Address_2") = CStr(SalesRec("Address_2"))
InvPost.Header("Address_3") = CStr(SalesRec("Address_3"))
InvPost.Header("Address_4") = CStr(SalesRec("Address_4"))
InvPost.Header("Address_5") = CStr(SalesRec("Address_5"))
InvPost.Header("Del_Address_1") = CStr(SalesRec("Del_Address_1"))
InvPost.Header("Del_Address_2") = CStr(SalesRec("Del_Address_2"))
InvPost.Header("Del_Address_3") = CStr(SalesRec("Del_Address_3"))
InvPost.Header("Del_Address_4") = CStr(SalesRec("Del_Address_4"))
InvPost.Header("Del_Address_5") = CStr(SalesRec("Del_Address_5"))
InvPost.Header("Cust_Tel_Number") = CStr(SalesRec("Telephone"))
InvPost.Header("Contact_Name") = CStr(SalesRec("Contact_Name"))
InvPost.Header("Global_Tax_Code") = CInt(SalesRec("Def_Tax_Code"))
'Update the Invoice
If InvPost.Update Then
MsgBox "Invoice Created Successfully"
Else
MsgBox "Invoice Not Created"
End If
' Disconnect
WS.Disconnect
| ||