dongyukang7006 2012-03-26 10:43
浏览 48

销售点的库存数据库(任何x为x英镑)

I'm working on an inventory / invoice system written in MySQL / PHP (possibly with some kind of Access front end as well as web interface).

The problem is that I want the inventory of products to be able to cope with items that have discounts for multiples such as "any two for £10". What I want to happen is if say 10 items are added to an invoice, it can work out if any of those items meet the "any x for £x" requirements and apply the discount. The added complication is that any item could have different multiple discounts such as "any 2 for £10" as well as "any 3 for £12". Basically like what the supermarkets do - nice an easy for the end user.

It works fine if I want any x of the SAME item entered on to the same invoice line but it needs to be more flexible than that.

Does anyone have any ideas on how I could do this? Thanks in advance. I am pretty good with HTML / MySQL / PHP / JavaScript etc.

  • 写回答

3条回答 默认 最新

  • doulandai0641 2012-03-26 11:30
    关注

    Working with PHP and MySQL, you could have a "discounts" table where you save the ID for the product, the number of the products, price and name of the offer. In this way, with a simple query, when you are calculating the final value for the invoice you check against the table if an offer for each product exists:

    SELECT * FROM discounts WHERE product_id = x AND quantity >= y

    So, in the end, you have a table for products and prices and a related table for offers.

    评论

报告相同问题?

悬赏问题

  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。