Hello there!
Is there a way to add sums AND rests inside the same view?
In example:
I´ve got a view that shows a list of nodes and aumonts. Each node has one of two terms: debt and bonus.
In example:
Martha has brought:
1 book -- debt -- 100
1 spoon -- debt -- 50
1 hat -- bonus -- 20
So I need to sum debts and add bonus like:
100 + 50 - 20 = $130

Is there a way to accomplish this with Views Calc?
Thanks!!

Rosamunda

CommentFileSizeAuthor
#3 customer-details.gif80.61 KBbailz777

Comments

dob_’s picture

same problem here.

I have a view with all payments and all invoices and want to substact the sum of the invoices and the sum of payments.

bailz777’s picture

I am working on this exact same problem, did you manage to solve this?

I am assuming that we can get the return value of the two calculated views, stick them into a Views custom php and then subtract the paid amount from the total amount to express the balance per invoice.

Alternatively if this is not possible, you can also just do a global php view and add all the values from the two tables as the calc views does and then do the manipulation.

If you have solved this please let me know, else I will post my answer here once I solve the issue.

bailz777’s picture

StatusFileSize
new80.61 KB

Ok, I could not find any way to make this function through the use of views calc or views at all.

I created a block that took an argument from the url:

<?php
$path = drupal_get_path_alias($_GET["q"]);
$path = explode("/",$path);
if($path[0] == "account-overview" && $path[1] != "")
{
 $argu = $path[1];
}
?>

Note: $path[1] is the nid of my customer, I simply made the nid the customer id in our system and made this a referance value in our cck for both invoices and receipts
from here I made two queries to the db
the first called all the invoice amounts where the referring nid = $path[1]
the second called all the receipt amounts where the referring nid = $path[1]

now I was able to only show the values relative to one client

I subtracted the paid from the total and put the balance into a nice table.

if you got any questions feel free to ask me.

It would be nice if calc views total could have a return value, but we do what we can :)

I attached an image of my final page
Customer Details Image

karens’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

The D6 version is no longer supported.