Allow admin's to do allow discounts for an event on the basis of dates.
Create a Table `civicrm_discount` with fields entity_table,entity_id, option_group_id, start_end, end_date.
Change the 'Event Fees' form to include option to record discount
1. For "Event Fees" Form, change the fieldset name from 'Fee Levels' to 'Regular Fee Levels', which shows current / undiscounted grid.
2. Discounts by Signup Date? checkbox, default = false
(if checked, the following set appears)
-+ Discount Name
-+ Start Date
-+ End Date
and Add more using show hide functionality.
While adding next Discount set, the default value of Start Date of a second discount = End Date of first discount + 1.
Form Rule will ensure values for all the above for a discount.
To keep it simple, the form rule also enforces non-overlapping set of discount start and end dates.
Button 'Post & Reload Discount' when hit will have a grid built in the form.
For every Discount, the grid will have a corresponding column injected with label = Discount Name
(in ascending order of the discount dates).
The discounted sets are added as new option groups to `civicrm_option_group` table with label = Discount Name
and the fee levels are stored correspondingly the `civicrm_option_value` table
and the discount information
(entity_id(as event_id), entity_table(as civicrm_event),option_group_id(from discount set),start_end, end_date)
will go in the `civicrm_discount` table.
NOTE: Changes to the civicrm_participant record :The Label corresponding to the selected event
level for each participant should be stored in participant.fee_level
and the actual amount for each participant is stored in fee_amount.
OFFLINE Event Registration Form :
CREATE :On the basis of event, load the fee level (by default show the discount set whose date range contains registration date) and
give admin ability to choose from select box the discount set he wants for the participant.
EDIT : Event level (discounted set) should be uneditable if there is a corresponding online contribution for the participant but should display fee_level + fee amount)
Discount Set get loaded on the basis of Registration Date.
Export/Search - should handle fee level and fee amount separately.