How to override collectTotals function In Magento? - magento-1.9

I want to add custom value i.e custom fees in cart page bellow subtotal. so the Grand total should contain the custom fee. here i mean to say that during Quote state Grand total should contain custom fee. and from Quote to Order State grand total must contain that custom fee.

Related

(SSRS v.15) How do I obtain a group's each individual totals outside of the group?

My query includes 4 groups. Category > Type > Activity > Nature > detailPrice.
I have the report built with 4 different List Items stacked into each other. Each list is one of the four groups. The detailPrice is a table (pink).Each of the 4 groups has a different colored border, to differentiate (just for testing).
Each list shows a Total of the previous list. List 2 (Activity) shows the sum total of the entries in List 1 (Nature), and so on. The total of List 4 (Category) shows the grand total of all the previous lists.
My 3rd List's group (Type) is always split into two sections: Revenue and Expenses. So there are two totals in the 3rd List's grouping: the first is 90033, the second is 37627.
Here's the total of Revenue. Only the first number matters, which is 90033.
Inside my fourth list (Category), rather than just show the grand total (of Revenue - Expense), I want to show both the total of Revenue and Expenses, and then show the grand total.
For the Grand Total, I simply sum the proper field. But I am unable to get the 90033 and 37627 I need.
I've tried many different options:
When the 3rd list sums the Revenue, I put that value in a custom code variable, and then the same with Expenses. =IIF(Fields!Type.Value = "Revenue", Code.addTotal("R",SUM(Fields!detailPrice.Value)) (the function simply adds the detailPrice to one of two variables: totalR and totalE depending on the first parameter)
I tried the same with a Report Variable =IIF(Fields!Type.Value = "Revenue", Variables!totalR.SetValue(SUM(Fields!detailPrice.Value)))
I also tried Running Values, but didn't get very far.
I can't simply access the ReportItem!total of the 3rd group, as I am trying to get it from outside the group.
After all my attempts, my two variables (totalR and totalE) have the same value: 37627. I can never get 90033 as well as 37627. I can get the total of Expenses... but not Revenues. I feel like the total of the Expenses group overrides the Revenue value, but I have no idea how to keep that 90033 to use it outside of the group.
Is it possible to reference each total in a group outside of said group?

MS Access: Trying to do DSum() across multiple fields in a form but it won't filter by criteria

I am trying to create a form that takes sums from certain fields and displays it next to its appropriate field name. I've attached pictures of it in datasheet form (how it's displayed) and its design form.
In more detail, the description items on the left are the "fields" (that I will call "tags" from now on and will be listed in other tables in a column called Associated Bid Items). I've basically tagged several other items in tables and queries throughout my Access App. I am trying to collect all items with the same tags/fields and add up Total MH (man-hour) units associated with these items.
The code I have in the second textbox in the second image is:
=DSum("[Total MH]","qry-PipingHandleMH","[Associated Bid Item]=[Text_BidItem].Value")
where Total MH is what I am summing up, qry-PipingHandleMH is the query I'm pulling from, and Text_BidItem is the first textbox in the second image. I want to sum only the Total MH where the Associated Bid Item (column in other tables where the tags are listed) matches Text_BidItem.
NOW THE PROBLEM: Several items in other tables and queries have already been tagged with each of the tags shown in the first image. Each of those descriptions/tags in the first image should have a Total MH associated with it. The SQL code above does not separate the totals into its rows appropriately as shown in the first image. Here is the longer version of the code:
=DSum("[Total MH]","qry-PipingHandleMH","[Associated Bid Item]=[Text_BidItem].Value")+DSum("[Total MH]","qry-PipingMakeupMH","[Associated Bid Item]=[Text_BidItem].Value")+DSum("[Total MH]","qry-PipingValvesMH","[Associated Bid Item]=[Text_BidItem].Value")+DSum("[Total MH]","qry-PipingWeldingMH","[Associated Bid Item]=[Text_BidItem].Value")+DSum("[Total MH]","qry-CoatingAGMH","[Associated Bid Item]=[Text_BidItem].Value")+DSum("[Total MH]","qry-CoatingUGMH","[Associated Bid Item]=[Text_BidItem].Value")
Basically the same code applied to different tables but added together. That's is whats really in the second textbox in the second image currently. As you can see in the first image it is all applied to the "Large Bore Piping 2" and greater" row. Why isn't the summation of Total MH seperating into its respective rows? DSum() is working but the filtering and separation is just all wrong.
Must concatenate variable parameters. Reference to Text_BidItem is a variable parameter.
=DSum("[Total MH]","qry-PipingHandleMH","[Associated Bid Item]=" & [Text_BidItem])
If [Associated Bid Item] is a text type then will need apostrophe delimiters:
=DSum("[Total MH]","qry-PipingHandleMH","[Associated Bid Item]='" & [Text_BidItem] & "'")
Advise no spaces or punctuation/special characters (underscore only exception) in naming convention.

