I am new to web2py so please excuse any obvious questions. I have the 
following table:
db.define_table('timeclock',
    Field('project','string', required=True, label='Project'),
    Field('work_date','date', required=True, label='Work Date'),
    Field('time_in','time', required=True, label='Time In'),
    Field('time_out','time', required=True, label='Time Out'),
    Field('description', 'text', required=True, label='Description'),
    Field('hours','double', label='hours'),
    Field('usr_id','reference auth_user', label='ID', readable=False)
)
db.timeclock.project.requires = IS_IN_DB(db,'siri_projects.name')
db.timeclock.work_date.requires = IS_DATE(format='%m/%d/%Y')
db.timeclock.time_in.requires = IS_NOT_EMPTY()
db.timeclock.time_out.requires = IS_NOT_EMPTY()
db.timeclock.description.requires = IS_NOT_EMPTY()
db.timeclock.usr_id.writable = db.timeclock.usr_id.readable = False
if auth.is_logged_in():
    db.timeclock.usr_id.default=auth.user.id

and the following function in the controller:
@auth.requires_login()
def displaytime():
    """
    Shows the entries for the user that is logged in
    """
    grid = SQLFORM.smartgrid(db.timeclock, deletable=False, editable=False, 
create=False, orderby=~db.timeclock.work_date)
    return dict(grid=grid)

how do I total the hours worked column for the smartgrid? I would like for 
it to be totaled based on the current subset so that if I filter the 
smartgrid the total only shows for the filtered results (e.g. an employee 
wants to be able to view hours worked in a certain pay period).

Thanks in advance.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to