|
|
|
|
|
|
|
|
|
EXEC SP_RENAME 'CustInfo','TImpMember'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM CTYPEINFO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FGender INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMember ADD FArrear DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FPoint DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthdayType VARCHAR(2)
|
|
|
|
|
ALTER TABLE TImpMember ADD FTOTALTIMES INT
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 =dbo.FNNewId(), CCODE,NAME,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 CTypeInfo
|
|
|
|
|
WHERE CCode IN(
|
|
|
|
|
SELECT CType FROM TImpMember
|
|
|
|
|
GROUP BY CTYPE)
|
|
|
|
|
AND BNO = 'A01'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM CTypeInfo
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled
|
|
|
|
|
FROM TMemberCardType AS I,TCompany AS C
|
|
|
|
|
WHERE I.FId > 1
|
|
|
|
|
AND C.FId != 0
|
|
|
|
|
-- AND C.FNo = '009'
|
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCompId = dbo.FNCompId('001')
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FName = Name
|
|
|
|
|
UPDATE TImpMember SET FMemNo = CustNo
|
|
|
|
|
UPDATE TImpMember SET FMobile = CPhone
|
|
|
|
|
UPDATE TImpMember SET FGender = SEX - 1
|
|
|
|
|
UPDATE TImpMember SET FGender = 0 WHERE SEX IS NULL
|
|
|
|
|
UPDATE TImpMember SET FCreateDate = LEFT(BDATE,2) + '-' + SUBSTRING(BDATE,5,2) + '-' + RIGHT(BDATE,2)
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate = LEFT(EDATE,2) + '-' + SUBSTRING(EDATE,5,2) + '-' + RIGHT(EDATE,2)
|
|
|
|
|
UPDATE TImpMember SET FBalance = Amt
|
|
|
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemId IS NULL
|
|
|
|
|
UPDATE TImpMember SET FBirthdayType = 'G'
|
|
|
|
|
UPDATE TImpMember SET FRemainTimes = 0
|
|
|
|
|
UPDATE TImpMember SET FMemo = ACCrem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthday = LEFT(BIRTHDAY,4) + '-' + SUBSTRING(BIRTHDAY,5,2) + '-' + SUBSTRING(BIRTHDAY,7,2)
|
|
|
|
|
WHERE LEN(BIRTHDAY) = 8
|
|
|
|
|
|
|
|
|
|
SELECT CAST(LEFT(BIRTHDAY,4) + '-' + SUBSTRING(BIRTHDAY,5,2) + '-' + SUBSTRING(BIRTHDAY,7,2) AS DATETIME)
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
WHERE LEN(BIRTHDAY) = 8
|
|
|
|
|
ORDER BY BIRTHDAY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM TIMpMember AS A,TMemberCardType AS B,CTypeInfo AS C
|
|
|
|
|
WHERE A.CType = C.CCode
|
|
|
|
|
AND B.FName = C.Name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardType WHERE FId > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCourseImportEx
|
|
|
|
|
WHERE FCourseNo NOT IN (SELECT FNo FROM TCourse)
|
|
|
|
|
order by FCardNo
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TMemberCourseImportEx ADD FMemId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
ALTER TABLE TMemberCourseImportEx ADD FCourseId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
ALTER TABLE TMemberCourseImportEx ADD FId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
ALTER TABLE TMemberCourseImportEx ADD FItemId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCourseImportEx SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
update A SET A.FMemId = B.FId
|
|
|
|
|
FROM TMemberCourseImportEx AS A,TMember AS B
|
|
|
|
|
WHERE A.FCardNo = B.FNo
|
|
|
|
|
|
|
|
|
|
update A SET A.FItemId = B.FItemId,
|
|
|
|
|
A.FCourseId = B.FId
|
|
|
|
|
FROM TMemberCourseImportEx AS A,TCourse AS B
|
|
|
|
|
WHERE A.FCourseNo = B.FNo
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCourseImportEx WHERE FRemainTimes IS NULL
|
|
|
|
|
sp_rename 'TMemberCourseImportEx$','TMemberCourseImportEx'
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
|
|
SELECT FId,FMemId,FCourseId,0,FItemId,1,ISNULL(FRemainTimes,0),CASE WHEN ISNULL(FRemainTimes,0) = 0 THEN 0 ELSE FRemainAmount END,0,0,getdate(),null,'DR.Import',0,0,0,'Excel<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',1,0
|
|
|
|
|
FROM TMemberCourseImportEx
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCourseImportEx SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseHist(FId,FMemId,FMemCourseId,FPackId,FCourseId,FTime,FPurTimes,FFreeTimes,FUsePurTimes,FUseFreeTimes,
|
|
|
|
|
FPurAmount,FFreeAmount,FUsePurAmount,FUseFreeAmount,FCompId,
|
|
|
|
|
FBillType,FBizType,FTransId,FTransNo,FTransDetailId)
|
|
|
|
|
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FId,0,FCourseId,FTime = getdate(),ISNULL(FRemainTimes,0),FFreeTimes = 0,0,0,
|
|
|
|
|
FPurAmount = CASE WHEN ISNULL(FRemainTimes,0) = 0 THEN 0 ELSE FRemainAmount END,0,0,0,1,
|
|
|
|
|
'DR','Import',0,'',0
|
|
|
|
|
|
|
|
|
|
FROM TMemberCourseImportEx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardAcctHist
|
|
|
|
|
DELETE TMemberCardAccount
|
|
|
|
|
DELETE TMemberCard
|
|
|
|
|
DELETE TMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) AS Code,
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
FCreateDate 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,
|
|
|
|
|
0 AS FPoint,
|
|
|
|
|
1 AS FRecvConsSMS,
|
|
|
|
|
1 AS FRecvBulkSMS,
|
|
|
|
|
'' AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
|
|
|
|
|
from TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
|
|
|
FCardId,
|
|
|
|
|
FCardNo,
|
|
|
|
|
FCardFaceNo,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId,
|
|
|
|
|
FMemId,
|
|
|
|
|
FState,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
FTotalTimes,
|
|
|
|
|
FUsedTimes,
|
|
|
|
|
FSaleCompId,
|
|
|
|
|
FSaleBillId,
|
|
|
|
|
FMemo)
|
|
|
|
|
SELECT
|
|
|
|
|
FCardId AS FId,
|
|
|
|
|
FMemNo AS FNo,
|
|
|
|
|
FMemNo 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,
|
|
|
|
|
FRemainTimes AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
FCompId AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL(FMemo,'') AS FMemo
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 TImpMember
|
|
|
|
|
|
|
|
|
|
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 TImpMember AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sp_rename 'TImpMember','TImpMember_1'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FCompId = dbo.FNCOmpId('001')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),A.FId,xfrq,A.FId,A.FCompId,'DR','Import','','',cast(dzhje as decimal(18,6)),1,cast(dzhje as decimal(18,6)),'','',''
|
|
|
|
|
FROM xfxx,TMemberCard AS A
|
|
|
|
|
WHERE A.FNo = hykh
|
|
|
|
|
|
|
|
|
|
select * from xfxx2
|
|
|
|
|
update xfxx2 set hykh = 'A' + hykh
|
|
|
|
|
|
|
|
|
|
Truncate table TMemberOldTransHist
|
|
|
|
|
|
|
|
|
|
select * from xfxx
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberOld
|
|
|
|
|
|
|
|
|
|
select dateadd(yy,100,getdate())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = dateadd(yy,100,FCreateDate)
|
|
|
|
|
|
|
|
|
|
insert gcm12
|
|
|
|
|
(gcn00c,gcn01c,gcn02c,gcn09f,gcn10i,gcn12d,gcn13d,gcn15c,gcn17c,gcn22i,gcn24i,gcn04c,gcn06i,gcn03c,gcn16f)
|
|
|
|
|
select
|
|
|
|
|
'003',hykh,'0',knje,'0',jrrq,'22000101',hykh,'003','1','1',yddh,xb,hyxm,hyjf
|
|
|
|
|
from gcm12_01
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
|
|
UPDATE TMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
|
|
UPDATE TMemberCardAcctHist SET FCompId = (SELECT FId FROM TCompany WHERE FNo= '003')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberSaleDetailPayment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FId,FNo INTO #Member FROM TMember WHERE FNo LIKE 'A%'
|
|
|
|
|
AND FCompId = 4734511574699135191
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Member
|
|
|
|
|
|
|
|
|
|
UPDATE #Member SET FNo = REPLACE(REPLACE(REPLACE(REPLACE( REPLACE( REPLACE(Replace(FNo,'<EFBFBD><EFBFBD>',''),'<EFBFBD><EFBFBD>',''),'?',''),';',''),' ',''),'<EFBFBD><EFBFBD>',''),'','')
|
|
|
|
|
|
|
|
|
|
UPDATE #Member SET FNo = REPLACE(FNo,'A','') WHERE FNo LIKE 'A%'
|
|
|
|
|
|
|
|
|
|
UPDATE #Member SET FNo = 'A' + FNo
|
|
|
|
|
WHERE FNo IN (SELECT FNo FROM TMember WHERE FCompId != 4734511574699135191)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Member WHERE FNo like 'A%'
|
|
|
|
|
|
|
|
|
|
UPDATE B
|
|
|
|
|
SET B.FNo = 'A' + B.FNo
|
|
|
|
|
FROM #Member AS B,
|
|
|
|
|
(
|
|
|
|
|
SELECT FNo, COUNT(1) as cnt,max(FId) as FId FROM #Member
|
|
|
|
|
GROUP BY FNo
|
|
|
|
|
) AS A
|
|
|
|
|
WHERE cnt > 1
|
|
|
|
|
AND B.FId = A.FId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FNo = B.FNo
|
|
|
|
|
FROM TMember AS A,#Member AS B
|
|
|
|
|
WHERE A.FId = B.FId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FNo like 'A%'
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FNo = B.FNo,
|
|
|
|
|
A.FFaceNo = B.FNo
|
|
|
|
|
FROM TMemberCard AS A,TMember AS B
|
|
|
|
|
WHERE A.FId = B.FId
|
|
|
|
|
AND B.FCompId = 4734511574699135191
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FNo like '%801127%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FValidityPeriod = 1,FAllowRecharge = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FBriefCode = dbo.FNGetFirstPinYin(FName)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = DATEADD(yy,1,FCreateDate)
|