Not sure 100% but may be something like this?

$c->addSelectColumn(TablePeer::VAT);
$c->addSelectColumn('sum('.TablePeer::NETTO.') as SumOfNetto');
$c->addSelectColumn('sum('.TablePeer::BRUTTO.') as SumOfBrutto');
$c->addGroupBy(TablePeer::VAT);

$rs = TablePeer::doSelectRS($c);

$total = array();
while ($rs->next()) {
  $total[] = array(
    'vat' => $rs->getInt(1), // VAT
    'netto' => $rs->getInt(2), // SumOfNetto
    'brutto' => $rs->getInt(3), // SumOfBrutto
  );
}

// pass array to the template
$this->total = $total;

And then you just print $total in the template.

Hope that helps

On Sun, Feb 8, 2009 at 8:33 AM, Tomasz Ignatiuk
<[email protected]> wrote:
>
> Any guess?
>
> On 5 Lut, 20:56, Tomasz Ignatiuk <[email protected]> wrote:
>> Thank you David for your answer but I think we didn't understand each
>> other, I think I didn't explain my problem well. I don't want to sum
>> those to values. For example I have this table:
>>
>> VAT  |  NETTO  |  BRUTTO
>> -------------------------
>> 22%  |  10     |  12
>> 22%  |  15     |  19
>> 7%    |  35     |  43
>> 3%    |  28     |  30
>> 7%    |  72     |  80
>> 3%    |  11     |  13
>> 22%  |  16     |  20
>> 7%    |  5      |  7
>>
>> If I sum it and group by VAT it will be
>>
>> VAT  |  NETTO  |  BRUTTO
>> -------------------------
>> 22%  |  42     |  51
>> 7%   |  112    |  143
>> 3%   |  39      |  43
>>
>> I know how to show each netto value and each brutto value:
>>                   <td><?php echo $row['nettosuma']; ?></td>
>>                   <td><?php echo $row['bruttosuma']; ?></td>
>>
>> But I need to show VAT value for these sums (22%, 7%, 3%). I have to
>> know which sum belongs to weach VAT group. Because know I get this and
>> know one know which some is for which group.
>> VAT  |  NETTO  |  BRUTTO
>> -------------------------
>>         |  42     |  51
>>         |  112    |  143
>>         |  39      |  43
> >
>



-- 
Blue Horn Ltd - System Development
http://bluehorn.co.nz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to