Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    87

    Unanswered: Northwind db, invoice form: how to calculate discount for half products ?

    Hi there,

    I have a db, very similar to northwind invoice form, where i print invoices. But there are some invoices that need to calculate discount for certain products (fields), but not for all. And this discount calculation should be as a total (e.g. not discount number besides each "certain" product, and 0 beside others)....

    At the moment program calculates totals at the end of product list (e.g. in unbound field source is: =sum(prices) ) then discount from this sum and totals at the end.Like in northwind.

    But how do i make it calculate in the middle of my product list the total, and discount for it and then below again products, their total and final sum for both "totals" below....?

    Any ideas? Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you stroe a discount rate, or code against an item ordered, then apply that discount to each applicable item.
    in you report just sum the discounted values, no need to recalculate the discount

    You need to think carefully abut what discount rules your assignment requires.
    is it a product discount
    is it on the whole invoice
    how is it calculated
    - is is a flat rate ie customer x gets x% off products fo this type
    - does it change with volume (eg 5% if line value is 100, 7.5% on 150 etc...)
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2005
    Posts
    87
    It is flat rate. Yes, idea of discount sum is interesting, i'll look into that.

    But how do i make it "appear" in my report, discount sum in the middle of product list? lets say right below those products, that have discounts?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    how have you identifed if a discount applies to an ordered item.
    if you have stored it as a percentage then apply that to the line value, if its a flag drawing the perentage fro elsewhere, or a discount rules table then bring tht value as part of the query.
    if its a single discount applicable to all customers (ie a single value) then store it in a module not the report and write a function say called CalcDiscount() and do you rules processing in there
    if you used a flag then
    pub func CalcDiscount(ItemValue single,DiscFlag) as single
    if DiscFlag=TRUE
    ' apply your discount rate here
    else
    CalcDiscount=0
    endif

    as to how you report it thats up to you traditionally its a "good" thing to let a customer see that they have got some discount, So adjacent to the product line I'd expect to see either %discount and discounted value or just discounted value

    any bound control can be easily summed in a group, page or report footer. if the contorl isn't bound hten you can interecept the values byplacing some code in the reports detil events (eg creating running totals). In some cases, if the footer is especailly complex its quicker to do this as part of the report in code (not to sure if thats stil the case)
    HTH
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •