Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Building Reports and Print Layouts    Estimates: summarize calculated columns
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
Hi all,
I've submitted this question to Marketcircle support, but it seems to me a good question for this forum.

I'm trying create a very simple estimate in Daylite. Imagine you have to quote some products to a customer and create an Opportunity and, in this Opportunity, an Estimate with those columns:

- Name (of product)
- Units
- Sale price
- Total (price)
- Total cost of the products
- Total margin

First column: it's the Name field
Second column: it's the Units field
Third column: it's the Sale price field
Fourth column: it's the Total field
Fifth column: it's a calculated column: Cost Of Goods * Units. Ok, it works
Sixth column: it's a calculated column, too: Total - (Cost of Goods * Units). It works (it could be also Profit * Units).
Ok the columns with, say, our ten items work correctly.

But now we go to the last part of this estimate: the totals.
We need the following:
- Subtotal
- tax 1
- tax 2
- Total
- Total of Cost of Goods
- Total of Margin
- Margin percent

The first 4 sums are easy. They are the fields Subtotal, tax 1, tax 2, Total.
But how is it possible to have the sum of Cost of Goods*Units column? Or the sum of the ANY calculated column of your estimate? And calculate a value between to sums (margin percent)?
And I until now am talking of a SINGLE estimate.

After that, I'll need to summarize the same totals for a number of estimates... Ouch!

Maybe I'm missing something... I can't believe it's so difficult to create a very simple report. Or is it?

Many, many thanks for your help.
 
Posts: 1 | Registered: June 07, 2008Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Oscar
Posted Hide Post
Let's take the fifth column for example.

We will use a script token to display the value for this calculated column and we will also write the value to the reportLayout. The reason we have to do this is because the calculated column is not really stored anywhere that we can call or pull from.

So place a script token, this can be found under the "Special" tab when editing a dynamic text.

In the script token you will have the following:

------------------------------------

"First you do your calculations. You'll have to use the actually key paths"
value := Cost Of Goods * Units.


"Now we get the running total"
rTotal := (element enclosingReportLayout) reportDataForKey:'runningTotal'.

"The first time we get it, it will be nil since it hasn't been set yet. If it is we need to set it to zero since we can add a number to nil"
(rTotal == nil) ifTrue:
[
rTotal := 0.
].

"We add the calculated value to the total"
rTotal := value + rTotal.

"We then set the new running total"

(element enclosingReportLayout) setReportData:rTotal forKey:'runningTotal'.

"We display the calculated value"
value.


------------------------------------------

Now we need to pull this value in the summary row cell of the table. So we insert a script token. The script token will have the following:

"Grab the running total and display it"
(element enclosingReportLayout) reportDataForKey:'runningTotal'.



-----------------------------------


You're done.
 
Posts: 451 | Location: Toronto | Registered: February 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Building Reports and Print Layouts    Estimates: summarize calculated columns

© Copyright 2006 Marketcircle Inc. All rights reserved.