MS Access report sections challenge

Thank you for reading
I have a subreport that lists a number of purchase orders (POs) and displays the total of the orders in the footer detail section of the subreport.
The subreport is locayes within the Detail section of the main report.
In the main report; right before the subreport I have an amount (control) that is the allowance for a client (clients cannot order more than a given amount every month).
So I have the allowance and the total of POs. I want to see the balance (Allowance minus Total of POs) in the "balance" control in the footer section of the detail of the main report but I don't know how to reference the control that hosts the total of POs.
You can certainly reference controls in subforms/subreports. Though site here uses forms, the same concept applies to reports.
Specifically for your situation. Add a Balance textbox control in header or footer of main report with following control source expression (pay heed to exclamation and period markers):
=[Allowance] - [Reports]![yourmainrptname]![yoursubrptcontrolname].[Report]![yoursubrptfooterPOstotalcontrolname]

SSRS subtotalling columns with expressions

Using Visual Studio 2010 and SQL Server 2012
I have made an SSRS report that requires a custom method to subtotal and arrive at a grand total for Percent of Assets and other calculations derived from Percent of Assets. I cannot simply use the Add Total Function because it is grayed out as is typical when summing expressions. I cannot manually calculate the subtotals because I get a nested aggregate error.
The software I'm using to make this SSRS report provides various stored procedures and functions to make reports using derived computations. The stored procedure contain a Percent of Assets column but because the report is filtered to show only common stock, the percentage of Assets function is incorrectly still counting unfiltered assets in its calculation. The assets under consideration make up 59.7 % of total holdings but I need the report to behave as if they were 100% of holdings.
To understand some of the math in this report please look at the following report output. Note that the report I want only includes common stock which make up 59.7 Percent of total assets as mentioned.
This report represents the desired output which is currently being calculated in a different reporting program. The report has two tables
% Company Sales is a hard coded value that represents the percent of sales that are either domestic or international. You see this and % Portfolio Assets in both the international and domestic tables.
% Portfolio Assets is calculated by multiplying the percent of assets of a given holding by the hard coded company sales value. In the first example McDonald's 2.1% Portfolio Assets is 6.6% * 32%.
6.6% is the percent of Assets McDonald's represents in the portfolio is if you only count common stock (exclude cash)
McDonald's Value Total Portfolio Value %
4,950.00 / 73,919.50 = 6.6000%
Domestic/ International Percentage breakdown
Total % Sales %Split Region
6.60% 32% 2.1% Domestic
6.60% 68% 4.5% International
Now here is my report output. It differs slightly from the design layout I will be showing because I added columns and changed the headers for explanatory purposes in this preview example. So far I am just trying to get the Domestic table to work. Once that is working I will build the international table. I have a few extra colums that I'm using for troubleshooting.
I have tried several methods to Calculate Portfolio Assets. I can get the individual row values to be correct but I cannot get the subtotal value to be correct using different methods due to a nested aggregate error (summing and already summed expression when a data scope is used) The grand total is also important but for now I'm just trying to get subtotal working.
Here is one method to get the row detail value for Percent of Assets. This is used in the calculated Percent Column. This column is the one that won't allow me to subtotal without a nested aggregate error.
When I try to use the following expression to get the subtotal I get the nested aggregate error
=SUM(Fields!MarketValue.Value/Sum(Fields!MarketValue.Value, "DataSet1"))
ERROR Error 2 [rsInvalidNestedDataSetAggregate] The Value expression for the text box ‘Textbox39’ has a nested aggregate that specifies a dataset scope. Inner aggregates cannot specify a dataset scope.
If use the PercentAssets field which is included in the Stored Procedure I can subtotal and get grand total without errors but the value is the filtered value which only sums to 59.7 if I multiply this filtered percent by the company sales the value is wrong.
Last I tried to use custom VBA code to get my subtotal and grand totals. However this provides a running total of the calculated percents not the subtotals I need for the SectorName groups.
Here is the VBA Code I used which I found on the web here:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1d3c5ec1-89cb-4108-8637-ff434027b1ec/sum-an-expression-value-ssrs
Dim public nettotal as Double
Public Function Getvalue (ByVal subtotal AS Double) AS Double
nettotal = nettotal+ subtotal
return subtotal
End Function
Public Function Totalvalue()
return nettotal
End Function
Code deployed
In summary I need to multiply the calculated Percent column's values by the Company sales. I need to subtotal the result of these calculations.
If you look in the Information Technology Sector Grouping you can see the original report correctly arrives at 32.8 as the subtotal.
My report incorrectly arrives at 100% because that is the running total tally of the Calculated percents.
Here is a link to the original rdl
https://dl.dropboxusercontent.com/u/87501202/InternationalDomestic.rdl
It looks like your code:
=SUM(Fields!MarketValue.Value/Sum(Fields!MarketValue.Value, "DataSet1"))
isn't quite correct... Try this instead:
=SUM(Fields!MarketValue.Value)/Sum(Fields!MarketValue.Value, "DataSet1")
Breaking it down slightly, the second piece of code is expression / expression; now it's just two SUM expressions with different scopes as required - the first one looks like the syntax is off slightly, hence your error.

