Quantcast
Channel: Sage 100
Viewing all articles
Browse latest Browse all 37081

Forum Post: Scripting help on mas200 4.5 server 2012

$
0
0
  We had created a script for mas200 4.40 and upgraded to 4.50. recompiled everything and all the scripts are there. We have a udt setup for customer specific pricing. When entering a sales order , and goto the lines tab  and start entering ,the script is suppose to go out to the udt table based on date,customer number, and  item number and grab the price. It only works for the first line. All lines entered afterwards do not get the price. This happens for invoice data entry as well. If I run the script as mas90 on my laptop it works fine (windows 7). If I run it on windows server 2008 R2  as mas200 it runs fine. This install is on a server 2012 , running it as mas90 or mas200 it does not work.  I put in a message box and the script is firing on each line but does not grab the pricing for the second line. It is almost like the pointer is not moving once it found the first line item pricing.  I have tried putting the MoveFirst in different places and no luck. Is this an OS issue? Is vbscript different for 2012 server ?  Thanks in advance for any help. This is an event drivien script , the script is below:     retVal = 0   oPricing = 0 VDPCustomer = "" SOItem = "" VDPItem = "" VDPStartDate = 0 VDPEndDate = 0 VDPPrice = 0 SOCustomer ="" SODivision ="" SOInvDate="" SalesOrderNo="" CItem = "" CSDate = "" CEDate = "" CCust = "" CPrice = 0 CCustItemDate = "" DivCust = "" PriceOver ="" ItemType = ""       retVal = oBusObj.GetValue("ItemCode$", SOItem) retVal = oBusObj.GetValue("UDF_Price_Override$", PriceOver) retVal = oBusObj.GetValue("ItemType$", ItemType)     'msgbox "sales order: "+salesorderno   'retVal = oheaderobj.GetValue("CustomerNo$", SOCustomer) ' msgbox socustomer   'oSalesHeader = oSession.GetObject("SO_SALESORDER_BUS","SO_SALESORDERHEADER") 'SET oSalesHeader = oSession.AsObject(oSalesHeader)   'msgbox osalesheader 'msgbox oheader.salesorderno 'msgbox oheader.ardivisionno   'retval = oSalesHeader.Find("SalesOrderno") 'msgbox retval   retVal = oheaderobj.GetValue("ArDivisionno$", SODivision) retVal = oheaderobj.GetValue("CustomerNo$", SOCustomer) retVal = oheaderobj.GetValue("InvoiceDate$", SOInvDate) DivCust=SODivision+SoCustomer   'msgbox SODivision+SOCustomer+SOItem+SOShipDate   if SOItem "" and PriceOver "Y" and ItemType="1" then                   oPricing = oSession.GetObject("CM_UDT_svc", "SO_UDT_CUSTOMER_PRICING")                   if oPricing 0 then                                   SET oPricing = oSession.AsObject(oPricing)                                                                 'retVal = oPricing.SetBrowseFilter(SODivision&SOCustomer&SOItem)                                   'If retVal 0 Then    'GetValue on UDF_Price and SetValue into UnitPrice                                                                                 Do Until cBool(oPricing.EOF)                                                                                                                                 retVal = oPricing.GetValue("UDF_CUSTOMER_ITEM_DATE", CCustItemDate)                                                                                     retVal = oPricing.GetValue("UDF_CUSTOMER_NUMBER", CCust)                                                                                 retVal = oPricing.GetValue("UDF_ITEM_NUMBER", CItem)                                                                                 retVal = oPricing.GetValue("UDF_END_DATE", CEDate)                                                                                 retVal = oPricing.GetValue("UDF_START_DATE", CSDate)                                                                                 retVal = oPricing.GetValue("UDF_Price", CPrice)                                                                                                                                                 If SOInvDate = CSDate and SOInvDate = CEDate and CItem=SOItem and DIVCUST=CCust then                                                                                   'msgbox CCustItemDate+" "+CCust+" "+CItem+" "+CSDate+" "+CEDate   '+" "+CPrice                                                                                 'msgbox "updating pricing"                                                                                 retVal = oBusObj.SetValue("UnitPrice", CPrice)                                                                   Exit Do                                                                 End If                                                                   retVal = oPricing.MoveNext()                                                 loop                                                   retVal = oPricing.MoveFirst()                                   Else 'Revert to a default price or do nothing or display message to user, whatever you want                                                                 'End If                                                                 'if cBool(oPricing.Find("1")) then                                   '               retVal = oPricing.GetValue("UDF_Price", VDPPrice)                                 '               retVal = oBusObj.SetValue("UnitPrice", VDPPrice)                                   'end if                   end if   end if   

Viewing all articles
Browse latest Browse all 37081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>