Invoice from multiple orders?

帅比萌擦擦* 提交于 2019-12-24 07:23:01

问题


I need a way to create an invoice from multiple orders every month?

In the tbl_order table, I have a list of orders from the customer.

tbl_order table

OrderID (PK)
ShopID (FK)
CustomerID (FK)
Statu
Total
OrderDate

Let say I want to create an invoice for period: 1 to 31 May from tbl_order.ShopID = 2

(From there, I can an invoice report to a Shop/Company of Commission they owe me, etc. When I do recieved commission from them - I need a way to update invoice status)

The invoice should have Invoice Number and Invoice Date, in the invoice there will be multiple OrderID.

Do I need to create an invoice table, if so what the table design should be?


回答1:


You would need 2 tables.

The invoice table.

InvoiceID (PK)
InvoiceDate
InvoicePrice
InvoiceBtw
ect. etc.

An link table between orders and invoices. So you can keep track which order is processed in which invoice.

InvoiceID (FK to tbl_invoices.InvoiceID)
OrderID (FK to tbl_orders.OrderID)



回答2:


Yes you would require an invoice table.

The structure could be:

InvId (Autonumber) 
InvNumber (varchar (10))
InvOrderId (int(11))
InvStatus (int(11))
InvDateCreated (DateTime)
InvDateModified (DateTime)

Hope this helps



来源:https://stackoverflow.com/questions/6278061/invoice-from-multiple-orders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!