|
|
|
|
use JinZhong_YangGuangFanNaoSi
|
|
|
|
|
use JinZhong_SiYiFengShang
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from imp_Member
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from imp_Member_card
|
|
|
|
|
|
|
|
|
|
select * from imp_member_course
|
|
|
|
|
|
|
|
|
|
select * from imp_member_course_item
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCardNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FGender INT
|
|
|
|
|
ALTER TABLE imp_member ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FBalance2 DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE imp_member ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE imp_member ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE imp_member ADD FArrear DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FPoint DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE imp_member ADD FBirthdayType CHAR
|
|
|
|
|
ALTER TABLE imp_member ADD FCustom1 VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FGender INT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FBalance2 DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member_card ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FArrear DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FPoint DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE imp_member_card ADD FBirthdayType CHAR
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCustom1 VARCHAR(100)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardTYpeName VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member_card
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpCardType
|
|
|
|
|
CREATE TABLE TImpCardType
|
|
|
|
|
(
|
|
|
|
|
FId BIGINT,
|
|
|
|
|
FNo VARCHAR(50),
|
|
|
|
|
FName VARCHAR(50),
|
|
|
|
|
FType VARCHAR(50),
|
|
|
|
|
FValueType INT
|
|
|
|
|
)
|
|
|
|
|
INSERT TImpCardType(FId,FNo,FName,FValueType)
|
|
|
|
|
SELECT dbo.FNNewId() AS FId,cardtypeno,cardname,1
|
|
|
|
|
FROM imp_member_card
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
GROUP BY cardtypeno,cardname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete TMemberCardType WHERE FId > 100
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FCardFeeAmt,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue,FPaySmsFee,FTimeCard,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FCreateTime,FAllowSale,FAllowRchg,FDeptId,FEnabled,FOrder)
|
|
|
|
|
SELECT FId =FId,FNo,FName,1,FMaterial = 2,0,FCardFeeAmt = 0,FAcctId = 3,FDeposit = 0,FAcctId2 = 0,FDeposit2 = 0 ,FAcctId3 = 0,FDeposit3 = 0,
|
|
|
|
|
FTimes = 0,FAlertBalance = 0,FMinRchgAmt = 0,FSalePointMode = 0,FSalePointValue = 0 ,FRchgPointMode = 0,FRchgPointValue = 0,FPaySmsFee = 0,FTimeCard = 0,FValidityPeriod = 100,FValidityPeriodUnit = 1,
|
|
|
|
|
FExpiredDate = NULL,FDefaultMemo = '',FCreateTime = GETDATE(),1,1,FDeptId = 0,FEnabled =1,FOrder = 1
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..TImpCardType
|
|
|
|
|
|
|
|
|
|
select * from imp_member_card
|
|
|
|
|
|
|
|
|
|
select *from imp_member_card where cardname = 'ɢ<EFBFBD>Ϳ<EFBFBD>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update imp_member_card SET FCardId = id WHERE FCardId IS NULL
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member_card SET FCardNo = cardno
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCreateDate = opentime
|
|
|
|
|
UPDATE imp_member_card SET FExpiredDate = DATEADD(YEAR,100,FCreateDate)
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FMemo = remark
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FMemId = memberId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM imp_member_card AS A,TImpCardType AS B
|
|
|
|
|
WHERE A.cardname = B.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ظ<EFBFBD>
|
|
|
|
|
SELECT FCardNo ,shopid
|
|
|
|
|
into #Card
|
|
|
|
|
FROM imp_member_card
|
|
|
|
|
GROUP BY FCardNo,shopid
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
drop table #Card
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FSeq INT IDENTITY
|
|
|
|
|
ALTER TABLE imp_member_card ADD FIndex INT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FIndex = 1+(SELECT COUNT(1) FROM imp_member_card AS B WHERE A.FCardNo = B.FCardNo and a.shopid = b.shopid AND (A.FCreateDate > B.FCreateDate OR (A.FCreateDate = B.FCreateDate AND (A.FSeq > B.FSeq) )))
|
|
|
|
|
FROM imp_member_card AS A
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCardNo = FCardNo + '.' + CAST(FIndex AS VARCHAR)
|
|
|
|
|
WHERE FCardNo + shopid IN( SELECT FCardNo + shopid FROM #Card)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
UPDATE JinZhong_YangGuangFanNaoSi..imp_member SET FCompId = 1 where shopid = 76628
|
|
|
|
|
UPDATE JinZhong_YangGuangFanNaoSi..imp_member SET FCompId = 1 where shopid = 76628
|
|
|
|
|
UPDATE JinZhong_YangGuangFanNaoSi..imp_member_card SET FCompId = 1 where shopid = 76628
|
|
|
|
|
UPDATE JinZhong_YangGuangFanNaoSi..imp_member_card SET FCompId = 1 where shopid = 76628
|
|
|
|
|
|
|
|
|
|
UPDATE JinZhong_YangGuangFanNaoSi..imp_member_course SET FCompId = 1 where buyshopid = 76628
|
|
|
|
|
UPDATE JinZhong_YangGuangFanNaoSi..imp_member_course SET FCompId = 1 where buyshopid = 76628
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member_card SET FBalance = cardfee
|
|
|
|
|
UPDATE imp_member_card SET FBalance2 = prefee
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNo = B.FCardNo
|
|
|
|
|
FROM imp_member AS A,imp_member_card AS B
|
|
|
|
|
WHERE A.Id = b.memberid
|
|
|
|
|
|
|
|
|
|
--shopId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member SET FMemNo= mobile WHERE ISNULL(FMemNo,'') =''
|
|
|
|
|
UPDATE imp_member SET FMemId= id WHERE FMemId Is null
|
|
|
|
|
UPDATE imp_member SET FName = name
|
|
|
|
|
UPDATE imp_member SET FMobile = mobile
|
|
|
|
|
UPDATE imp_member SET FGender = case when sex = '1' then 0 else 1 end
|
|
|
|
|
UPDATE imp_member SET FCreateDate = regtime
|
|
|
|
|
UPDATE imp_member SET FBirthday = null
|
|
|
|
|
UPDATE imp_member SET FBirthdayType = 'G'
|
|
|
|
|
UPDATE imp_member SET FMemo = ''
|
|
|
|
|
UPDATE imp_member SET FPoint = 0
|
|
|
|
|
|
|
|
|
|
select *from imp_member
|
|
|
|
|
|
|
|
|
|
delete TMember WHERE FMemId iN(SELECT FMemId FROM imp_member)
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMember(
|
|
|
|
|
FMemId,
|
|
|
|
|
FMemNo,
|
|
|
|
|
FName,
|
|
|
|
|
FBriefCode,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FCompId,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FGender,
|
|
|
|
|
FBirthdayType,
|
|
|
|
|
FBirthday,FTelephone,FMobilePhone,FQQ,FWeChat,FIdCard,FEmail,FAddress,FProId,FCPW,FQPW,
|
|
|
|
|
FChargeEmpId,FPoint,FRecvConsSMS,FRecvBulkSMS,FMemo,FCustom1,FCustom2,FCustom3,FCustom4,FCustom5)
|
|
|
|
|
SELECT FMemId AS FMemId,
|
|
|
|
|
FMemNo AS FMemNo,
|
|
|
|
|
FName AS FName,
|
|
|
|
|
dbo.FNGetFirstPinYin(FName),
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
ISNULL(FCreateDate ,'1900-01-01') AS FCreateDate,
|
|
|
|
|
FGender AS FGender,
|
|
|
|
|
FBirthdayType AS FBirthdayType,
|
|
|
|
|
FBirthday AS FBirthday,
|
|
|
|
|
'' AS FTelephone,
|
|
|
|
|
ISNULL(FMobile,'') AS FMobilePhone,
|
|
|
|
|
'' AS FQQ,
|
|
|
|
|
'' AS FWeChat,
|
|
|
|
|
'' AS FIdCard,
|
|
|
|
|
'' AS FEmail,
|
|
|
|
|
'' AS FAddress,
|
|
|
|
|
0 AS FProId,
|
|
|
|
|
'' AS FCPW,
|
|
|
|
|
'' AS FQPW,
|
|
|
|
|
0 AS FChargeEmpId,
|
|
|
|
|
ISNULL( FPoint,0) AS FPoint,
|
|
|
|
|
1 AS FRecvConsSMS,
|
|
|
|
|
1 AS FRecvBulkSMS,
|
|
|
|
|
ISNULL(FMemo,'') AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from JinZhong_YangGuangFanNaoSi..imp_member
|
|
|
|
|
WHERE shopid = 76628
|
|
|
|
|
OR FMemId IN(SELECT FMemId FROM JinZhong_YangGuangFanNaoSi..imp_member_card WHERE shopid = 76628)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
|
|
|
FCardId,
|
|
|
|
|
FCardNo,
|
|
|
|
|
FCardFaceNo,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId,
|
|
|
|
|
FMemId,
|
|
|
|
|
FState,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
FTotalTimes,
|
|
|
|
|
FUsedTimes,
|
|
|
|
|
FSaleCompId,
|
|
|
|
|
FSaleBillId,
|
|
|
|
|
FMemo)
|
|
|
|
|
SELECT
|
|
|
|
|
FCardId AS FId,
|
|
|
|
|
FCardNo AS FNo,
|
|
|
|
|
FCardNo AS FFaceNo,
|
|
|
|
|
FCardTypeId AS FTypeId,
|
|
|
|
|
(SELECT FValueType FROM TMemberCardType WHERE FId = FCardTypeId) AS FValueType,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
FMemId AS FMemId,
|
|
|
|
|
1 AS FState,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
|
|
ISNULL(FRemainTimes,0) AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
FCompId AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL(FMemo,'' ) AS FMemo
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_card
|
|
|
|
|
WHERE SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,NULL AS FExpiredDate,''
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_card AS A
|
|
|
|
|
WHERE SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
|
|
|
select dbo.FNNewId(),A.FMemId,A.FCardId,3,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_card AS A
|
|
|
|
|
WHERE SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,10,FBalance2,FBalance2,0,FCreateDate,NULL AS FExpiredDate,''
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_card AS A
|
|
|
|
|
WHERE FBalance2 > 0
|
|
|
|
|
AND SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
|
|
|
select dbo.FNNewId(),A.FMemId,A.FCardId,10,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance2,0,A.FBalance2,0,getdate(),'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_card AS A
|
|
|
|
|
WHERE FBalance2 > 0
|
|
|
|
|
AND SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FUsedTimes INT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FAdjustPrice DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_course_item ADD FMemo VARCHAR(1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop table TImpItem
|
|
|
|
|
|
|
|
|
|
select dbo.FNNewId() as FId,dbo.FNnewId() AS FCourseId,itemno AS FNo,name AS FName into TImpItem
|
|
|
|
|
from imp_member_course_item
|
|
|
|
|
group by itemno,name
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FCourseId,
|
|
|
|
|
A.FItemId = B.FId
|
|
|
|
|
FROM imp_member_course_item AS A,TImpItem AS B
|
|
|
|
|
WHERE A.name = b.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TItem(FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FStatTimes,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking)
|
|
|
|
|
SELECT FId,'HM'+FNo,FName,FName,FName,0,dbo.FNGetFirstPinYin(FName),'''',1,1,1,'''','''','''',1,0,0,0,0,0,0,0,1
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..TImpItem
|
|
|
|
|
ORDER BY FNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
|
|
|
|
|
SELECT FCourseId AS FId,
|
|
|
|
|
'HM' + A.FNo + '',
|
|
|
|
|
A.FName AS FName,
|
|
|
|
|
'' AS FBriefCode,
|
|
|
|
|
A.FId AS FItemId,
|
|
|
|
|
0 AS FPackId,
|
|
|
|
|
1 AS FSequence,
|
|
|
|
|
0,--(SELECT TOP 1 FId FROM TBasicType WHERE FKey = 'CourseType') AS FTypeId,
|
|
|
|
|
ISNULL(0,0) AS FTimes,
|
|
|
|
|
0 AS FFreeTimes,
|
|
|
|
|
0 AS FDurable,
|
|
|
|
|
1 AS FValidityPeriodUnit,
|
|
|
|
|
100 AS FValidityPeriod,
|
|
|
|
|
getdate() AS FCreateDate,
|
|
|
|
|
NULL AS FExpiredDate,
|
|
|
|
|
'' AS FDescription,
|
|
|
|
|
1 AS FEnabled,
|
|
|
|
|
0 AS FPrice,
|
|
|
|
|
0 AS FAmount,
|
|
|
|
|
1 AS FCalcMode
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..TImpItem AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TItemSub(FId,FCompId,FItemId,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,I.FId,I.FPrice,I.FVipPrice,I.FTime,I.FDctId,I.FPointMode,I.FPointValue,I.FDeptId,I.FAllowBooking,I.FEnabled
|
|
|
|
|
FROM TItem AS I,TCompany AS C
|
|
|
|
|
WHERE I.FId != 0
|
|
|
|
|
AND C.FId != 0
|
|
|
|
|
|
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TItemSub AS B WHERE B.FCompId = C.FId AND B.FItemId = I.FId)
|
|
|
|
|
AND I.FId IN(SELECT FId FROM JinZhong_YangGuangFanNaoSi..TImpItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from imp_member_course
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_course_item SET FCardId = ID WHERE FCardId IS NULL
|
|
|
|
|
UPDATE imp_member_course_item SET FMemId = memberId WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A. FCreateDate = B.FCreateDate
|
|
|
|
|
FROM imp_member_course_item AS A,imp_member_card AS B
|
|
|
|
|
WHERE A.cardid = b.id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_course_item SET FExpiredDate = validto where validto != ''
|
|
|
|
|
UPDATE imp_member_course_item SET FMemo = remark
|
|
|
|
|
UPDATE imp_member_course_item SET FPurTimes = num
|
|
|
|
|
UPDATE imp_member_course_item SET FUsedTimes = cast(num as float) - currnum
|
|
|
|
|
UPDATE imp_member_course_item SET FPurAmount = cast(num as float)*price
|
|
|
|
|
UPDATE imp_member_course_item SET FAdjustPrice = price
|
|
|
|
|
UPDATE imp_member_course_item SET FRemainTimes = currnum
|
|
|
|
|
|
|
|
|
|
select * from imp_member_course_item
|
|
|
|
|
|
|
|
|
|
update imp_member_course_item set FCardId = id ,FMemId = memberid
|
|
|
|
|
|
|
|
|
|
update imp_member_course_item SET FCompId = 1
|
|
|
|
|
|
|
|
|
|
delete TMemberCourse where fid in(select fcardid from JinZhong_YangGuangFanNaoSi..imp_member_course_item)
|
|
|
|
|
delete TMemberCourseLog where fcardid in(select fcardid from JinZhong_YangGuangFanNaoSi..imp_member_course_item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update a
|
|
|
|
|
set a.FAdjustPrice = b.FAdjustPrice
|
|
|
|
|
from JinZhong_YangGuangFanNaoSi..TMemberCourse as a,JinZhong_YangGuangFanNaoSi..imp_member_course_item as b
|
|
|
|
|
where a.fid = b.fcardid
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
|
|
SELECT FCardId,FMemId,FCardTypeId,0,FItemId,FCompId,FPurTimes,FUsedTimes,FPurAmount,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>',1,FAdjustPrice
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_course_item AS A
|
|
|
|
|
where SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,FCompId,FBillType,FBizType,FBillId,FBillNo,FBillDetailId,FRecordTime)
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,A.FCardId AS FCardId,0, ISNULL(FCardTypeId,0),getdate(),FPurTimes,0,FUsedTimes,0,FCompId,'DR','Import',0,'',0,getdate()
|
|
|
|
|
FROM JinZhong_YangGuangFanNaoSi..imp_member_course_item AS A
|
|
|
|
|
where SHOPID = 76628
|
|
|
|
|
|
|
|
|
|
select * from JinZhong_YangGuangFanNaoSi..imp_member_remark
|
|
|
|
|
where memberid = 911532
|
|
|
|
|
|
|
|
|
|
SELECT* FROM JinZhong_YangGuangFanNaoSi..imp_member_remark
|
|
|
|
|
WHERE memberid in(
|
|
|
|
|
|
|
|
|
|
select memberid from JinZhong_YangGuangFanNaoSi..imp_member_remark
|
|
|
|
|
group by memberid
|
|
|
|
|
having sum(1) > 1)
|
|
|
|
|
order by memberid
|
|
|
|
|
|
|
|
|
|
begin tran
|
|
|
|
|
|
|
|
|
|
declare list cursor for
|
|
|
|
|
select memberid,opttime,remark from JinZhong_YangGuangFanNaoSi..imp_member_remark
|
|
|
|
|
order by opttime desc
|
|
|
|
|
open list
|
|
|
|
|
declare @memid varchar(100)
|
|
|
|
|
declare @time varchar(100)
|
|
|
|
|
declare @remark varchar(1000)
|
|
|
|
|
|
|
|
|
|
fetch list into @memid,@time,@remark
|
|
|
|
|
while @@fetch_status = 0
|
|
|
|
|
begin
|
|
|
|
|
select @remark = '[' + @time + ']:' + @remark
|
|
|
|
|
print @remark
|
|
|
|
|
update TMember SET FMemo = Fmemo + (case when Fmemo != '' then char(10 ) + char(13) else '' end) + @remark
|
|
|
|
|
where fmemid = @memid
|
|
|
|
|
fetch list into @memid,@time,@remark
|
|
|
|
|
end
|
|
|
|
|
close list
|
|
|
|
|
deallocate list
|
|
|
|
|
|
|
|
|
|
rollback tran
|
|
|
|
|
|
|
|
|
|
select * from TMember WHERE FMemo != ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from JinZhong_YangGuangFanNaoSi..imp_member where mobile = '13203541777'
|
|
|
|
|
select * from JinZhong_YangGuangFanNaoSi..imp_member_card where memberid = '1049932'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from JinZhong_YangGuangFanNaoSi..imp_member_trans_hist
|
|
|
|
|
|
|
|
|
|
select fmemid from JinZhong_YangGuangFanNaoSi..imp_member where mobile = '15535415649'
|
|
|
|
|
select * from JinZhong_YangGuangFanNaoSi..imp_member_course_item where memberid = 911292
|
|
|
|
|
|
|
|
|
|
alter table imp_member_trans_hist_detail add FMemId
|
|
|
|
|
|
|
|
|
|
alter table imp_member_trans_hist add comp_id bigint
|
|
|
|
|
update imp_member_trans_hist set comp_id = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET
|
|
|
|
|
A.comp_id = B.FCompId
|
|
|
|
|
|
|
|
|
|
FROM imp_member_trans_hist AS A,imp_member_card AS B
|
|
|
|
|
WHERE A.memberid = B.memberid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT DBO.FNNewId(),A.memberid,a.paytime,0,A.comp_id,'DR','Import',A.billno,B.name,b.fee,1,b.fee,b.payment,b.employee,''
|
|
|
|
|
FROM imp_member_trans_hist AS A ,imp_member_trans_hist_detail as b
|
|
|
|
|
where a.id = b.billid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
order by createDate,mem_id,a.billno
|
|
|
|
|
|
|
|
|
|
drop table imp_member_trans_hist_detail
|
|
|
|
|
|
|
|
|
|
select * from imp_member_trans_hist_detail
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select count(1) from imp_member_trans_hist
|
|
|
|
|
where not exists (select billid from imp_member_trans_hist_detail where imp_member_trans_hist_detail.billid = imp_member_trans_hist.id)
|
|
|
|
|
|
|
|
|
|
alter table imp_member_trans_hist_detail alter column billid varchar(50)
|
|
|
|
|
alter table imp_member_trans_hist alter column id varchar(50)
|
|
|
|
|
|
|
|
|
|
create index ix_imp_member_trans_hist_detail_billid on imp_member_trans_hist_detail(billid)
|
|
|
|
|
create index ix_imp_member_trans_hist_billid on imp_member_trans_hist(id)
|