select convert(varchar(20),po.[PurchasedOn],111) as PurchasedOn,cu.[CustomerCode],po.CustomerOrderNo,po.[OutTradeSN],
convert(varchar(20),co.[CreatedOn],111) as CreatedOn,shop.[ShopName],cate.[CategoryName],poi.PurchaseQuantity,(poi.PurchaseQuantity*poi.PurchasePrice) as PaymentForGoods,po.[Cn2CnFreightAmount], ((poi.PurchaseQuantity*poi.PurchasePrice)+po.[Cn2CnFreightAmount]) as TotalMoney,po.OutPaySN,po.[PurchaseByName],ca.[CompanyAlias],eo.[ExpressNo] from [Erp].[trade].[PurchaseOrders] po inner join [trade].[CustomerOrders] co on po.[CustomerOrderNo] = co.[OrderNo] inner join [CRM].[Customers] cu on cu.[CustomerId]=co.[CustomerId] inner join [trade].[PurchaseItems] poi on poi.[PurchaseOrderId]=po.PurchaseOrderId inner join [goods].[Shops] shop on shop.[ShopId] = po.[ShopId] inner join [goods].[Goods] good on good.[GoodsId] = poi.[GoodId] inner join [goods].[Categories] cate on cate.[CategoryId] = good.[CategoryId] inner join [trade].[ExpressOrders2PurchaseItems] eopi on eopi.[PurchaseItemId] = poi.[PurchaseItemId] inner join [trade].[ExpressOrders] eo on eo.[ExpressOrderId] = eopi.[ExpressOrderId] inner join [basic].[CompanyAlias] ca on ca.CompanyId = eo.ExpressCompanyId where month(po.[PurchasedOn])=month(getdate()) and year(po.[PurchasedOn])=year(getdate()) order by po.[PurchasedOn] asc
- 3 回答
- 0 关注
- 610 浏览
添加回答
举报
0/150
提交
取消