-- 作者:baoxyang
-- 发布时间:2012/12/3 17:44:00
--
Dim ss As String If Vars("分公司") = "上海总公司" Then ss = "select a.托运单号,a.商场编号,a.客户简称,a.目的城市,a.条码单号,a.配送点,a.取消日期,a.预约配送日,a.预约状态,a.紧急否,a.海报否,d.预约内容,a.货物件数 as 件数,dbo.ClearZero(a.计价重量) as 计价重量,dbo.ClearZero(a.计价体积) as 计价体积,dbo.ClearZero(a.总费用) as 总费用 " ss = ss & "from 托运单据 As a left join (Select c.* from (Select max(ID) As id,托运单号 from 托运预约 group by 托运单号) b left join 托运预约 c on b.id = c.id and b.托运单号 = c.托运单号) As d on a.托运单号 =d.托运单号 WHERE NOT EXISTS (SELECT * FROM {条码单据} WHERE {条码单据}.条码单号 = a.条码单号) " ss = ss & " And a.单据状态 = \'开单入库\' and a.销单否 = \'否\' and a.标记 = 0" Else ss = "select a.托运单号,a.商场编号,a.客户简称,a.目的城市,a.条码单号,a.配送点,a.取消日期,a.预约配送日,a.预约状态,a.紧急否,a.海报否,d.预约内容,a.货物件数 as 件数,dbo.ClearZero(a.计价重量) as 计价重量,dbo.ClearZero(a.计价体积) as 计价体积,dbo.ClearZero(a.总费用) as 总费用 " ss = ss & "from 托运单据 As a left join (Select c.* from (Select max(ID) As id,托运单号 from 托运预约 group by 托运单号) b left join 托运预约 c on b.id = c.id and b.托运单号 = c.托运单号) As d on a.托运单号 =d.托运单号 WHERE NOT EXISTS (SELECT * FROM {条码单据} WHERE {条码单据}.条码单号 = a.条码单号) " ss = ss & " And a.单据状态 = \'开单入库\' and a.销单否 = \'否\' and a.标记 = 0 and a.分公司 = \'" & Vars("分公司") & "\'" End If Tables("S托运明细选择_Table1").Fill(ss,"baox",True) If Functions.Execute("显示设置",1) = False Then Dim tg1 As String = "托运单号,90|客户简称,100|配送点,130|线路名,50|取消日期,70|预约配送日,70|预约状态,50|预约内容,120|件数,40|计价重量,60|计价体积,60|总费用,60|紧急否,35|海报否,35" Functions.Execute("显示列",Tables("S托运明细选择_Table1"),tg1) End If Tables("S托运明细选择_Table1").AutoSizeRows()
在表中是可以显示数据的,关键是无法选中复选框.
[此贴子已经被作者于2012-12-3 17:45:05编辑过]
|
-- 作者:baoxyang
-- 发布时间:2012/12/3 17:47:00
--
If Vars("分公司") = "上海总公司" Then If st <> "" Then ss = "Select a.托运单号,a.商场编号,a.客户简称,a.目的城市,a.条码单号,a.配送点,a.取消日期,a.预约配送日,a.预约状态,a.紧急否,a.海报否,d.预约内容,a.货物件数 as 件数,dbo.ClearZero(a.计价重量) as 计价重量,dbo.ClearZero(a.计价体积) as 计价体积,dbo.ClearZero(a.总费用) as 总费用 " ss = ss & "from 托运单据 As a left join (Select c.* from (Select max(ID) As id,托运单号 from 托运预约 group by 托运单号) b left join 托运预约 c on b.id = c.id and b.托运单号 = c.托运单号) As d on a.托运单号 =d.托运单号,条码单据 as p where a.条码单号 = p.条码单号 and p.状态 <> \'初始\' and a.单据状态 = \'开单入库\' and a.销单否 = \'否\' and a.单据性质 = \'正常单\' and a.标记 = 0 and a.目的城市 = \'"& st &"\' and a.预约状态 = \'未预约\'" Else ss = "select a.托运单号,a.商场编号,a.客户简称,a.目的城市,a.条码单号,a.配送点,a.取消日期,a.预约配送日,a.预约状态,a.紧急否,a.海报否,d.预约内容,a.货物件数 as 件数,dbo.ClearZero(a.计价重量) as 计价重量,dbo.ClearZero(a.计价体积) as 计价体积,dbo.ClearZero(a.总费用) as 总费用 " ss = ss & "from 托运单据 As a left join (Select c.* from (Select max(ID) As id,托运单号 from 托运预约 group by 托运单号) b left join 托运预约 c on b.id = c.id and b.托运单号 = c.托运单号) As d on a.托运单号 =d.托运单号,条码单据 as p where a.条码单号 = p.条码单号 and p.状态 <> \'初始\' and a.单据状态 = \'开单入库\' and a.销单否 = \'否\' and a.单据性质 = \'正常单\' and a.标记 = 0 and a.预约状态 = \'未预约\'" End If Else If st <> "" Then ss = "Select a.托运单号,a.商场编号,a.客户简称,a.目的城市,a.条码单号,a.配送点,a.取消日期,a.预约配送日,a.预约状态,a.紧急否,a.海报否,d.预约内容,a.货物件数 as 件数,dbo.ClearZero(a.计价重量) as 计价重量,dbo.ClearZero(a.计价体积) as 计价体积,dbo.ClearZero(a.总费用) as 总费用 " ss = ss & "from 托运单据 As a left join (Select c.* from (Select max(ID) As id,托运单号 from 托运预约 group by 托运单号) b left join 托运预约 c on b.id = c.id and b.托运单号 = c.托运单号) As d on a.托运单号 =d.托运单号,条码单据 as p where a.条码单号 = p.条码单号 and p.状态 <> \'初始\' and a.单据状态 = \'开单入库\' and a.销单否 = \'否\' and a.单据性质 = \'正常单\' and a.标记 = 0 and a.目的城市 = \'"& st &"\' and a.预约状态 = \'未预约\' and a.分公司 = \'" & Vars("分公司") & "\'" Else ss = "select a.托运单号,a.商场编号,a.客户简称,a.目的城市,a.条码单号,a.配送点,a.取消日期,a.预约配送日,a.预约状态,a.紧急否,a.海报否,d.预约内容,a.货物件数 as 件数,dbo.ClearZero(a.计价重量) as 计价重量,dbo.ClearZero(a.计价体积) as 计价体积,dbo.ClearZero(a.总费用) as 总费用 " ss = ss & "from 托运单据 As a left join (Select c.* from (Select max(ID) As id,托运单号 from 托运预约 group by 托运单号) b left join 托运预约 c on b.id = c.id and b.托运单号 = c.托运单号) As d on a.托运单号 =d.托运单号,条码单据 as p where a.条码单号 = p.条码单号 and p.状态 <> \'初始\' and a.单据状态 = \'开单入库\' and a.销单否 = \'否\' and a.单据性质 = \'正常单\' and a.标记 = 0 and a.预约状态 = \'未预约\' and a.分公司 = \'" & Vars("分公司") & "\'" End If End If Tables("S托运明细选择_Table1").Fill(ss,"baox",True)
以后代码执行显示的数据是可以选中复选框的.我分析唯一不同是没有NOT EXISTS 语句出现哦.
|