日期:2014-05-17 浏览次数:20518 次
新:
SELECT dbo.tGoods.TypeCode, dbo.tGoods.GoodsBrand, dbo.tGoods.GoodsType, dbo.tGoods.ifDisCount, dbo.tGoods.Supply, dbo.tGoods.Remark, dbo.tBill.BillID,
dbo.tBill.CustName, dbo.tBill.BillCode, dbo.tBill.AddDate, dbo.tBill.AddTime, dbo.tBill.MRemark, dbo.tBill.FUser, dbo.tBill.Maker, dbo.tBill.MakerDate, dbo.tBill.Editer,
dbo.tBill.EditDate, dbo.tBill.BillType, dbo.tBill.InOrOut, dbo.tBill.VipCode, dbo.tBill.PayType, dbo.tBill.SkMoney, dbo.tBill.ZLMoney, dbo.tBill.YSMoney,
dbo.tBill.DepotName, dbo.tBill.Field1, dbo.tBill.Field2, dbo.tBill.Field3, dbo.tBill.Field4, dbo.tBill.Field5, DATEPART(hh, dbo.tBill.AddTime) AS HJtime,
CAST(YEAR(dbo.tBill.AddDate) AS varchar(4)) + '-' + CAST(MONTH(dbo.tBill.AddDate) AS varchar(4)) AS HjMonth, DATEPART(yyyy, dbo.tBill.AddDate) AS HjYear,
DATEPART(ww, dbo.tBill.AddDate) AS WeekDate, '全部' AS AllBill, dbo.tBillDetail.BillDetailID, CAST(DATEPART(yyyy, dbo.tBill.AddDate) AS varchar(4))
+ '年' + CAST(DATEPART(q, dbo.tBill.AddDate) AS varchar(4)) + '季度' AS HjSeason, dbo.tVip.VipName, dbo.tBillDetail.BarCode, dbo.tBillDetail.DBillCode,
dbo.tBillDetail.GoodsStyle, dbo.tBillDetail.GoodsName, dbo.tBillDetail.Units, dbo.tBillDetail.SizeGroup, dbo.tBillDetail.ColorCode, dbo.tBillDetail.ColorName,
dbo.tBillDetail.ColorValue, dbo.tBillDetail.DetailField1, dbo.tBillDetail.DetailField2, dbo.tBillDetail.DetailField3, dbo.tBillDetail.DetailField4, dbo.tBillDetail.DetailField5,
dbo.tBillDetail.SizeCode, dbo.tBillDetail.SizeName, dbo.tBillDetail.Number AS Number1, dbo.tBillDetail.Money AS Money1, dbo.tBillDetail.InMoney AS InMoney1,
(CASE WHEN tBill.BillType IN ('销售出货', '销售退货') THEN tBillDetail.Number * tBillDetail.Sign * - 1 ELSE tBillDetail.Number * tBillDetail.Sign END) AS Number,
dbo.tBillDetail.Discount, dbo.tBillDetail.Price, (CASE WHEN tBill.BillType IN ('销售出货', '销售退货')
THEN tBillDetail.Money * tBillDetail.Sign * - 1 ELSE tBillDetail.Money * tBillDetail.Sign END) AS Money, dbo.tBillDetail.colPosition, dbo.tBillDetail.rowPosition,
dbo.tBillDetail.DRemark, dbo.tBillDetail.Sign, dbo.tBillDetail.InPrice, (CASE WHEN tBill.BillType IN ('销售出货', '销售退货')
THEN tBillDetail.InPrice * tBillDetail.Number * tBillDetail.Sign * - 1 ELSE tBillDetail.InPrice * tBillDetail.Number * tBillDetail.Sign END) AS InMoney,
dbo.tGoods.dpPrice, dbo.tGoods.xsPrice, dbo.tGoods.GoodsSeason, dbo.tGoods.DepotUp, dbo.tGoods.DepotDown
FROM dbo.tBill LEFT OUTER JOIN