What will be the function like?Can you please send me.I am new in cakephp.

On Fri, Feb 11, 2011 at 6:55 PM, Mattijs <[email protected]> wrote:

> Well,
>
> You can't sum price directly in your query since you are showing each
> record individually as well, so I guess you'll need a combination.
>
> a) in your controller: find('all', array('order' => 'Contractor.name,
> Table.dt'))
> b) in your view: sum up price while iterating. Whenever you get a new
> contractor: display sum and reset
>
> Alternatively, you could create a function in your Contractor model,
> retrieving all contractors with contained items and have that function
> calculate the sum into the contractor results.
>
> On 11 feb, 13:56, "[email protected]" <[email protected]>
> wrote:
> > I have a table
> >         id
> >         buyer_id
> >         item_code
> >         contractor_id
> >         price
> >         dt
> >         item_name
> >
> > Now I want display dt(date) wise billing but contactor also will be in
> > sequence like this:
> >
> > Contractor    buyer_id          item_code      price
> > item_name
> > A                       12                   2112
> > S                jgj
> > A
> > 14            ..............................................
> >
> ----------------------------------------------------------------------------------------------
> >                                         sum(price)
> >
> > B
> ......................................................................................
> > B
>  
> ......................................................................................
> > B
> ......................................................................................
> >
> ----------------------------------------------------------------------------------------------
> >                                         sum(price)
> > C
> ......................................................................................
> > C
> ......................................................................................
> > C
> ......................................................................................
> >
> ----------------------------------------------------------------------------------------------
> >                                         sum(price)
> >
> > how to write the query.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to