i hope you are ok, well i have been having a problem with some code here and have searched all over the internet but i was not able to get a solution
db.define_table('t_stck_issue',
Field('f_name', type='reference t_items',
label=T('Name')),
Field('f_stck_client', type='reference t_clients',
label=T('Client Assgn')),
Field('f_stck_quantity', type='integer',
label=T('Stock Quantity')),
Field('f_unit_price', type='double',
label=T('Unit Price')),
Field('f_sub_total',type='double', compute=lambda r:r['f_unit_price']*r['f_stck_quantity'],
label=T('Sub Total')),
auth.signature,
format='%(f_name)s',
migrate=settings.migrate)
db.define_table('t_stck_issue_archive',db.t_stck_issue,Field('current_record','reference t_stck_issue',readable=False,writable=False))
def stck_issue_manage():
#form = SQLFORM.smartgrid(db.t_stck_issue,onupdate=auth.archive)
form = SQLFORM.grid(db.t_stck_issue)
myrow=db().select(db.t_stck_issue.f_sub_total.sum())[0]
answer=myrow._extra['SUM(t_stck_issue.f_sub_total)']
return locals()
well it calculates the sub total field for all properly, but i would like it to change when i filter by client to do the sub total for that particular client only