Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Regular Contributor
wakeet
Posts: 51
Registered: 11-03-2008
0

Product Line Discounts - Scripting an Option?

We are preparing for an upgrade from 4.3 to 4.4.  We have been using SO 1547 (Product Line Pricing) for years.  Unfortunately this was discontinued for 4.4.  I was hoping to avoid using a MD for a custom MOD because my previous history involving this is not good.

 

I was wondering if what I'm attempting to do may be achievable using the advanced scripting capabilities of 4.4.

 

We have have thousands of customers, thousands of items, and hundreds of product lines.  Our customers each receive unique discounts on unique product lines.  Example:

 

Customer ABC receives a 43% discount on Product Line 123

Customer XYZ receives a 42% discount on Product Line 123

etc...

 

SO 1547 allowed us easily maintain the product line discounts without using VI and maintaining a separate pricing database.  The nice thing was it was simple to use.  Our salespeople could maintain their pricing within MAS.

 

Does anyone have any suggestions on how I could somehow accomplish the same thing?  I was thinking if I had a UDT that contained the Customer/Product Line pricing data I could have some sort of script run during SO/IN Entry that would validate the pricing with my UDT.

 

I would appreciate any thoughts or direction. 

 

Thanks!

 

 

Evan Wake
IS Director
The GLT Companies
Super Contributor
connex
Posts: 794
Registered: 10-29-2008
0

Re: Product Line Discounts - Scripting an Option?

[ Edited ]

I used advanced scripting to replace the product line pricing enhancement with existing MAS price lookup tables so that I could utilize the existing Customer Item Pricing user interface, but only for % discount. I used a Column Post Validation event on the Quantity Ordered column to lookup and replace the standard price.

 

I did encounter one situation where the Price Lookup screen off the Inventory Maintenance program does not fire an event script as it should.  Not a big issue, but it does keep the solution from working in all places as it should.  This problem has been verified by Sage support and has been in fix pending status since June 2010.

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Regular Contributor
wakeet
Posts: 51
Registered: 11-03-2008
0

Re: Product Line Discounts - Scripting an Option?

Dan, I believe I saw your post regarding the problem during my forum search.

 

It sounds like you are familiar with exactly what I'm trying to do.  How did you use the existing IM_PriceCode file to store your Product Line Discounts?

 

The old enhancement created a new PriceRecord Type, "P".  That record stored the Customer Number, Product Line, Pricing Method, Break Qty, etc...

 

I can't create a new record type so I don't exactly know where to start.  Can you nudge me in the right direction?

Evan Wake
IS Director
The GLT Companies
Super Contributor
DFeller
Posts: 2,943
Registered: 10-28-2008
0

Re: Product Line Discounts - Scripting an Option?

I am in the process of replacing SO-1005 with advanced scripting.  These seem similar.

 

Dawn

Regular Contributor
wakeet
Posts: 51
Registered: 11-03-2008
0

Re: Product Line Discounts - Scripting an Option?

My thought process is this:

 

Create a UDT containing the Customer Number, Product Line, and Discount %.

Create s script that will run on the "Column Post Validation event on the Quantity Ordered column" to search through my UDT and identify if a discount exists.  It will then multiply the standard price by the discount and write this value to the unit price field.

 

Sound doable?

 

I have quite a bit of VB experience but this is my first attempt at using the scripting within MAS.  I watched Steve's sample videos (http://community.sagemas.com/t5/Personalization-Customization/Deep-Dive-Into-Customizer-for-MAS-90-a...) so I think I'm on the write track. 

 

Again, I would appreciate any feedback.

Evan Wake
IS Director
The GLT Companies
Super Contributor
DFeller
Posts: 2,943
Registered: 10-28-2008
0

Re: Product Line Discounts - Scripting an Option?

Yes this sounds like the right track.

 

Dawn

Regular Contributor
wakeet
Posts: 51
Registered: 11-03-2008
0

Re: Product Line Discounts - Scripting an Option?

Thanks Dawn!

 

 

Evan Wake
IS Director
The GLT Companies
Super Contributor
connex
Posts: 794
Registered: 10-29-2008
0

Re: Product Line Discounts - Scripting an Option?

[ Edited ]

Rather than use a UDT for product line discounts, I made use of the existing Price Code table by entering each product line as a discontinued item. I also changed the wording on the Item Pricing Maintenance panel to say "Item Or Product Line".  The event script can then scan the standard Price Code table by quantity and product line (as an item) to select the correct price.

 

This provides unique product line pricing for each customer instead of just a price level like SO-1005 if that's what one needs. It works just like customer item pricing, but for product lines.  If any of the other pricing methods take effect, I leave the price as it is.

 

I also provided a replacement to the "Recalc Price" button in S/O entry so that pre-existing orders can be correctly re-priced (as well as when item prices change).

Dan Burleson
Sage Authorized Consultant - Ask me about advanced scripting!
e-mail me here
Regular Contributor
wakeet
Posts: 51
Registered: 11-03-2008
0

Re: Product Line Discounts - Scripting an Option?

I like it.  I will give that a shot.  Thanks again for the direction!

Evan Wake
IS Director
The GLT Companies
Regular Contributor
wakeet
Posts: 51
Registered: 11-03-2008
0

Re: Product Line Discounts - Scripting an Option?

Thanks to everyone.  I've made major progress. I watched Steve's videos on scripting in 4.4 and read all through the forums for tips.

 

I seem to have a hit a stumbling block.  The script is almost working perfectly.

 

I'm using the following script to check and see if there is a record in my IM_PriceCode file and apply a discount if it exists:

 

First, create the IM_PriceCode business object

 

'creates the IM_PriceCode business object
oItemPrice = 0
Set oItemPrice = Session.AsObject(oSession.GetObject("IM_PriceCode_bus"))

 See if a product line record exists.  The key format is "2.Item.Division & Customer "

 

'looks for the product pricing record in IM_PriceCode.  
retVal = oItemPrice.SetKeyValue("PriceCodeRecord$", "2")
retVal = oItemPrice.setKeyValue("ItemCode$", "~" & strProdLine)
retVal = oItemPrice.SetKeyValue("ARDivisionNo$", "00")
retVal = oItemPrice.SetKeyValue("CustomerNo$", strCustomer)
retVal = oItemPrice.SetKey()

 if the product line pricing record exists, calculate the new price

'if 1 then the pricing record was found
if retVal = 1 then
	retVal = oItemPrice.GetValue("DiscountMarkup1", numDiscount)
	retVal = oBusObj.GetValue("UnitPrice", numPrice)
	numDiscount = 1 - (numDiscount / 100) 'converts the discount amount to the decimal multiplier
	retVal = oBusObj.SetValue("UnitPrice", numPrice * numDiscount) 'calculates the new unit price
	retVal = oBusObj.SetValue("CommentText$", cStr(numDiscount)) 'testing to display current discount value
end if	

 

 

This works great!  although there is one problem...the discount isn't "forgotten" after it is used.  it is applied to the next line even if it doesn't have product line pricing setup.

 

Example:

Item ABC does not have pricing setup

Item XYZ has product line pricing setup with a 30% discount

 

When Entered into SO Lines

Line 1 - ABC - no discount applied

Line 2 - XYZ - 30% discount applied

Line 3 - ABC - 30% discount applied   <-------  no discount should be applied but it is carried from the previous line

 

Thanks again. 

 

 

 

 

 

Evan Wake
IS Director
The GLT Companies