Business Objects XI Web Intelligence how to reference a list of measures as variables in a prompt?

The requirement is to present a user with a list of measure names in two prompts. The user selects a measure name from each prompt. Based on the user selection, the actual measures are mapped into blocks on the report. Some of the measures are counts and some are dollar amount sums so data type specific formatting applies.
The final report gives a side by side comparison of the two measures that the user selects.
Prompt #1 targets the left hand block
Prompt #2 targets the right hand block
Each list of measure names is 10 items long.
The idea is that this one report can be used as the template for a number of different side by side comparisons for two measures.
How to reference a list of measures as variables in a prompt?
How to map the user selections to the actual measures in the data provider?
If I understand you correctly you want to give user a possibility to select between e.g. Revenue, Amount, Cost, Profitability, Average Price.
Each of this values represents a measure in the universe.
I would create in the universe an object
[promptMeasure]=
case #prompt('Select measure','A',{'Revenue', 'Amount', 'Cost',
'Profitability', 'Average Price'}),mono, constrained,persistent)
when 'Revenue' then [Revenue]
when 'Amount' then [Amount]
when 'Cost' then [Cost]
when 'Profitability' then [Profitability]
when 'Average Price' then [Average Price] end
Add this object to your query in the report.
In the report you can also use function FormatNumber and apply conditional formatting dependent on the value of the prompt:
For example:
[FormattedMeasure]=if UserResponse("Select measure")='Profitability'
then FormatNumber([promptMeasure];"#,##0.0%")
else FormatNumber([promptMeasure];"#,##0.00")