# Customized Panes for 'xxxxxxxx' Created: 2009/04/09 # PANE:Supplier Registered Invoices [PANE] ADMIN INVPENLZ 01000Supplier Registered 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 up the XML that defines the listview structure ListXML = ListXML & "" 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 CustomizedPane.CodeObject.ListviewData = " " if Supplier = "" then exit function end if ' Build up the XML that will be supplied 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 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, IDB, IDE, IVB, IVE Dim DVB, DVE, DDB, DDE, RefB, RefE, APB, APE, IRSB, IRSE, DueB, DueE, EDB, EDE, DISB, DISE, FUDB, FUDE Dim BRB, BRE, BUB, BUE, DB, DE, CB, CE, EREB, EREE, LotItems, XMLDoc, UseIncase NewXML = "" NewXMLE = "" PDB = "" PDE = "" InvB = "" InvE = "" IDB = "" IDE = "" IVB = "" IVE = "" DVB = "" DVE = "" DDB = "" DDE = "" RefB = "" RefE = "" APB = "" APE = "" IRSB = "" IRSE = "" DueB = "" DueE = "" EDB = "" EDE = "" DISB = "" DISE = "" FUDB = "" FUDE = "" BRB = "" BRE = "" BUB = "" BUE = "" DB = "" DE = "" CB = "" CE = "" EREB = "" EREE = "" ' 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("//Supplier") ' 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("RegisteredInvoices/RegisteredInvoiceDetail") ' 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 & xList2(Counter2).SelectSingleNode("Invoice").Text & InvE NewXML = NewXML & IDB & xList2(Counter2).SelectSingleNode("InvoiceDate").Text & IDE NewXML = NewXML & IVB & xList2(Counter2).SelectSingleNode("InvoiceValue").Text & IVE NewXML = NewXML & DVB & xList2(Counter2).SelectSingleNode("DiscountValue").Text & DVE NewXML = NewXML & DDB & xList2(Counter2).SelectSingleNode("DiscountDate").Text & DDE NewXML = NewXML & RefB & xList2(Counter2).SelectSingleNode("Reference").Text & RefE NewXML = NewXML & APB & xList2(Counter2).SelectSingleNode("AuthorisingPerson").Text & APE UseIncase = xList2(Counter2).SelectSingleNode("InvRegnStatus").Text Select Case UseIncase Case "R" NewXML = NewXML & IRSB & "Returned to supplier" & IRSE Case "A" NewXML = NewXML & IRSB & "Approved" & IRSE Case "C" NewXML = NewXML & IRSB & "Cancelled" & IRSE Case Else NewXML = NewXML & IRSB & "Registered" & IRSE End select NewXML = NewXML & DueB & xList2(Counter2).SelectSingleNode("DueDate").Text & DueE NewXML = NewXML & EDB & xList2(Counter2).SelectSingleNode("EntryDate").Text & EDE NewXML = NewXML & DISB & xList2(Counter2).SelectSingleNode("DateInvoiceSent").Text & DISE NewXML = NewXML & FUDB & xList2(Counter2).SelectSingleNode("FollowUpDate").Text & FUDE NewXML = NewXML & BRB & xList2(Counter2).SelectSingleNode("Branch").Text & BRE NewXML = NewXML & BUB & xList2(Counter2).SelectSingleNode("Buyer").Text & BUE NewXML = NewXML & DB & xList2(Counter2).SelectSingleNode("Department").Text & DE NewXML = NewXML & CB & xList2(Counter2).SelectSingleNode("Currency").Text & CE NewXML = NewXML & EREB & xList2(Counter2).SelectSingleNode("ExchRateAtEntry").Text & EREE 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