I'm trying to calculate a required percentage value for the entered figure 
but i am getting the wrong answer

Field('unitPrice', 'float', label=SPAN('Unit Price', _style="font-weight: 
bold;"), requires=IS_MATCH('[0-9]+', error_message=T('Enter Money in Proper 
Figures'))),
Field('markup', 'integer', label=SPAN('Markup', _style="font-weight: bold;"
), requires=IS_NOT_EMPTY()),
*Field('markupCalc', 'integer', compute=lambda r: 
(100.0/float(r['markup'])*float(r['unitPrice']))),*
Field('markedupPrice', 'float', compute=lambda r: round(float(r['unitPrice'
])+r['markupCalc'])),

On the code above I'm getting the markupCalc field wrong and it affects the 
markedUpPrice value. How can i correctly calculate a required percentage of 
a given value?

Mostwanted

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/63bead94-0b7c-44c8-a68f-ae0f7e678678%40googlegroups.com.

Reply via email to