# Customized Panes for 'xxxxxxxx' Created: 2009/04/09 # PANE:Supplier Payments (incl retained invoices) [PANE] ADMIN INVPENLZ 01000Supplier Payments (incl retained invoices) 020 000000500000INVPEN000M [VBSCRIPT] ' This script contains functions for customized pane events. ' You must not modify the name of the functions. Option Explicit Function CustomizedPane_OnLoad() ' Define the variable to hold the XML that defines the listview structure dim ListXML ' Build the XML that defines the listview structure. Those items containing the ' attribute Hidden=true will not appear. ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ListXML = ListXML & "" ' Load the XML in to the ListviewProperties variable CustomizedPane.CodeObject.ListviewProperties = ListXML End Function Function CustomizedPane_OnRefresh() ' Define the variables required for building the XML and calling the business object dim XMLOut, XMLParam, Supplier ' Populate the Stockcode variable with the refresh value Supplier = CustomizedPane.CodeObject.RefreshValue if Supplier = "" then exit function end if ' Build the XML input to the business object XMLParam = XMLParam & " " XMLParam = XMLParam & " " XMLParam = XMLParam & " " & Supplier & "" XMLParam = XMLParam & " " XMLParam = XMLParam & " " XMLParam = XMLParam & " " on error resume next ' Call the business object and supply the XML. The resulting XML is placed in the XMLOut variable XMLOut = CallBO("APSQRY",XMLParam,"auto") if err then CustomizedPane.CodeObject.ListviewData = " " exit function end if ' Switch on error handling on error goto 0 ' Define the variables required for building the new XML structure and extracting the information from ' the DOM. This is required because the Warehouse element is held at a different level in the original ' XML, so was not available to be used in the listview Dim NewXML, NewXMLE, xDoc, xList, xList2, Counter, Counter2, PDB, PDE, InvB, InvE, TTB, TTE, JDB, JDE Dim JB, JE, PRB, PRE, TVB, TVE, PVB, PVE, PCB, PCE, LotItems, XMLDoc, UseIncase NewXML = "" NewXMLE = "" PDB = "" PDE = "" InvB = "" InvE = "" TTB = "" TTE = "" JDB = "" JDE = "" JB = "" JE = "" PRB = "" PRE = "" TVB = "" TVE = "" PVB = "" PVE = "" PCB = "" PCE = "" ' Load the output from the business object in to the DOM Set XMLDoc = createobject("MSXML2.DOMDocument") XMLDoc.async = false XMLDoc.LoadXML(XMLOut) ' Look for all InvoiceDetail elements Set xList = XMLDoc.SelectNodes("//InvoiceDetail") ' Loop through each of the InvoiceDetail elements For Counter = 0 To xList.length - 1 LotItems = "" ' Within the InvoiceDetail elements, locate the PaymentDetail elements Set xList2 = xList(Counter).SelectNodes("Payments/PaymentDetail") ' Loop through each SerialItem section For Counter2 = 0 To xList2.length- 1 ' Build the new XML containing the original content of the SerialItem nodes and ' include the Warehouse from several levels above. NewXML = NewXML & PDB NewXML = NewXML & InvB & xList(Counter).SelectSingleNode("Invoice").Text & InvE UseIncase = xList2(Counter2).SelectSingleNode("TrnType").Text Select Case UseIncase Case "P" NewXML = NewXML & TTB & "Payment" & TTE Case "A" NewXML = NewXML & TTB & "Adjustment" & TTE Case "D" NewXML = NewXML & TTB & "Debit note" & TTE Case "C" NewXML = NewXML & TTB & "Credit note" & TTE Case "V" NewXML = NewXML & TTB & "Foreign Currency revaluation" & TTE Case Else NewXML = NewXML & TTB & xList2(Counter2).SelectSingleNode("TrnType").Text & TTE End select NewXML = NewXML & JDB & xList2(Counter2).SelectSingleNode("JournalDate").Text & JDE NewXML = NewXML & JB & xList2(Counter2).SelectSingleNode("Journal").Text & JE NewXML = NewXML & PRB & xList2(Counter2).SelectSingleNode("PaymentReference").Text & PRE NewXML = NewXML & TVB & xList2(Counter2).SelectSingleNode("TrnValue").Text & TVE NewXML = NewXML & PVB & xList2(Counter2).SelectSingleNode("PostValue").Text & PVE NewXML = NewXML & PCB & xList2(Counter2).SelectSingleNode("PostCurrency").Text & PCE NewXML = NewXML & PDE Next Next ' Complete the XML by closing off the root element NewXML = NewXML & NewXMLE ' Load the new XML file in to the ListviewData variable CustomizedPane.CodeObject.ListviewData = NewXML End Function