Results 1 to 3 of 3

Thread: Problem Designing Tables

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    25

    Problem Designing Tables

    hello,

    i have two invoices..

    1st invoice is Receipt:

    receipt invoice with , autonumber , CustomerName , Receipt No , Items_Sold , Qty , TheirSerialNo , Purchase Date , Today Date ,

    2nd invoice is Delivery:

    autonumber , CustomerName , Receipt No , Delivery No , Items_Sold , Qty , TheirSerialNo , Purchase Date , Today Date

    i tried to desing tables but i failed , how many tables do i need?

  2. #2
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: Problem Designing Tables

    Hi,

    Ive designed stuff like thsi and do this all the time. youre looking at something like this.

    Invoice


    InvoiceNO (auto generated number, NOT NULL, INT 11)
    OrderDate (DATETIME NOTNULL) default value (GETDATE(NOW))
    ContractNo (VARCHAR 100, NOT NULL)
    above could be (BIGINT 100, NOT NULL) if only numberical
    Compnay name (VARCHAR 200, NOT NULL)
    Address1 (Varchar 100, NOT NULL)
    Address2 (VARCHAR 100, NOT NULL)
    City (VARCHAR 50, NOT NULL)
    State (VARCHAR 50 NOt NULL)
    Zip (VARCHAR 50, NOT NULL)
    Tel (BIGINT 100, NOT NULL)
    CtctName (VARCHAR 100, NOT NULL)
    DelAddr1 (VARCHAR 100, ALLOW NULL)
    DelAddr2 (VARCHAR 100, ALLOW NULL)
    City (VARCHAR, 50, ALLOW NULL)
    State (VARCHAR 50 ALLOW NULL)
    DelZip (VARCHAR 50, ALLOW NULL)
    DelTel (BIGINT 100, ALLOW NULL)
    DelCtctNAme ( VARCHAR 100, ALLOW NULL)

    This takes care of the delivery and office addresses, now for the itemisation

    PartNo (VARCHAR 100, NOT NULL)
    above could be again (BIGINT 100, NOT NULL)
    Description (VARCHAR 254, NOT NULL)
    ItemCount (BIGINT 100, NOT NULL)
    Nett (BIGINT 100, NOT NULL)
    Gross (BIGINT 100, NOT NULL)
    VAT (BIGINT 100, NOT NULL) default value ((NETT/100) * 17.5)


    And thats it. this table will now provide any company with a single invoicing reporting system.All youhave to do is write the report layout and code the query
    then you have one table that wil manage all the company stock and invoicing details.

    If you want payment due dates and such, just go ahead and add them using a Date conversion method that is specific to the database being used for this table to convert the order date to the payment date.

    Hope this helps

    Kai
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Problem Designing Tables

    If it's possible to have several deliveries to satisfy an order, you might want to consider more of a "transaction" based table. More flexible (less flat) then what you are suggesting.

    Here's a couple of threads that have dealt with issues like this before:

    http://www.vbforums.com/showthread.p...stock+quantity

    http://www.vbforums.com/showthread.php?t=372988

    http://www.vbforums.com/showthread.php?t=311144

    They might be more stock/quantity related, but the concept is similar...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width