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/生成欠款员工.txt

29 lines
1.1 KiB

1 year ago
DELETE TMemberArrearEmployee
INSERT TMemberArrearEmployee(FId,FMemId,FArrearId,FWorkType,FEmpId,FShareRate)
SELECT dbo.FNGetNewId(),A.FMemId,A.FId,B.FWorkType,B.FEmpId,B.FShareRate
FROM TMemberArrear AS A,TConsumeGoodsEmployee AS B
WHERE A.FBizType = 'Goods'
AND A.FTransId = B.FBillId
INSERT TMemberArrearEmployee(FId,FMemId,FArrearId,FWorkType,FEmpId,FShareRate)
SELECT dbo.FNGetNewId(),A.FMemId,A.FId,B.FWorkType,B.FEmpId,1
FROM TMemberArrear AS A,TConsumeItemEmployee AS B
WHERE A.FBizType = 'Item'
AND A.FTransId = B.FBillId
INSERT TMemberArrearEmployee(FId,FMemId,FArrearId,FWorkType,FEmpId,FShareRate)
SELECT dbo.FNGetNewId(),A.FMemId,A.FId,B.FWorkType,B.FEmpId,B.FShareRate
FROM TMemberArrear AS A,TMemberSaleEmployee AS B
WHERE A.FBillType = 'KK'
AND A.FTransId = B.FBillId
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
INSERT TMemberSaleEmployee( FId , FBillId ,FDetailId, FWorkType , FDeptId,FEmpId ,FShareRate, FPerf ,FComm)
SELECT dbo.FNGetNewId(), A.FBillId,A.FId,B.FWorkType,0,B.FEmpId,B.FShareRate,0,0
FROM TMemberSaleRepay AS A,TMemberArrearEmployee AS B
WHERE A.FArrearId = B.FArrearId