Adding multiple records to different forms based on calculations from initial form
I have a form (called ServiceRequest) that collects input for services that we provide. The input includes "Start Date" and "End Date". From this, the "Duration in Days" is calculated and a price is quoted (column name = Quote)
What I would like to do upon submission of this form, is have it calculate the number of weeks in the duration (Duration_in_Days/7). Using this value, the equivalent number of records would be written to the table named (ServicePaymentCalendar) passing with it prorated price (Quote/number of weeks) along with weekly dates corresponding to each week. I also would pass other variables (ServiceID, etc)
Example
- User inputs a Start Date of 1/1/2012 and End Date of 2/1/2012 (i already have this logic built in)
- Total days of duration is calculated to be 31 (i already have this logic built in)
- Price is quoted (calculated) as $2000 (i already have this logic built in)
- 31 days = 4.42 weeks
- Records to be written = 5 (rounding up since 4.42 is not an integer)
Record data would mirror the spreadsheet below
