ITRDS Sample code The following is an example of how simple it is for programmers to use the ITRDS to carry out complex RAMS operations with only a few lines of code. The following code is in Visual FoxPro but is just as simple in VB and .NET Scenarios: Click on the scenario of interest Loading Customer and modifying information Booking a service Querying and paying an invoices online Scenario: Loading Customer and modifying information This could be on a web site so that it can be displayed on a web page or from within a CRM application. Benefit: Customer information can be changed within the CRM application or on the web site without the need for double entry or loading RAMS and no need to worry about opening and closing or tables. Step 1: Load the ITRDS object loITRDS = Createobject("ITRDS.RP_CLIENT") Step 2: Set the Connection method to the RAMS data. This can be either local data or over the net using http. In this example the data is sitting locally on the network. llSuccess = loITRDS.SetConnection("LOCAL")
Step 3: Set the RAMS system to use on this connection It is possible to access more than one RAMS system through a connection. For example if you have different RAMS "Companies" setup. llSuccess = loITRDS.SetSystem('RAMS01') Step 4: Load a particular RAMS account. In this example we load account number "2744262" llSuccess = loITRDS.OCUSTOMERS.Load("2744262") Step 5: Access the information we want Here we access the account information and then display however we want. All the information on the account is placed into the oData property. Hence to access this information we do the following. lcBillingName = loITRDS.OCUSTOMERS.oData.Name lcSiteContactPhone = loITRDS.OCUSTOMERS.oData.Site_Phone lnOutstandingbalance = loITRDS.OCUSTOMERS.oData.Balance ldSuspenddate = loITRDS.OCUSTOMERS.oData.suspend and so on. You can then do want you want with these details such as display them on a web page and allow the user to, in the case of the things such as phone numbers, change them. Once the change them, in order to write the information back into RAMS all you have to do is the following. loITRDS.OCUSTOMERS.AddFieldValue("PHONE",lcNewPhoneNumber) loITRDS.OCUSTOMERS.Save() This save command writes the data back into RAMS. Scenario: Booking a service In this scenario a customer wants to book a service for their bin. In order to simplify this process the customer has an On-Call contract entry setup on them holding the bin details. The customer logs into a web page and provides this contract number. Once the web site has collected this contract number it does the following. Step 1: Load the ITRDS object loITRDS = Createobject("ITRDS.RP_CLIENT") Step 2: Set the Connection method to the RAMS data. This can be either local data or over the net using http. In this example the data is sitting locally on the network. llSuccess = loITRDS.SetConnection("LOCAL")
Step 3: Set the RAMS system to use on this connection. It is possible to access more than one RAMS system through a connection. For example if you have different RAMS "Companies" setup. llSuccess = loITRDS.SetSystem('RAMS01') Step 4: Create a service work order Assuming the customer information captured by the web page is; Contract number = "OC13564"
Service Date = 24/11/2004
Work Order Type to create = "SER"
Runsheet comment = "Please collect from rear gate"
Runsheet comment type = "P"
then the single line of code to create this work order is as follows
loITRDS.oWorkorders.Createforcontract(";
OC13564",{24/05/2004},"SER","1","Please collect from rear gate","P") The run number assigned and all other attributes for the job come fro the contract setup. It's that easy. There's even a function to retrieve available service dates for the customer. Scenario: Paying an invoice online These days online payments is standard for most services. Here is how you can use the ITRDS to allow your customers to do online payments. 3 Step 1: Retrieve Invoices for Payment First you need to retrieve outstanding invoices. We assume that the customer has entered their account number into the web site and that it's 3453463. loITRDS.Invoices.Query("DATE, INVOICE, STATUS, BALANCE WHERE ACCOUNT = '3453463' AND BALANCE > 0","",31) lnInvoices = loITRDS.Invoices.oRows.Count Step 2: Display the invoice information to the user This is done by accessing the data retrieved which is stored in the oRows property as follows For ln = 1 to lnInvoices lcInvoice = loITRDS.Invoices.oRows.Item(ln).Invoice lnBalance = loITRDS.Invoices.oRows.Item(ln).Balance Endfor Using the above method you can retrieve the invoice information. Once the user selects the invoice to pay and you retrieve there card details and confirm the payment, then putting this into RAMS is as easy as follows: oITRDS.oBatch.New() loITRDS.oBatch.addfieldvalue("ACCOUNT","3453463") loITRDS.oBatch.addfieldvalue("AMOUNT","100.34") loITRDS.oBatch.addfieldvalue("CODE","PAYCOD") loITRDS.oBatch.addfieldvalue("Date",{01/04/2004}) loITRDS.oBatch.lPosttofirstunprocessed = .t. loITRDS.oBatch.cType = "P" loITRDS.oBatch.Save() The above will place the payment into the batch for processing |