用友u8查询销售订单的发货及退货执行报表.sql
时间: 2023-10-05 13:03:07 浏览: 485
使用友u8查询销售订单的发货及退货执行报表的SQL语句可以如下所示:
select
so.cSOCode as 销售订单号,
so.dDate as 订单日期,
so.cCusName as 客户名称,
so.cContactName as 联系人,
so.cCusAddress as 客户地址,
so.cSOAddress as 发货地址,
so.cMaker as 制单人,
so.cverifier as 审核人,
s.cName as 仓库,
d.cInvName as 存货名称,
sd.iQuantity as 数量,
sd.iNatMoney as 金额,
sd.dPreDate as 预计送货日期,
sd.dKeepDate as 发货日期,
sd.cSoCode as 关联销售订单号,
case
when sd.bReturnFlag = 1 then '是'
else '否'
end as 是否退货
from
SO_SOMain so
left join SO_SODetails sd on so.id = sd.id
left join SL_inventory i on sd.cInvCode = i.cInvCode
left join dbo.Bd_Stock s on sd.cWhCode = s.cWhCode
left join dbo.Bd_MeasureUnit unit on i.cComUnitCode = unit.cUnitID
where
so.ddate between '开始日期' and '结束日期'
and so.bReturnFlag = 0
以上SQL语句中,主要是通过连接SO_SOMain、SO_SODetails、SL_inventory和Bd_Stock表,获取所需的销售订单发货及退货相关信息。具体字段包括销售订单号、订单日期、客户名称、联系人、客户地址、发货地址、制单人、审核人、仓库、存货名称、数量、金额、预计送货日期、发货日期、关联销售订单号和是否退货等。在where条件中,可以设定订单日期的起止范围,以及筛选未退货的订单。
阅读全文