7 Replies Latest reply on Nov 22, 2010 4:23 PM by philmodjunk

    Problem setting up category discounts totals

    AlexGodines

      Title

      Problem setting up category discounts totals

      Post

      Ok my setup is made so i can give discounts to every category in a sumary page. each category is seperated so it shows the categorys subtotal then i have a Discount Rate box to give it a % discount and it discount box which shows how much is being discounted and the subtotal box which shows the subtotal discounted.

      Now what i want it to do is minus the total discounts of the subtotal category discounts into the original subtotal so i can get the grandtotal. but for some reason i cant get it right any tips would be great

        • 1. Re: Problem setting up category discounts totals
          philmodjunk

          If you refer to a summary field in a calculation, you get a grand summary based on all the records in your found set. To refer to a sub-total, you need to use the GetSummary function. The "break field" parameter in this function should be the same field as the "sorted by" field you specify in the set up for your sub summary part.

          • 2. Re: Problem setting up category discounts totals
            AlexGodines

            Everyime i try to make it a get summary function i keep getting a "Only summarys are allowed as the first arguement in a Getsummary function"

            • 3. Re: Problem setting up category discounts totals
              philmodjunk

              Yep, that's why it's called GetSummary. Wink

              You have this format for the GetSummary function:

              GetSummary ( SummaryField ; Break Field )

              Let's say you have a summary field, sTotal, that computes the total quantity of invoice line items and it is defined in the Line Items table.

              You create a summary report with a Sub Summary part "sorted by" the Invoice ID field so that this summary field computes the total for each invoice, provided you sort your records by Invoice ID so that line item records from the same invoice are grouped together.

              If you want to use this Invoice Subtotal in a calculation, you can do this:

              GetSummary ( sTotal ; InvoiceID )  // and records must be sorted by InvoiceID

              • 4. Re: Problem setting up category discounts totals
                AlexGodines

                Well i got it setup up to show me the total Discount number. how i can i use that to set up to minus the order total. make it a little bit simpler for me. cause it seems i cant do it the way your telling me. any tips would be great

                • 5. Re: Problem setting up category discounts totals
                  philmodjunk

                  This only works with summary fields. If you are using calculiaton fields with aggregate functions such as Sum(), Average(), Count(), etc., you need to take a different approach.

                  What is your "total discount number" the total of and how did you set it up? What field definition are you using to compute the order total?

                  • 6. Re: Problem setting up category discounts totals
                    AlexGodines

                    This is how i setup discount total

                    Invoice LineItems Table::Discount Total: Summary Total of Discount

                    This is how i got my order total. Ignore discountin the order table thats a total discount for the order total i got individual discounts i need to factor in.

                    Invoices Table::Subtotal:Calculation Sum ( Invoice Lineitems::Subtotal )
                    Invoices Table::Order Total: Subtotal - Discount + Shipping

                    • 7. Re: Problem setting up category discounts totals
                      philmodjunk

                      Define this field in LineItems to compute a category total that includes the discount total for the same category:

                      sOrderTotal: Total of Subtotal    // specify whatever field computes the total cost of one line item record

                      Now GetSummary ( sOrderTotal ; CategoryField ) - GetSummary( sDiscountTotal ; CategoryField )

                      This works as long as your line items records are sorted by CatogoryField.