Why item and item_entry, I don't understand the utility of item_entry and
where's the invoice table (service-order is invoice?)?

To me the cost and amount field of item and item_entry are going in the
service_order table since they deserve the purpose of indicating the price
paid for this item in the particular invoice record context. Why storing
the total_cost you can compute it as need (it is a matter of choice). I
would not use list-reference field type for items since you can't be
specific.

Here section invoice is the proper way to do it :

http://www.jbilling.com/documentation/developers/database-model

I think I understand you item_entry table in the example above your table
is called "invoice_line". Each items of you invoice (or service order) is
represented by a record in that table. Each records reference the invoice
(or service_order) id.

Now if you use this schema, we can help you create the complex form you
need with web2py to achieve this. If you don't use client side framework
like AngularJS, you will maybe have more then one form in a single page,
but it works just fine and in AngularJS you will have many form anyway. One
form for the invoice and an component form for invoice-line, I can provide
the piece of code you will need to be able to add as many items (form) you
need. It is easy you just have to iterate over the invoice_line of an
invoice and create a form for each, then with Javascript you enable or
desable the update form of a give form.

Hope it helps

Richard






On Fri, Jul 18, 2014 at 8:14 PM, Jesse Ferguson <ifl...@gmail.com> wrote:

>  I think this would work better however I am not sure about the items.. is
> the item_entry table how its normally done? Examples online vary...
> A completed Service order would have multiple Item_entry references...
> Just doesn't seem like the right way to do it..
>
>
> db.define_table('company',
>>
>>     Field('name', 'string'))
>>
>>
>>> db.define_table('lease',
>>
>>     Field('name', 'string'),
>>
>>     Field('attn', 'string'),
>>
>>     Field('location', 'string'))
>>
>>
>>> db.define_table('account_code',
>>
>>     Field('code','string'))
>>
>>
>>> db.define_table('item',
>>
>>     Field('name', 'string'),
>>
>>     Field('pl_no', 'integer'),
>>
>>     Field('cost', 'double'))
>>
>>
>>> db.define_table('item_entry',
>>
>>     Field('item', 'reference item'),
>>
>>     Field('amount', 'double'))
>>
>>
>>> db.define_table('service_order',
>>
>>     Field('so_date', 'date'),
>>
>>     Field('so_num', 'integer'),
>>
>>     Field('so_hours', 'double'),
>>
>>     Field('total_cost', 'double'),
>>
>>     Field('notes', 'text'),
>>
>>     Field('company', 'reference company'),
>>
>>     Field('lease', 'reference lease'),
>>
>>     Field('acct_code', 'reference account_code'),
>>
>>     Field('items', 'list:reference item_entry')
>>
>>     )
>>
>>  --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to