Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7080123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:45:22+00:00 2026-05-28T06:45:22+00:00

I am writting a C# website that uses Credit. A customer will buy $x

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:45:23+00:00Added an answer on May 28, 2026 at 6:45 am

    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:

    enter image description here

    Steps:

    1. Each user will have gift vouchers stored in database…
    2. every user can purchase more than one voucher any time..
    3. the logic for deduction on using the voucher..

      Logic is here as per the image

    steps

    1. select each individual voucher based on expiry of the voucher.
    2. then take the voucher amount and place a condition if(voucher amount > total purchase)
      if ($52>$210) = false
    3. result is false therefore voucher1 – amount 0 – total purchase variable to $210-$52=$158
    4. voucher 1 balance 0 (zero) updated
    5. repeat 2,3, 4 for next voucher but total purchase will be $158 now as $52 is already redeemed
    6. second voucher is of amount $48 for same condition if($48 > $158) – false $158-$48 = $110
    7. update balance to zero for voucher 2 $48 redeemed
    8. third voucher is $100 same condition if($100>$110) – false ($110-$100) = $10

    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..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a new website that uses PHP and MySQL. I am trying
i'm writing a component that is to be used across multiple websites. each website
I am writing a installer using WiX that will create a website and virtual
I'm writing a userscript for a website that uses Prototype. Rather than use the
I am writing an app that my client uses given javascript, which will collect
I'm writing a python script that scrapes a website, where the website uses OpenID
I'm writing a website that let users submit credit card information and subscribe my
I am writing some code for a website that uses 4 list items to
I'm writing a Chrome extension that works with a website that uses ISO-8859-1. Just
I have a PHP based website that uses coupon codes. I can restrict search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.