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/Import/飞跃历史.sql

52 lines
4.8 KiB

1 year ago
<EFBFBD><EFBFBD>
SELECT info_item.item_id , info_item.item_name , info_item.price , info_item.item_sort FROM info_item WHERE ( info_item.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
SELECT info_ware.ware_id , info_ware.ware_name , info_ware.consume_p , info_ware.ware_sort , info_ware.unit FROM info_ware WHERE ( info_ware.state = 1 )
go
SELECT emp_info.emp_id , emp_info.emp_name , emp_info.emp_sex , emp_info.item3 , emp_info.item4 FROM emp_info WHERE ( emp_info.state = 1 )
go
ALTER TABLE doc_m ADD FMemId BIGINT
UPDATE A
SET A.FMemId = B.FMemId
FROM doc_m AS A,mem_info AS B
WHERE A.mem_id = b.mem_id
UPDATE qingdao_fr.dbo.TMemberOldTransHist SET FTransNo = '<EFBFBD>N<EFBFBD>T' WHERE FTransNo != 'y<EFBFBD><EFBFBD>v' AND FTransNo != ''
INSERT qingdao_fr.dbo.TMemberOldTransHist(FId,FCompId,FMemId,FTime,FCardId,FBIllType,FBizType,FTransNo,FCOntent,FPrice,FQuantity,FAmount,FPayment,Femployee,FMemo)
SELECT qingdao_fr.dbo.FNNewId(), 1,doc_m.FMemId, doc_m.doc_date , 0,'DR' ,'Import' ,'<EFBFBD>N<EFBFBD>T',info_ware.ware_name,doc_ware.price, doc_ware.amount , doc_ware.money , '',emp_Info.emp_name,''
FROM doc_m
LEFT JOIN doc_ware ON doc_m.doc_id = doc_ware.doc_id
emp_info ,info_ware
where
AND emp_info.emp_id = doc_ware.emp_id
AND info_ware.ware_id = doc_ware.ware_id
AND doc_m.FMemId IS NOT NULL
DELETE qingdao_fr.dbo.TMemberOldTransHist WHERE FTransNo = 'y<EFBFBD><EFBFBD>v'
INSERT qingdao_fr.dbo.TMemberOldTransHist(FId,FCompId,FMemId,FTime,FCardId,FBIllType,FBizType,FTransNo,FCOntent,FPrice,FQuantity,FAmount,FPayment,Femployee,FMemo)
SELECT qingdao_fr.dbo.FNNewId(),1, doc_m.FMemId, doc_m.doc_date,0, 'DR','Import','y<EFBFBD><EFBFBD>v', info_item.item_name,doc_item.price, doc_item.amount , doc_item.money , '',ISNULL(emp_Info.emp_name,''),''
FROM doc_m
INNER JOIN doc_item ON doc_m.doc_id = doc_item.doc_id
INNER JOIN info_item ON info_item.item_id = doc_item.item_id
LEFT JOIN emp_info ON emp_info.emp_id = doc_item.emp_id
where doc_m.FMemId IS NOT NULL
SELECT * FROM doc_item
UPDATE qingdao_fr.dbo.TMemberOldTransHist SET FCompId = 1