Possible Duplicate:
php group by SUM using multi dimensional array
I'm working on creating shopping-cart for a wholesale company. And i'll create also invoice later. It's same logic.
Firstly, i multiply paket (package) * paket adeti (package quantity) * fiyat? (price) And i wrote it at the end of list. Now i have to calculate vat. The main problem is we don't know vat ratios exactly before.
May be there exist 3 different vat ratios. (it depends on the products which customer selects) May be one.
I made an array of vats
$vats[] = array($row['vat'], $row['wholesaleprice'] - $wholesaleprice);
Result is like that
Array (
[0] => Array ( [0] => 18 [1] => 1,07 )
[1] => Array ( [0] => 8 [1] => 0,44 )
[2] => Array ( [0] => 8 [1] => 0,67 )
[3] => Array ( [0] => 18 [1] => 0,55 )
[4] => Array ( [0] => 18 [1] => 0,19 )
[5] => Array ( [0] => 8 [1] => 0,48 )
[6] => Array ( [0] => 18 [1] => 2,59 )
[7] => Array ( [0] => 8 [1] => 0,15 )
[8] => Array ( [0] => 18 [1] => 12,97 )
)
I have to sum vat group by ratios...
And i want to display like
VAT (%18) 136,26 TL VAT (%8) 16,90 TL VAT (%1) 9,28 TL
How can i do that in shortcut. I've check array functions. But i couldn't find anything useful.
Shopping Cart: http://i.stack.imgur.com/DDsCq.png
Try something like this:
Output of
$data_summ
:If I understand you correctly.