db.define_table('invoice',
Field('loaning_date', 'date', label=SPAN('Date Loaned', _style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
Field('returning_date', 'date', label=SPAN('Date Returned', _style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
#Number of days calculation
Field('daysLoaned', compute=lambda r: (r['returning_date']-r['loaning_date']).days),
Field('price', 'float', label=SPAN('Price', _style="font-weight: bold;"), requires=IS_MATCH('[0-9]+', error_message=T('Enter Money in Proper Figures'))),
Field('totalPrice', compute=lambda r: float(r['price'])* int(r['daysLoaned']), label=SPAN('Total Price', _style="font-weight: bold;")))