|
|
|
|
use DeZhou_Venus
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember where <EFBFBD><EFBFBD><EFBFBD><EFBFBD> is not null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sp_rename 'TImpMember.<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע'
|
|
|
|
|
sp_rename 'TImpMember.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
alter table TImpMember add <EFBFBD>˻<EFBFBD>Ƿ<EFBFBD><EFBFBD> int
|
|
|
|
|
alter table TImpMember add <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ע int
|
|
|
|
|
alter table TImpMember add FBirthdayType AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
update TImpMember set <EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '001'
|
|
|
|
|
update TImpMember set <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = null where <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ''
|
|
|
|
|
|
|
|
|
|
alter table TImpMember drop column <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = 0
|
|
|
|
|
UPDATE TImpMember SET <EFBFBD>˻<EFBFBD>Ƿ<EFBFBD><EFBFBD> = 0
|
|
|
|
|
UPDATE TImpMember SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע = '' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע IS NULL
|
|
|
|
|
UPDATE TImpMember SET <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ע = '' WHERE <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ע IS NULL
|
|
|
|
|
UPDATE TImpMember SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע = '' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע ='.'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(), ch_member_typeno,vch_member_typename as 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 dezhou_venus_old..mr_m_member_type
|
|
|
|
|
|
|
|
|
|
EXEC PImportMemberData_Init
|
|
|
|
|
EXEC PImportMemberData_Exec
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberPointHist
|
|
|
|
|
|
|
|
|
|
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_1 AS A
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardAcctHist WHERE FCardId
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '9000-1-1' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NULL
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FPoint = 0 WHERE FMemId IN(SELECT FMemId FROM TImpMember)
|
|
|
|
|
|
|
|
|
|
sp_rename 'TImpMember','TImpMember_1'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use dezhou_venus_old
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT mr_m_member.vch_memberno , mr_m_member.vch_membername , mr_m_member.ch_member_typeno , mr_m_member.dt_birthday , mr_m_member.vch_linktel , mr_m_member.vch_address , mr_m_member.dt_limit , mr_m_member.ch_state , mr_m_member.vch_operID , mr_m_member.dt_operdate , "flag" = '', mr_m_member.num_limit , mr_m_member.vch_ID , mr_m_member.vch_memo , mr_m_member.ch_hqflag , mr_m_member.vch_handset FROM mr_m_member WHERE ( mr_m_member.ch_hqflag = 'N' )
|
|
|
|
|
|
|
|
|
|
SELECT mr_m_member.vch_memberno <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
mr_m_member.vch_membername <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
mr_m_member.ch_member_typeno <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,
|
|
|
|
|
mr_m_member.dt_birthday <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
ISNULL(mr_m_member.vch_linktel,'') vch_linktel ,
|
|
|
|
|
ISNULL(mr_m_member.vch_handset,'') <EFBFBD>ֻ<EFBFBD> ,
|
|
|
|
|
mr_m_member.vch_address ,
|
|
|
|
|
mr_m_member.dt_limit <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
mr_m_member.ch_state as ״̬,
|
|
|
|
|
mr_m_member.vch_operID ,
|
|
|
|
|
mr_m_member.dt_operdate <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
mr_m_member.num_limit AS num_limit,
|
|
|
|
|
mr_m_member.vch_ID ,
|
|
|
|
|
isnull( mr_m_member.vch_memo ,'') AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע,
|
|
|
|
|
mr_m_member.ch_hqflag ,
|
|
|
|
|
ISNULL(mr_m_member.vch_sex,'Ů') <EFBFBD>Ա<EFBFBD>,
|
|
|
|
|
mr_m_member.vch_nation ,
|
|
|
|
|
|
|
|
|
|
mr_m_member.vch_profession ,
|
|
|
|
|
mr_m_member.vch_vehicle , mr_m_member.vch_email , mr_m_member.vch_commend
|
|
|
|
|
INTO TImpMember
|
|
|
|
|
FROM dezhou_venus_old..mr_m_member
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND vch_memberno NOT IN(SELECT FMemNO from TMember)
|
|
|
|
|
AND mr_m_member.ch_hqflag = 'N'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alter table TImpMember add <EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
alter table TImpMember add <EFBFBD>˻<EFBFBD>Ƿ<EFBFBD><EFBFBD> int
|
|
|
|
|
alter table TImpMember add ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> int
|
|
|
|
|
alter table TImpMember add <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ע varchar
|
|
|
|
|
alter table TImpMember add <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> varchar default 'G'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alter table TImpMember add <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> decimal(18,6) not null default 0,<EFBFBD><EFBFBD><EFBFBD><EFBFBD> decimal(18,6) not null default 0
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ISNULL(I.FAmount,0) - ISNULL(O.FAmount,0)
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(Select vch_memberno,IsNull ( Sum ( num_amount ) , 0 ) AS FAmount from dezhou_venus_old..mr_m_pay where ch_paymodeno ='02' and ch_hqflag ='N' GROUP BY vch_memberno) AS O
|
|
|
|
|
ON O.vch_memberno = A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
(Select vch_memberno, IsNull ( sum ( num_deposit ) , 0 )as FAmount from dezhou_venus_old..mr_m_deposit where ch_hqflag ='N' GROUP BY vch_memberno ) AS I
|
|
|
|
|
ON I.vch_memberno = A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember where <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '20031'
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardAcctHist WHERE FBillType = 'DR' AND FCardId IN(SELECT FCardId FROM TImpMember_1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT B.vch_memberno, num_amount
|
|
|
|
|
FROM dezhou_venus_old..mr_m_pay AS B
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
and ch_paymodeno ='02' and ch_hqflag ='N' AND vch_memberno = '20031'
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FBalance
|
|
|
|
|
FROM TImpMember AS A,
|
|
|
|
|
(
|
|
|
|
|
SELECT B.vch_memberno,SUM(num_marking) AS FBalance
|
|
|
|
|
FROM dezhou_venus_old..mr_m_marking AS B
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
and ch_hqflag ='N' GROUP BY vch_memberno )
|
|
|
|
|
AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.vch_memberno
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo = '20031'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WHERE ( mr_m_member.vch_memberno = '110005' ) and ( mr_m_member.ch_hqflag = 'N' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM dezhou_venus_old..mr_m_member WHERE ch_state != 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Select IsNull ( Sum ( num_amount ) , 0 ) from dezhou_venus_old..mr_m_pay where vch_memberno ='20031' and ch_paymodeno ='02' and ch_hqflag ='N'
|
|
|
|
|
Select IsNull ( sum ( num_deposit ) , 0 ) from dezhou_venus_old..mr_m_deposit where vch_memberno ='20031' and ch_hqflag ='N'
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
260.00 - 186.00
|
|
|
|
|
|
|
|
|
|
Select IsNull ( max ( int_id ) , 0 ) from mr_m_deposit where vch_memberno ='20002'
|
|
|
|
|
|
|
|
|
|
Select IsNull ( sum ( num_marking ) , 0 ) from dezhou_venus_old..mr_m_marking where vch_memberno ='20031' and ch_hqflag ='N'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM mr_m_pay WHERE ch_hqflag != 'N'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Select IsNull ( Sum ( num_amount ) , 0 ) from mr_m_deposit_arrearage where vch_memberno ='20002'
|
|
|
|
|
|
|
|
|
|
Select IsNull ( Sum ( num_amount ) , 0 ) from mr_m_pay where vch_memberno ='20002' and ch_paymodeno ='02'
|
|
|
|
|
|
|
|
|
|
Select vch_member_typename , ch_attribute from mr_m_member_type where ch_member_typeno ='A1'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM mr_m_member_type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM mr_m_member WHERE ch_member_typeno = 'A2'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
SELECT FCardId,FAcctId,FBalance
|
|
|
|
|
FROM TMemberCardAccount
|
|
|
|
|
) AS T1,
|
|
|
|
|
(
|
|
|
|
|
SELECT FCardId,FAcctId, SUM(FInAmount) - SUM(FOutAmount) AS FBalance
|
|
|
|
|
FROM TMemberCardAcctHist
|
|
|
|
|
GROUP BY FCardId,FAcctId
|
|
|
|
|
) AS T2
|
|
|
|
|
WHERE T1.FCardId = T2.FCardId
|
|
|
|
|
AND T1.FAcctId = T2.FAcctId
|
|
|
|
|
AND T2.FBalance != T1.FBalance
|
|
|
|
|
|
|
|
|
|
AND T1.FCardId IN(SELECT FCardId FROM TImpMember)
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FBalance = B.FBalance
|
|
|
|
|
FROM TMemberCardAccount AS A,
|
|
|
|
|
(
|
|
|
|
|
SELECT FCardId,FAcctId, SUM(FInAmount) - SUM(FOutAmount) AS FBalance
|
|
|
|
|
FROM TMemberCardAcctHist
|
|
|
|
|
GROUP BY FCardId,FAcctId
|
|
|
|
|
) AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND A.FAcctId = B.FAcctId
|
|
|
|
|
AND A.FCardId IN(SELECT FCardId FROM TImpMember)
|