I am writting a C# website that uses Credit.
A customer will buy $x amount of credit and if it is not used within 12 months it expires.
I cant figure out a mathematic formula to work out how much should be expired?
IE. A customer may buy $50 of credit on june 1/2011. Then spend $40 july 1/2011, then buy another $60 credit April 1/2012
can you help me with a formula I can use to do this?
I can run a service every day to check the credit and date purchased for every customer.
here i can explain you the complete concept for gift vouchers, and additionally i have implemented the same for my project..
Please refer the image below for proper understanding:
Steps:
the logic for deduction on using the voucher..
Logic is here as per the image
steps
if ($52>$210) = false
if you get any amount greater than voucher amount then eg
voucher amount is $100 and purchased amount is $75 then our if($100>$75) condition will be true
here you will subtract the amount and update with the balance.. $25 as voucher balance
Coming to your logic of expiry you can run the service daily to check the expiry of each voucher on todays date, if you find any voucher just update the balance to 0 at 12:00 am everyday..