The hardest part of this question is for me to figure out how to state it. Please bear with me! :)

Project: Recurring and non-recurring billing with various discount structures.

Here I need a system that will bill for various services, many of which are delivered on a monthly basis. The goal is to write the system in such a way so that customers who are on a certain 'plan' which gives them definable discounts and freebies, can all have the discounts applied to their accounts automatically reflect changes in the master 'plan'.

What I have trouble envisioning is the actual structure of how discount plans are recorded. Customers may be on more than one plan, so a need for precedence sorting also exists.

I imagine I will have a table in which I will store all possible 'products', and then sign up customers to be billed for one-time or recurring sets of these products. Two things may happen here: A) a discount 'plan' is applied which affects the pricing of the products the customer is purchasing. B) another 'plan' is added which gives a customer a certain group of products at a certain grouped price, in this case, if the customer already has these products in their purchase list, the 'regular priced' items are supposed to be overridden by the (identical) promo items, BUT if the promo is removed, the original set of products must be re-established.

SO... I am not asking any of you to write this system for me :) I've got most of it under control.

What I am looking for is advice on how to allow non-programmers to enter and maintain sets of promo rules, that may be applied to certain clients or products. Of course, I would like to establish this system in the most general and efficient way possible.

I have thought of having a Rules table that will look like this:

Rule Name | Field Name | Condition | Action ----------+------------+-----------+------- blah | item | is "abc" | item_price = regular_price * 0.85
However, here the Action column is essientially code, which I want to avoid. It is preferable that the person entering this would not have to be a programmer.

Any ideas or suggestions for this? Ever done something similar? All information greatly appreciated!

Andy


In reply to Writing a Billing System by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.