|
|
|
|
use qingdao_moka
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from Worksheet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use qingdao_yiyijiu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exec sp_rename 'TImpMemberCourse','TImpMemberCourse_011'
|
|
|
|
|
exec sp_rename 'TImpMember','TImpMember_011'
|
|
|
|
|
exec sp_rename 'TImpChongFen','TImpChongFen_011'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop table TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpMemberCourse
|
|
|
|
|
(
|
|
|
|
|
FMemId BIGINT,
|
|
|
|
|
FName NVARCHAR(100),
|
|
|
|
|
FMobile VARCHAR(20),
|
|
|
|
|
FCourseName NVARCHAR(30),
|
|
|
|
|
FItemName NVARCHAR(30),
|
|
|
|
|
FAmount DECIMAL(18,6),
|
|
|
|
|
FAdjustPrice DECIMAL(18,6),
|
|
|
|
|
FTimes DECIMAL(18,6),
|
|
|
|
|
FExpiredDate DATETIME,
|
|
|
|
|
FCompId BIGINT,
|
|
|
|
|
FCompName VARCHAR(1000)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
select * from TImpChongFen
|
|
|
|
|
|
|
|
|
|
select * from syscolumns where id = object_id('TImpChongFen')
|
|
|
|
|
|
|
|
|
|
sp_rename 'TImpChongFen.ʧЧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
sp_rename 'Worksheet','TImpChongFen'
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpChongFen ADD <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD> DATETIME DEFAULT '2023-06-01'
|
|
|
|
|
UPDATE TImpChongFen SET <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD> = '2023-06-01'
|
|
|
|
|
|
|
|
|
|
INSERT TImpMemberCourse(FName,FMobile,FCourseName,FItemName,FAmount,FAdjustPrice,FTimes,FExpiredDate,FCompName)
|
|
|
|
|
SELECT case when <EFBFBD><EFBFBD>Ա<EFBFBD>dz<EFBFBD> is null then <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> else <EFBFBD><EFBFBD>Ա<EFBFBD>dz<EFBFBD> end ,CAST(<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> AS BIGINT),<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,cast(ʵ<EFBFBD><EFBFBD> as float)*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ʵ<EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>,<EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
FROM TImpChongFen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TImpMemberCourse(FName,FMobile,FCourseName,FAmount,FAdjustPrice,FTimes,FExpiredDate,FCompName)
|
|
|
|
|
SELECT <EFBFBD><EFBFBD>Ա<EFBFBD>dz<EFBFBD>,CAST(<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> AS BIGINT),<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ʵ<EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>,<EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
FROM TImpChongFen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
select * from TImpChongFen
|
|
|
|
|
|
|
|
|
|
select * from TCompany
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FAdjustPrice = FAmount / FTimes WHERE FAdjustPrice IS NULL AND FAMount IS NOT NULL
|
|
|
|
|
UPDATE TImpMemberCourse SET FAmount = FAdjustPrice * FTimes WHERE FAdjustPrice IS not NULL AND FAMount IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = dbo.FNCompId('001') WHERE FCompName = 'Ħ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = dbo.FNCompId('002') WHERE FCompName = 'Ħ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͱ¸۹<EFBFBD><EFBFBD>ʵ<EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = dbo.FNCompId('004') WHERE FCompName = 'G HAIR'
|
|
|
|
|
|
|
|
|
|
select FCompName from TImpMemberCourse
|
|
|
|
|
group by FCompName
|
|
|
|
|
select * from TCompany
|
|
|
|
|
|
|
|
|
|
drop table TImpMember
|
|
|
|
|
|
|
|
|
|
SELECT MAX(FName) AS FName,FMobile,MIN(FCompId) AS FCompId INTO TImpMember
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
GROUP BY FMobile
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FNew BIT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemNo VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FGender INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthdayType VARCHAR(10)
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthday DATETIME
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FNew = 0
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = null
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpMember AS A,TMember AS B
|
|
|
|
|
WHERE A.FMobile = B.FMobilePHone
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FNew = 1,FMemId = dbo.FNNewId() WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = FMobile WHERE FNew = 1
|
|
|
|
|
UPDATE TImpMember SET FBirthdayType = 'G'
|
|
|
|
|
UPDATE TImpMember SET FGender = 0
|
|
|
|
|
UPDATE TImpMember SET FCreateDate = GETDATE()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FRemainTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FUsedPurTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPurTimes DECIMAL(18,6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpMemberCourse AS A,TImpMember AS B
|
|
|
|
|
WHERE A.FMobile = B.FMobile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpItem
|
|
|
|
|
(
|
|
|
|
|
FItemId BIGINT PRIMARY KEY,
|
|
|
|
|
FItemNo VARCHAR(100),
|
|
|
|
|
FItemName VARCHAR(100),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
drop table TImpCourse
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpCourse
|
|
|
|
|
(
|
|
|
|
|
FItemId BIGINT,
|
|
|
|
|
FCourseId BIGINT PRIMARY KEY,
|
|
|
|
|
FCourseNo VARCHAR(100),
|
|
|
|
|
FCourseName VARCHAR(100),
|
|
|
|
|
FItemName VARCHAR(100),
|
|
|
|
|
FItemNo VARCHAR(100),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
INSERT TImpCourse(FItemId,FCourseId,FItemNo,FItemName)
|
|
|
|
|
SELECT dbo.FNNewId(),dbo.FNNewId(),''+FItemName,FItemName
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
where FcourseName NOT IN(SELECT FItemName FROM TImpCourse)
|
|
|
|
|
GROUP BY FItemName ,FItemName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from TImpChongFen WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '519Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۾<EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 FItemId,FItemNo,FItemNo, FItemName, FItemName,0,dbo.FNGetFirstPinYin(FItemName),'',1,1,1,'','','',1,0,0,0,0,0,0,0,1
|
|
|
|
|
FROM TImpCourse
|
|
|
|
|
WHERE FItemId NOT IN(SELECT FId FROM TItem)
|
|
|
|
|
|
|
|
|
|
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 FItemId FROM TImpCourse)
|
|
|
|
|
--AND I.FId NOT IN(SELECT FItemId FROM TCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
I.FItemNo + '',
|
|
|
|
|
I.FItemName ,
|
|
|
|
|
'' AS FBriefCode,
|
|
|
|
|
I.FItemId AS FItemId,
|
|
|
|
|
0 AS FPackId,
|
|
|
|
|
1 AS FSequence,
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
1 AS FTimes,
|
|
|
|
|
0 AS FFreeTimes,
|
|
|
|
|
0 AS FDurable,
|
|
|
|
|
0 AS FValidityPeriodUnit,
|
|
|
|
|
0 AS FValidityPeriod,
|
|
|
|
|
getdate() AS FCreateDate,
|
|
|
|
|
NULL AS FExpiredDate,
|
|
|
|
|
'' AS FDescription,
|
|
|
|
|
1 AS FEnabled,
|
|
|
|
|
0 AS FPrice,
|
|
|
|
|
0 AS FAmount,
|
|
|
|
|
1 AS FCalcMode
|
|
|
|
|
FROM TImpCourse AS I
|
|
|
|
|
WHERE I.FItemId NOT IN(SELECT FItemId FROM TCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FItemId,
|
|
|
|
|
A.FCourseId = B.FId
|
|
|
|
|
FROM TImpMemberCourse AS A,TCourse AS B,TItem AS C
|
|
|
|
|
WHERE A.FItemName = C.FName
|
|
|
|
|
AND C.FId = B.FItemId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FItemId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FId = dbo.FNNewId()
|
|
|
|
|
UPDATE TImpMemberCourse SET FPurTimes = FTimes
|
|
|
|
|
UPDATE TImpMemberCourse SET FRemainTimes = FTimes
|
|
|
|
|
--UPDATE TImpMemberCourse SET FExpiredDate = '2021-07-10 00:00:00.000';
|
|
|
|
|
UPDATE TImpMemberCourse SET FCreateDate = getdate()
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = dbo.FNCompId('002')
|
|
|
|
|
UPDATE TImpMemberCourse SET FPurAmount = FAmount
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpChongFen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FName = FMobile WHERE FName IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNO = FMobile WHERE FMemNo IS NULL AND FNew = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FNew = 1 AND FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = FMemNo + '.2' WHERE FNew = 1 AND FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
|
|
|
|
|
SELECT FMobilePhone FROM TMember WHERE FMemNo = '15652618748'
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
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
|
|
|
|
|
WHERE FNew = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FUsedPurTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
|
|
SELECT FId,FMemId,FCourseId,0,FItemId,FCompId,FPurTimes,ISNULL(FPurAmount,0),0,FPurTimes - FRemainTimes,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'',1,ISNULL(FAdjustPrice,0)
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,
|
|
|
|
|
FCompId,
|
|
|
|
|
FBillType,FBizType,FBillId,FBillNo,FBillDetailId)
|
|
|
|
|
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FId,0,FCourseId,FTime = getdate(),FPurTimes,FPurTimes - FRemainTimes,0,0,
|
|
|
|
|
FCompId,
|
|
|
|
|
'DR','Import',0,'',0
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMEMBERCOURSE WHERE FItemName in ('<EFBFBD><EFBFBD>ϯ-<EFBFBD>߶<EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD><EFBFBD>ϯ-Ʒ<EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD><EFBFBD>ϯ-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ')
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardId BIGINT
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FBalance DECIMAL(18,6)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FBalance = 80 WHERE FItemName in ('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ-<EFBFBD>߶<EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ-Ʒ<EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ')
|
|
|
|
|
UPDATE TImpMemberCourse SET FBalance = 100 WHERE FItemName in ('<EFBFBD><EFBFBD>ϯ-<EFBFBD>߶<EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD><EFBFBD>ϯ-Ʒ<EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD><EFBFBD>ϯ-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ')
|
|
|
|
|
UPDATE TImpMemberCourse SET FBalance = 200 WHERE FItemName in ( '<EFBFBD>ܼ<EFBFBD>-Ʒ<EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ','<EFBFBD>ܼ<EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>Ⱦ')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
|
|
|
FCardId,
|
|
|
|
|
FCardNo,
|
|
|
|
|
FCardFaceNo,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId,
|
|
|
|
|
FMemId,
|
|
|
|
|
FState,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
FTotalTimes,
|
|
|
|
|
FUsedTimes,
|
|
|
|
|
FSaleCompId,
|
|
|
|
|
FSaleBillId,
|
|
|
|
|
FMemo)
|
|
|
|
|
SELECT
|
|
|
|
|
FCardID AS FId,
|
|
|
|
|
FCardID AS FNo,
|
|
|
|
|
FCardID AS FFaceNo,
|
|
|
|
|
6 AS FTypeId,
|
|
|
|
|
1 AS FValueType,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
FMemId AS FMemId,
|
|
|
|
|
1 AS FState,
|
|
|
|
|
getdate() AS FCreateDate,
|
|
|
|
|
dateadd(year,100,FCreateDate) AS FExpiredDate,
|
|
|
|
|
0 AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
0 AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL('','') AS FMemo
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
WHERE FBalance > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete TMemberCard WHERE FCardId IN(SELECT FCardID from TImpMemberCourse)
|
|
|
|
|
delete TMemberCardAccount WHERE FCardId IN(SELECT FCardID from TImpMemberCourse)
|
|
|
|
|
delete TMemberCardAcctHist WHERE FCardId IN(SELECT FCardID from TImpMemberCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FId,FMemId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FCardId AS FCardId,3,FBalance,FBalance,0,getdate(),NULL,''
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
WHERE FBalance > 0
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
|
|
|
select dbo.FNNewId(), FMemId, FCardId, 3,getdate(),6, FCompId,'DR','Import',0,'',FBalance,0,FBalance,0,getdate(),''
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
WHERE FBalance > 0
|