📄 -
字号:
End If
End If
End If
Select Case SumCondIndex
Case 0
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "仓库编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "仓库名称"
Case 1
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "存货编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "存货名称"
Case 2
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "部门编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "部门名称"
Case 3
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "入库类别编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "入库类别名称"
Case 4
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "仓库编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "仓库名称"
CxbbGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = "仓库编码"
CxbbGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = "仓库名称"
Case 5
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "存货编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "存货名称"
CxbbGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = "存货编码"
CxbbGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = "存货名称"
Case 6
CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "部门编码"
CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "部门名称"
CxbbGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = "部门编码"
CxbbGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = "部门名称"
End Select
End Sub
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "ymsz" '页面设置
Dyymctbl.Show 1
Case "yl" '预 览
Call bbyl(True)
Case "dy" '打 印
Call bbyl(False)
Case "cx" '查 询
Tjfx_InBillSumCond.Show 1
Case "sx" '刷 新
Call Sub_Query(1)
Case "bz" '帮 助
Call F1bz
Case "fh" '退 出
Unload Me
End Select
End Sub
Private Sub Timer1_Timer() '在窗体激活后调入查询程序
Timer1.Enabled = False
Xt_Wait.Show
Xt_Wait.Refresh
'加快显示速度
CxbbGrid.Redraw = False
'生成查询结果
Call Sub_GridHead(Tjfx_InBillSumCond.Com_SumCond.ListIndex)
Call Sub_Query(0)
CxbbGrid.Redraw = True
Xt_Wait.Hide
End Sub
Private Sub Sub_Query(Int_QueryType As Integer) '生成查询结果(Define)
'过程参数:Int_QueryType 0-"点确定按钮"查询 1-"刷新"查询
Dim Rec_Query As Recordset '查询结果动态集
Dim Coljsq As Long '网格列计数器
Dim Jsqte As Long '临时动态计数器
Dim Str As String
Dim SqlStr As String
Dim Sqlstrfz As String
'以下为自定义部分[
If Int_QueryType = 0 Then '0-"点确定按钮"查询
With Tjfx_InBillSumCond
'生成查询条件
Str_QueryCondi = " where inoutflag=1 and " & .WhCode & " and kjyear= " & Xtyear
For Jsqte = 0 To 11
Select Case Jsqte
Case 0 '月份(起始)
Str_QueryCondi = Str_QueryCondi & " And a.period>= '" & .Com_QsMon.ItemData(.Com_QsMon.ListIndex) & "'"
Case 1 '月份(终止)
Str_QueryCondi = Str_QueryCondi & " And a.period<= '" & .Com_JzMon.ItemData(.Com_JzMon.ListIndex) & "'"
Case 2 '存货分类(Like)
If Trim(.LrText(0).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.invsortcode like '" & Trim(.LrText(0).Tag) & "%'"
End If
Case 3 '查询存货范围(起始)
If Trim(.LrText(1).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.mnumber>='" & Trim(.LrText(1).Text) & "'"
End If
Case 4 '查询存货范围(终止)
If Trim(.LrText(2).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.mnumber<= '" & Trim(.LrText(2).Text) & "'"
End If
Case 5 '收发类别)
If Trim(.LrText(3).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " and a.inoutclasscode = '" & Trim(.LrText(3).Tag) & "'"
End If
Case 6 '供应商
If Trim(.LrText(4).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " and a.suppliercode = '" & Trim(.LrText(4).Tag) & "'"
End If
Case 7 '部门
If Trim(.LrText(5).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " and a.deptcode = '" & Trim(.LrText(5).Tag) & "'"
End If
Case 8 '查询单据日期范围(起始)
If Trim(.LrText(6).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.BillDate>='" & Trim(.LrText(6).Text) & "'"
End If
Case 9 '查询单据日期范围(终止)
If Trim(.LrText(7).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.BillDate<= '" & Trim(.LrText(7).Text) & "'"
End If
Case 10 '查询记帐日期范围(起始)
If Trim(.LrText(8).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.ChalkDate>='" & Trim(.LrText(8).Text) & "'"
End If
Case 11 '查询记帐日期范围(终止)
If Trim(.LrText(9).Text) <> "" Then
Str_QueryCondi = Str_QueryCondi & " And a.ChalkDate<= '" & Trim(.LrText(9).Text) & "'"
End If
End Select
Next Jsqte
If .Opt_Check(2).Value Then
Str_QueryCondi = Str_QueryCondi & " And a.ChalkitupMan= ''"
End If
End With
Else
If Str_QueryCondi = "" Then
Str_QueryCondi = " where 1=2"
End If
End If
Sqlstrfz = ""
CxbbGrid.Rows = CxbbGrid.FixedRows
With Tjfx_InBillSumCond
Select Case .Com_SumCond.ListIndex
Case 0 '按仓库汇总
If .Opt_Check(1).Value Then
SqlStr = "SELECT Whcode, Whname,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.startflag=0 Group by a.Whcode, a.Whname " & _
" ORDER BY a.Whcode "
Else
SqlStr = "SELECT Whcode, Whname,Sum(FactReceiptQuan) as Quan,Sum(EMoney) as Money " & _
" From Chhs_v_InOut a " & Str_QueryCondi & _
" Group by a.Whcode, a.Whname " & _
" ORDER BY a.Whcode "
Sqlstrfz = "SELECT Whcode, Whname,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.Billcode in ('1301','1302','1303','1304','1305') " & _
" and a.startflag=0 Group by a.Whcode, a.Whname " & _
" ORDER BY a.Whcode "
End If
Case 1 '按存货汇总
If .Opt_Check(1).Value Then
SqlStr = "SELECT Mnumber, Mname,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.startflag=0 Group by a.Mnumber, a.Mname " & _
" ORDER BY a.Mnumber "
Else
SqlStr = "SELECT Mnumber, Mname,Sum(FactReceiptQuan) as Quan,Sum(EMoney) as Money " & _
" From Chhs_v_InOut a " & Str_QueryCondi & _
" Group by a.Mnumber, a.Mname " & _
" ORDER BY a.Mname "
Sqlstrfz = "SELECT Mnumber, Mname,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.Billcode in ('1301','1302','1303','1304','1305') " & _
" and a.startflag=0 Group by a.Mnumber, a.Mname " & _
" ORDER BY a.Mnumber "
End If
Case 2 '按部门汇总
If .Opt_Check(1).Value Then
SqlStr = "SELECT DeptCode, DeptName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.startflag=0 Group by a.DeptCode, a.DeptName " & _
" ORDER BY a.DeptCode "
Else
SqlStr = "SELECT DeptCode, DeptName,Sum(FactReceiptQuan) as Quan,Sum(EMoney) as Money " & _
" From Chhs_v_InOut a " & Str_QueryCondi & _
" Group by a.DeptCode, a.DeptName " & _
" ORDER BY a.DeptCode "
Sqlstrfz = "SELECT DeptCode, DeptName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.Billcode in ('1301','1302','1303','1304','1305') " & _
" and a.startflag=0 Group by a.DeptCode, a.DeptName " & _
" ORDER BY a.DeptCode "
End If
Case 3 '按入库类别汇总
If .Opt_Check(1).Value Then
SqlStr = "SELECT InOutClassCode,InOutClassName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.startflag=0 Group by a.InOutClassCode,a.InOutClassName " & _
" ORDER BY a.InOutClassCode"
Else
SqlStr = "SELECT InOutClassCode,InOutClassName,Sum(FactReceiptQuan) as Quan,Sum(EMoney) as Money " & _
" From Chhs_v_InOut a " & Str_QueryCondi & _
" Group by a.InOutClassCode,a.InOutClassName " & _
" ORDER BY a.InOutClassCode "
Sqlstrfz = "SELECT InOutClassCode, InOutClassName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.Billcode in ('1301','1302','1303','1304','1305') " & _
" and a.startflag=0 Group by a.InOutClassCode, a.InOutClassName " & _
" ORDER BY a.InOutClassCode "
End If
Case 4 '按仓库+入库类别汇总
If .Opt_Check(1).Value Then
SqlStr = "SELECT Whcode, Whname,InOutClassName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.startflag=0 " & _
" Group by a.Whcode, a.Whname,a.InOutClassName " & _
" ORDER BY a.Whcode "
Else
SqlStr = "SELECT Whcode, Whname,InOutClassName,Sum(FactReceiptQuan) as Quan,Sum(EMoney) as Money " & _
" From Chhs_v_InOut a " & Str_QueryCondi & _
" Group by a.Whcode, a.Whname,a.InOutClassName " & _
" ORDER BY a.Whcode "
Sqlstrfz = "SELECT Whcode, Whname, InOutClassName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.Billcode in ('1301','1302','1303','1304','1305') " & _
" and a.startflag=0 Group by a.Whcode,a.Whname, a.InOutClassName " & _
" ORDER BY a.Whcode "
End If
Case 5 '按存货+入库类别汇总
If .Opt_Check(1).Value Then
SqlStr = "SELECT Mnumber, Mname,InOutClassName,Sum(InQuan) as Quan,Sum(InMoney) as Money " & _
" From Chhs_v_List a " & Str_QueryCondi & _
" and a.startflag=0 " & _
" Group by a.Mnumber, a.Mname,a.InOutClassName " & _
" ORDER BY a.Mnumber "
Else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -