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 8674373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:41:42+00:00 2026-06-12T19:41:42+00:00

I am developing a pre-pay system for a cafe or fastfood outlet. The premise

  • 0

I am developing a pre-pay system for a cafe or fastfood outlet. The premise is that a retailer will login to an admin page issue itself codes to supply to customers preloaded with credit purchased at the counter.

Currently I have the code system sorted the system will issue a 10 digit unique code and this is hashed and salted before storing in a database. Credit is assigned to the code.

Customers can buy multiple “codes” to build up credit should they want to.

The flow I have at purchase time is the user attempts to purchase an item. The balance of all coupons is calculated at purchase time. If there is sufficient credit the item is purchased the balance is deducted for what ever coupon has enough credit. If the item is $5.60 the coupon with the lowest credit is used and that coupon is now 0.00. The remainder is deducted from the next available coupon should it have insufficient funds. This will prevent anyone ever having dozens of coupons worth .25 or .50 due to purchases.

In the coupon table I have the following structure (some table data omitted)

  +------------+----------------+----------------------+ 
  |    id      |      code      |    balance           |
  +------------+----------------+----------------------+
  |    1       |      abcde     |    10.00             |
  +------------+----------------+----------------------+
  |    2       |      fghij     |    20.00             |
  +------------+----------------+----------------------+
  |    3       |      klmno     |    25.00             |
  +------------+----------------+----------------------+

the transaction table is similar to..

  +------------+----------------+----------------------+ 
  |    id      |      coupon    |    value             |
  +------------+----------------+----------------------+
  |    1       |      abcde     |    2.59              |
  +------------+----------------+----------------------+
  |    2       |      abcde     |    4.50              |
  +------------+----------------+----------------------+
  |    3       |      klmno     |    25.00             |
  +------------+----------------+----------------------+

My theory is the value of the coupon is never changed but the value of transactions is calculated and deducted at purchase time to give the remainder.

Does this seem like a practical approach to this?

If you feel this question does not belong here rather than down vote offer a better forum.

  • 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-06-12T19:41:43+00:00Added an answer on June 12, 2026 at 7:41 pm

    Sounds fine in theory, but since you have to keep records of all coupons and transactions anyway, it does not matter against which coupon a purchase is balanced – you need just the sums.
    If the coupons are transferable between individuals, you would have to first scan all coupons available to an customer before deciding against which coupons you want to check his balance. Looks impractical to me.
    If the coupons are not transferable, they are just receipts for the customer’s deposits on his own account and it does not make sense to single out one of them against which to check.

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

Sidebar

Related Questions

I'm developing a web application that is highly dependent on pre-loading images before displaying
I'm new to developing mobile websites and I have an issue with Palm Pre.
I am developing embedded system that writes to SD card. As you all know,
I am developing for a pre existing PHP based system. I am trying to
I am developing an iOS application that comes pre-loaded with CoreData content. I am
I am developing publishing site. I have some layouts that are pre-populated with web
I've been developing up a custom HTML5 video player that incorporates a pre-roll video.
I am developing a Windows Mobile 6.5 (.NET Compact Framework 3.5) app that will
I know the ARC in iOS 5 but I'm now developing pre-iOS 5 code
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and

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.