# Customized Panes for 'xxxxxxxx' Created: 2016/09/30
# PANE:Reserved Stock
[PANE]
ADMIN INVPENLZ 01000Reserved Stock 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()
' Build up structure of listview using XML
' Define the column types to force the correct display of all fields
' Hide columns that are less likely to be used to reduce size
dim ListXML
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
ListXML = ListXML & ""
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, StockCode
CustomizedPane.CodeObject.ListviewData = " "
' Populate the Stockcode variable with the refresh value
StockCode = CustomizedPane.CodeObject.RefreshValue
if StockCode = "" then
exit function
end if
' Build up XML to call INVQWR business object. Set all options except sales orders to be N to reduce the
' amount of XML to be returned.
XMLParam = XMLParam & " "
XMLParam = XMLParam & " "
XMLParam = XMLParam & " "
XMLParam = XMLParam & " "
XMLParam = XMLParam & " "
XMLParam = XMLParam & " "
' Call INVQWR business object using the above XML
on error resume next
XMLOut = CallBO("INVQWR",XMLParam,"auto")
if err then
exit function
end if
' Switch on error handling
on error goto 0
' Because the display should only contain lines where either the QtyReserved or QtyReservedShip contain
' a value you cannot just take the output from the business object. The following section is used to
' extract the values, check that the line contains values that are greater than zero, and build a new XML
' string that only contains these lines.
' Define the variables required for building the new XML structure and extracting the information from the DOM.
Dim NewXML, NewXMLE, xDoc, xList, xList2, Counter, Counter2, XMLDoc
Dim RSIB, RSIE, SOB, SOE, SOLB, SOLE, OSB, OSE, CB, CE, CRDB, CRDE,WB, WE, OQB, OQE, SQB, SQE, SCTB, SCTE
Dim BOQB, BOQE, OUB, OUE, QRB, QRE, SQSB, SQSE, QRSB, QRSE
' Populate the variables with the element names. Ones ending in B are the beginning elements, ones ending in E are
' the ending elements
NewXML = ""
NewXMLE = ""
RSIB = ""
RSIE = ""
SOB = ""
SOE = ""
SOLB = ""
SOLE = ""
OSB = ""
OSE = ""
CB = ""
CE = ""
CRDB = ""
CRDE = ""
WB = ""
WE = ""
OQB = ""
OQE = ""
SQB = ""
SQE = ""
BOQB = ""
BOQE = ""
OUB = ""
OUE = ""
QRB = ""
QRE = ""
SQSB = ""
SQSE = ""
QRSB = ""
QRSE = ""
SCTB = ""
SCTE = ""
' 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 SalesOrderItem elements
Set xList = XMLDoc.SelectNodes("//SalesOrderItem")
' Loop through each of the SalesOrderItem elements
For Counter = 0 To xList.length - 1
' Check to see if either the QtyReserved or QtyReservedShip values are greater than zero
If xList(Counter).SelectSingleNode("QtyReserved").Text > 0 OR xList(Counter).SelectSingleNode("QtyReservedShip").Text > 0 then
' Build the new XML containing the original content of the SSalesOrderItem nodes for those that have reserved stock
NewXML = NewXML & RSIB
NewXML = NewXML & SOB & xList(Counter).SelectSingleNode("SalesOrder").Text & SOE
NewXML = NewXML & SOLB & xList(Counter).SelectSingleNode("SalesOrderLine").Text & SOLE
NewXML = NewXML & OSB & xList(Counter).SelectSingleNode("OrderStatus").Text & OSE
NewXML = NewXML & CB & xList(Counter).SelectSingleNode("Customer").Text & CE
NewXML = NewXML & CRDB & xList(Counter).SelectSingleNode("MCustRequestDat").Text & CRDE
NewXML = NewXML & WB & xList(Counter).SelectSingleNode("MWarehouse").Text & WE
NewXML = NewXML & OQB & xList(Counter).SelectSingleNode("MOrderQty").Text & OQE
NewXML = NewXML & SQB & xList(Counter).SelectSingleNode("MShipQty").Text & SQE
NewXML = NewXML & BOQB & xList(Counter).SelectSingleNode("MBackOrderQty").Text & BOQE
NewXML = NewXML & OUB & xList(Counter).SelectSingleNode("MOrderUom").Text & OUE
NewXML = NewXML & QRB & xList(Counter).SelectSingleNode("QtyReserved").Text & QRE
NewXML = NewXML & SQSB & xList(Counter).SelectSingleNode("MStockQtyToShp").Text & SQSE
NewXML = NewXML & QRSB & xList(Counter).SelectSingleNode("QtyReservedShip").Text & QRSE
NewXML = NewXML & RSIE
End If
Next
' Look for all SctItem elements
Set xList2 = XMLDoc.SelectNodes("//SctItem")
' Loop through each of the SalesOrderItem elements
For Counter2 = 0 To xList2.length - 1
' Check to see if either the QtyReserved or QtyReservedShip values are greater than zero
If xList2(Counter2).SelectSingleNode("QtyReserved").Text > 0 OR xList2(Counter2).SelectSingleNode("QtyReservedShip").Text > 0 then
' Build the new XML containing the original content of the SSalesOrderItem nodes for those that have reserved stock
NewXML = NewXML & RSIB
NewXML = NewXML & SOB & xList2(Counter2).SelectSingleNode("SalesOrder").Text & SOE
NewXML = NewXML & SOLB & xList2(Counter2).SelectSingleNode("SalesOrderLine").Text & SOLE
NewXML = NewXML & OSB & xList2(Counter2).SelectSingleNode("OrderStatus").Text & OSE
NewXML = NewXML & SCTB & "Yes" & SCTE
NewXML = NewXML & CRDB & xList2(Counter2).SelectSingleNode("ReqShipDate").Text & CRDE
NewXML = NewXML & WB & xList2(Counter2).SelectSingleNode("MWarehouse").Text & WE
NewXML = NewXML & OQB & xList2(Counter2).SelectSingleNode("MOrderQty").Text & OQE
NewXML = NewXML & SQB & xList2(Counter2).SelectSingleNode("MShipQty").Text & SQE
NewXML = NewXML & BOQB & xList2(Counter2).SelectSingleNode("MBackOrderQty").Text & BOQE
NewXML = NewXML & OUB & xList2(Counter2).SelectSingleNode("MOrderUom").Text & OUE
NewXML = NewXML & QRB & xList2(Counter2).SelectSingleNode("QtyReserved").Text & QRE
NewXML = NewXML & QRSB & xList2(Counter2).SelectSingleNode("QtyReservedShip").Text & QRSE
NewXML = NewXML & RSIE
End If
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
' Destroy the occurence of the DOM
Set XMLDoc = Nothing
End Function