You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
sql-tools/生成开卡单的交易历史.sql

47 lines
1.2 KiB

SELECT * FROM TMemberSaleBill WHERE FBillNo = '0011510160001'
UPDATE A
SET A.FMemID = B.FMemId
FROM TMemberSaleBill AS A,TMember AS B
WHERE A.FMemNo = B.FMemNo
AND FBillNo = '0011510160001'
DECLARE @BillId BIGINT
SELECT @Billid = (SELECT FBillId FROM TMemberSaleBill WHERE FBillNo = '0011510160001')
DECLARE @CompId BIGINT
DECLARE @MemId BIGINT
DECLARE @MemNo VARCHAR(30)
DECLARE @CardId BIGINT
DECLARE @BillMemo VARCHAR(1000)
DECLARE @BillTime DATETIME
DECLARE @BillNo VARCHAR(30)
DECLARE @BillType VARCHAR(230)
DECLARE @BizType VARCHAR(30)
SELECT @BillType = 'KK'
SELECT @CompId = FCompId,
@MemId = FMemId,
@BillMemo = FBillMemo,
@BillTime = FBillTime,
@BillNo = FBillNo,
@BizType = FBizType,
@MemNo = FMemNo
FROM TMemberSaleBill
WHERE FBillId= @Billid
SELECT * INTO #Payment FROM TMemberSalePayment WHERE FBIllID = @BillId
EXEC PAuditMemberSaleTransHist
@BillId = @Billid, --单据ID
@CompId = @CompId, --公司ID
@BillNo = @BillNo, --单号
@BillTime = @BillTime, --单据时间
@BillType =@BillType, --单据类别
@BizType =@BizType, --单据子类
@MemId = @MemId, --会员id
@MemNo = @MemNo, --会员编号
@BillMemo =@BillMemo --备注
DROP TABLE #Payment