如何将多个销售订单插入单个销售 [英] How to insert multiple sales orders to single sales
本文介绍了如何将多个销售订单插入单个销售的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我需要为单个销售添加多个销售订单怎么做?
实际上假设客户在单个账单上购买了四个项目那么什么是它的表结构?
Hi I need add multiple sales orders for a single sale how to do it?
Actually suppose if a customer purchases four items on single bill then what is the table structure for it?
推荐答案
来自你的下面的查询应该是表结构。
Hi,
From your query below should be the table structure.
CREATE TABLE tbl_Purchase_Dtls
(
PD_ID BIGINT IDENTITY(1,1),
PD_CUST_ID BIGINT,
PD_ITEM_ID INT,
PD_ITEM_QTY INT,
PD_ITEM_AMT DECIMAL(10,2),
PD_BILL_NO VARCHAR(50),
PD_CREATED_DT DATETIME DEFAULT GETDATE(),
PD_CREATED_BY VARCHAR(100),
PD_UPDATED_DT DATETIME,
PD_UPDATED_BY VARCHAR(100),
PD_STATUS_FLAG INT
)
希望这会对你有所帮助。
干杯
Hope this will help you.
Cheers
根据你的解释,假设你你的sql数据库中有两个表叫做Transaction
和TransactionItemWise
。事务表将任何事务存储为摘要,TransactionItemWise表以项目方式保存它们。这意味着Transaction和TransactionItemWise表之间存在1:M关系
。因此我们知道1
侧键转到M
侧。请参阅下面的示例
According to your explanation, suppose you have two tables in your sql database calledTransaction
andTransactionItemWise
. Transaction table stores any transaction as a summary and TransactionItemWise table keeps them itemwise. That means there is1:M relationship
between Transaction and TransactionItemWise tabels. So as we know1
side key goes toM
side. See the example below
CREATE TABLE Transaction(
TrxID varchar(3),
TotAmount float,
TotQty int,
TrxDate DateTime,
CONSTRAINT pk_Transaction PRIMARY KEY (TrxID)
)
CREATE TABLE TransactionItemWise(
TrxID varchar(3),
ItemNo varchar(3),
ItemAmount float,
ItemQty int,
CONSTRAINT pk_TransactionItemWise PRIMARY KEY (TrxID,ItemNo),
CONSTRAINT fk_PerOrders FOREIGN KEY (TrxID)
REFERENCES Transaction(TrxID)
)
请参阅以下结构。
您可以为客户提供多个订单(订单标题)
一个订单的多个订单行(不同的商品)
此外,您应该有产品表< br $> b $ b
SalesOrders [ ^ ]
Please see following structure.
You Can have multiple orders (Order Header)for the customer
Multiple Order Lines(different items) for One Order
Further you should have product table
SalesOrders[^]
这篇关于如何将多个销售订单插入单个销售的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文