# Customized Panes for 'xxxxxxxx' Created: 2009/04/09 # PANE:Warehouse Values Graph [PANE] ADMIN xxxxxxxx 01000Warehouse Values Graph 010 000000500000INVPEN011M000 [VBSCRIPT] ' This script contains functions for customized pane events. ' You must not modify the name of the functions. Option Explicit Function CustomizedPane_OnLoad() dim GraphProperties GraphProperties = GraphProperties & "" GraphProperties = GraphProperties & "" GraphProperties = GraphProperties & "" GraphProperties = GraphProperties & "" GraphProperties = GraphProperties & "</AxisX>" GraphProperties = GraphProperties & "<AxisY><Title Text='Value' /></AxisY>" GraphProperties = GraphProperties & "</Panel>" GraphProperties = GraphProperties & "</Panels>" GraphProperties = GraphProperties & "<Series LegendText='Value' Style='Bar' />" GraphProperties = GraphProperties & "</CodejockChart>" CustomizedPane.CodeObject.GraphProperties = GraphProperties RefreshGraph() End Function Function CustomizedPane_OnRefresh() RefreshGraph() End Function Function RefreshGraph() ' Specify the variables to be used when calling the business object dim XMLOut, XMLParam, Warehouse, PurchValMth1 dim Node(3) ' Populate the Stockcode variable with the refresh value Warehouse = CustomizedPane.CodeObject.RefreshValue if Warehouse = "" then exit function end if ' Build up the XML to be passed to the business object XMLParam = XMLParam & " <Query>" XMLParam = XMLParam & " <Option>" XMLParam = XMLParam & " <IncludeBankBalances>N</IncludeBankBalances>" XMLParam = XMLParam & " <IncludeApBalances>N</IncludeApBalances>" XMLParam = XMLParam & " <IncludeArBalances>N</IncludeArBalances>" XMLParam = XMLParam & " <IncludeInventoryValuation>Y</IncludeInventoryValuation>" XMLParam = XMLParam & " </Option>" XMLParam = XMLParam & " </Query>" on error resume next ' Call the business object, supplying the XML and putting the result in to XMLOut XMLOut = CallBO("COMQEX",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 only lines containing a valid MLot must be displayed. Dim NewXML, NewXMLE, xDoc, xList, Counter, XMLDoc, UseIncase1, useinCase2 Dim WIB, WIE, WHB, WHE, DESB, DESE, VALCB, VALCE, VAL1B, VAL1E, VAL2B, VAL2E NewXML = "<OutputXML>" NewXMLE = "</OutputXML>" WIB = "<WarehouseItem>" WIE = "</WarehouseItem>" WHB = "<Warehouse>" WHE = "</Warehouse>" DESB = "<Description>" DESE = "</Description>" VALCB = "<WarehouseValueCur>" VALCE = "</WarehouseValueCur>" VAL1B = "<WarehouseValuePrev1>" VAL1E = "</WarehouseValuePrev1>" VAL2B = "<WarehouseValuePrev2>" VAL2E = "</WarehouseValuePrev2>" ' Load the output from the business object in to the DOM Set XMLDoc = createobject("MSXML2.DOMDocument") XMLDoc.async = false XMLDoc.LoadXML(XMLOut) ' Locate the OperationItem elements Set xlist = XMLDoc.SelectNodes("//WarehouseItem") ' Loop through each MaterialPosting section For counter = 0 To xlist.length - 1 ' Check only extract information for current warehouse If xlist(counter).SelectSingleNode("Warehouse").Text = Warehouse then ' Build the new XML containing the original content of the OperationItem nodes and ' combine the two required times and the two issued times. NewXML = NewXML & WIB NewXML = NewXML & WHB & xlist(counter).SelectSingleNode("Warehouse").Text & WHE NewXML = NewXML & DESB & xlist(counter).SelectSingleNode("Description").Text & DESE NewXML = NewXML & VALCB & xlist(counter).SelectSingleNode("WarehouseValueCur").Text & VALCE NewXML = NewXML & VAL1B & xlist(counter).SelectSingleNode("WarehouseValuePrev1").Text & VAL1E NewXML = NewXML & VAL2B & xlist(counter).SelectSingleNode("WarehouseValuePrev2").Text & VAL2E NewXML = NewXML & WIE End If Next ' Complete the XML by closing off the root element NewXML = NewXML & NewXMLE set xmldoc = nothing 'Load the XmlOut into the DOM Dim xmlDoc2, MyVar, FinalString, Count Set xmlDoc2 = createobject("Msxml2.DOMDocument") xmlDoc2.async = false xmlDoc2.LoadXML(NewXML) Set Node(1) = xmlDoc2.SelectSingleNode("//WarehouseValueCur") Set Node(2) = xmlDoc2.SelectSingleNode("//WarehouseValuePrev1") Set Node(3) = xmlDoc2.SelectSingleNode("//WarehouseValuePrev2") FinalString = FinalString & "<CodejockChart>" FinalString = FinalString & "<Series><Points>" FinalString = FinalString & "<Point Label='Current' Value='" & Node(1).text & "' />" FinalString = FinalString & "<Point Label='Previous' Value='" & Node(2).text & "' />" FinalString = FinalString & "<Point Label='Previous 2' Value='" & Node(3).text & "' />" FinalString = FinalString & "</Points></Series>" FinalString = FinalString & "</CodejockChart>" CustomizedPane.CodeObject.GraphData = FinalString Set xmlDoc2 = nothing End Function