Companion to the prorated refund calculator, this calculator is for a prorated charge.
Calculator can work with a per-license charge, or a flat fee (like adding a new service).
Only calculates for annual subscriptions.
{note: trim=yes}
{formtoggle: name=per license; default=yes}{formtoggle: name=flat fee; default=no}{endnote}
{if: `per license` AND `flat fee`} {error: You can only select one type at a time; block=yes}{elseif: not `per license` and not `flat fee`}{error: Select charge type; block=yes}{elseif: `per license`}{note}1) Enter number of licenses being added: {formtext: name=new licenses}
2) Enter the full annual cost per license: {formtext: default=120; name=cost per license}
3) Enter date new licenses available: {formdate: YYYY-MM-DD; name=newstartdate}
4) Enter the end-date of their current annual term: {formdate: YYYY-MM-DD; name=enddate}{chargeamount=(((`cost per license`/365)*(datetimediff(newstartdate, enddate, "D")))*`new licenses`)}{endnote}
{if: chargeamount<0}{error: End date must be after the date new licenses are available; block=yes}{else}
{note: trim=left}
Prorated amount to charge the customer: {endnote}{=chargeamount; format=$.2f}{endif}
{elseif: `flat fee`}{note}1) Enter the full annual cost of the new service being added: {formtext: name=annual cost}
2) Enter the date the new service is being added: {formdate: YYYY-MM-DD; name=newstartdate}
3) Enter the end-date of their current annual term: {formdate: YYYY-MM-DD; name=enddate}{chargeamount=(`annual cost`/365)*datetimediff(newstartdate, enddate, "D")}{endnote}{if: chargeamount<0}{error: End date must be after the date new service is being added; block=yes}{else}
{note: trim=left}
Prorated amount to charge the customer: {endnote}{=chargeamount; format=$.2f}{endif}
{endif}