2018-08-07

select * from ReturnMoneyForCertainDoc where CustomerID='FLNQPYY54G'

select * from ReturnMoneyForCertainDocDetails where ReturnInfoID=12937

select * from CustomerConsumptionInfo;

select * from MemberCardHandle where MemberCardNum='18062802'

select * from CustomerConsumptionInfo where CustomerID='FLNQPYY54G'

select * from CustomerConsumptionDetails

select * from AccountsOfCustomer where CustomerID='FLNQPYY54G'

select * from PrepaymentDetails where CustomerID='FLNQPYY54G'

select * from CertainDocDetailsTotalRecord where ID=13558

--更新退款表数据,从退款A改为退款B

--update ReturnMoneyForCertainDoc set Amount=17640 where id=12937
--update ReturnMoneyForCertainDocDetails set Amount=17640 where ReturnInfoID=12937
--update AccountsOfCustomer set Balance=Balance-2360 where CustomerID='FLNQPYY54G'
--update CertainDocDetailsTotalRecord set PayTotalPR=-17640,PayPrepaymentAmount=-17640 where ID=13558
--update FinanceTotal set AllTotal=-17640,PrePaymentAmount=-17640 where ID=203143
--update FinanceTotalDetails set Amount=-17640 where FinanceTotalID=203143

select * from FinanceTotal where CustomerID='FLNQPYY54G'

select * from FinanceTotalDetails where FinanceTotalID=203143

select * from AccountsOfCustomer where CustomerID='FLNQPYY54G'

select * from ItemStatisticsTypeRelate

select * from CustomerConsumptionDetails

--查找最近一年开单过的项目以及收入所属部门

select distinct(a.ItemID),c.Name,d.sJR from CustomerConsumptionDetails a inner join CustomerConsumptionInfo b on a.ExcutionNumber=b.ExcutionNumber
inner join ItemInfo c on c.ID=a.ItemID
inner join ItemInfoID e on e.Now=c.ID
inner join YUN_HIS20180806.dbo.H_Project_Data d on d.KID=e.Original
where b.Date>'2018-01-01 10:28:00.000' and c.Valid=1 and a.ItemID not in (select ItemID from ItemStatisticsTypeRelate) order by a.ItemID

select * from CustomerConsumptionInfo where Date>'2018-01-01 10:28:00.000'

select * from StatisticsType
select * from ItemStatisticsTypeRelate

select * from YUN_HIS20180806.dbo.H_Project_Data

select * from ItemInfoID

2360
23640