I figured out where my problem was, I switched up the arrangement of 
figures in markedCalc:, I put the dividing value before the markup value as 
opposed to what i did initially which was bringing it before the markup 
value and it worked.

*Field('markupCalc', 'integer', compute=lambda r: 
(float(r['markup'])/100*float(r['unitPrice']))),*



On Monday, January 13, 2020 at 6:54:25 PM UTC+2, mostwanted wrote:
>
> 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/92634948-0e6c-43a7-bf87-d0ddc8b95f70%40googlegroups.com.

Reply via email to