CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: distributed amounts: Edit Log



lightspd
Novice

Mar 15, 2013, 10:09 AM


Views: 908
distributed amounts

Hi All,

This may belong more in the beginners section. I'm hoping someone with a bit more data manipulation experience might be able to help me or have an idea. Anyway, here is the issue.

I have a array of hashrefs, each hashref is a ticket item, with several fields. I have no control over the received data, it will always be an array of hashrefs. The ones I'm working with are the amt and discounted amount. The discounts amount gets subtracted from every time a discount is applied to that item. Issue is that there are both distributed discounts, that apply to every item and individual item discounts.

When a discount is distributed I need to make sure it's not subtracting more than is currently in the discounted amount field. If it is, then distribute the remainder to the rest of the items, if they have a high enough amt.

I haven't started to code it, so don't have anything to show you, but suggestions are greatly appreciated. I'm sure the answer involves a simple sort on discounted amount, but I'm drawing a blank.

Cheers.


(This post was edited by lightspd on Mar 15, 2013, 10:49 AM)


Edit Log:
Post edited by lightspd (Novice) on Mar 15, 2013, 10:12 AM
Post edited by lightspd (Novice) on Mar 15, 2013, 10:49 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives