hahahaha thanks for highlighting that! I initially copied & pasted this
line and didnt get rid of some impurities.
On Monday, January 13, 2020 at 7:22:16 PM UTC+2, Ari Lion BR Sp wrote:
>
> *Field('markupCalc', 'integer', compute=lambda r: (float(r['markup']/*
> *100.0**)*float(r['unitPrice']))),*
>
>
> *??*
>
>
> *but why integer?*
> *you will have no precision.....*
>
>
>
> Em segunda-feira, 13 de janeiro de 2020 13:54:25 UTC-3, mostwanted
> escreveu:
>>
>> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/c3d19cc6-876e-4c77-8c91-4545a8906ed8%40googlegroups.com.