For the prefilled data you have this :
db.invoice.fieldname.default = your previous predefined form data

For your model, I think it is much more complex then that... For instance,
what's happen when there is new Items? You add new column to your model
each time? (bad idea). Also storing company in the invoice table is a bad
idea (denormalized) because you will have to input each time company name
and address in you company field. For this you may consider to add a
company table and change your company string field like that :

 Field('company', 'reference company'),

You will have to populate company table first with another form then select
the new inserted company after in your invoice form.

The same goes for the items they should go in an item/product table and you
should have a items_id field that could be of time list:reference where you
select the item, though you will not be able to precise the quantity that
way.

There is tonnes of schema design for invoice app :

Here some UML :

https://www.google.ca/search?q=invoice+database+schema&espv=2&tbm=isch&imgil=j-vKuBZKWTALKM%253A%253Bhttps%253A%252F%252Fencrypted-tbn2.gstatic.com%252Fimages%253Fq%253Dtbn%253AANd9GcRrkWvL-9FvYRH5sr5lgH6QWiut3gK4MfVzMP26BcvCI2rV7x-u%253B503%253B285%253B2YNCt_eklOX5dM%253Bhttps%25253A%25252F%25252Fpeople.ok.ubc.ca%25252Frlawrenc%25252Fteaching%25252F304%25252FNotes%25252F&source=iu&usg=__q2COFwdJchOn1mZeO6vYLLlpjHk%3D&sa=X&ei=wnXJU-T3D8SUyASKs4CgBQ&ved=0CB4Q9QEwAA&biw=1920&bih=995#facrc=_&imgrc=j-vKuBZKWTALKM%253A%3B2YNCt_eklOX5dM%3Bhttps%253A%252F%252Fpeople.ok.ubc.ca%252Frlawrenc%252Fteaching%252F304%252FNotes%252FER%252FInvoice.png%3Bhttps%253A%252F%252Fpeople.ok.ubc.ca%252Frlawrenc%252Fteaching%252F304%252FNotes%252F%3B503%3B285


Richard




On Fri, Jul 18, 2014 at 2:57 PM, Jesse Ferguson <[email protected]> wrote:

> This is kind of two questions but I would like to build a app to handle
> Invoicing, We have some "satellite" offices in other towns and it would be
> nice to get rid of our hand written paper forms and faxing(FORM
> https://drive.google.com/file/d/0BydRLdL9cc4mNzhjR1U3MHVPVjA/edit?usp=sharing
> ). I would like to know whats the best practice for building the data model
> on large forms? Should the form be all one table? There's about 35 items,
> which 20 or so would just be integers (amounts of item).. below I have an
> example of what I'm thinking of going with. Finally I would like to
> implement a auto-filling form, for example if the user types in a location
> that has already been put in once before it will automatically fill in the
> mileage and person to attn to, would this be best handled with a javascript
> framework? If so could you push me towards one to learn? (my javascript is
> weak but I'm working on it :))
>
> Thanks in advance!
>     Jesse Ferguson
>
> EXAMPLE MODEL
>
> db.define_table('invoice',
>     Field('price_list', 'integer'),
>     Field('account_code','string'),
>     Field('company', 'string'),
>     Field('attn', 'string'),
>     Field('customer_order_number', 'string'),
>     Field('ccc_so_num', 'string'),
>     Field('date_of_work', 'date'),
>     Field('wo_location', 'string'),
>     Field('lease', 'string'),
>     Field('details', 'list:reference'),
>     )
>
> --
> 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].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to