Dim dt() As String = {"现金银行帐","业主合同信息","业主账单","租户合同台账","租户账单","分类项目表","区域分" & _
"类项目表","定金违约","居间","配货台账","配货流转","外联装修维修","维修配件台账","报修工单","员工登记表","月度" & _
"汇总","员工欠款","员工工资","节假日","空置统计","库房台账","备用金账","租户押金","业主押金","业主生活物" & _
"品","piao据印制记录","水电燃有线","房间台账","房屋业绩","租户信息台账","系统数据设置","房源账单","业主定金","授" & _
"权表","易耗品出库"}
Dim t As DataTable
For i As Integer = 0 To dt.Length -1
t = DataTables(dt(i))
Select Case t.Name
Case "分类项目表","节假日","系统数据设置","授权表"
t.loadFilter = "" '一定要清除加载条件
t.load()
Case "现金银行帐"
If User.Group = "全部"
t.loadFilter = "" '一定要清除加载条件
t.loadTop = 20
t.loadPage =t.TotalPages - 1
t.load()
Else
t.loadFilter = "账套 = '" & User.Group & "' " '一定要清除加载条件
t.loadTop = 20
t.loadPage = t.TotalPages - 1
t.load()
End If
Case Else
If User.Group = "全部"
t.loadFilter = "" '一定要清除加载条件
t.load()
Else
t.loadFilter = "账套 = '" & User.Group & "' " '一定要清除加载条件
t.load()
End If
End Select
Next
If User.Group = "全部"
DataTables("租户合同台账").loadFilter = "" '一定要清除加载条件
DataTables("租户合同台账").load()
Else
DataTables("租户合同台账").loadFilter = "账套 = '" & User.Group & "' " '一定要清除加载条件
DataTables("租户合同台账").load()
End If
For Each t1 As Table In Tables
t1.Visible = True
t1.AllowEdit = True
For Each c As Col In t1.Cols
c.Visible = True
c.AllowEdit = True
Next
Next
Tables("授权表").Visible = (User.Roles = "管理员")
If User.Type = UserTypeEnum.User Then
' msgbox(User.Type & "=" & UserTypeEnum.User )
For Each dr As DataRow In DataTables("授权表").Select("角色名 like '" & User.Roles & "'" )
If dr.Isnull("表名") Then
If dr.IsNull("列名") Then
Else
For Each t2 As Table In Tables
If t2.Cols.Contains(dr("列名")) Then
t2.Cols(dr("列名")).Visible = Not dr("不可见")
t2.Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
End If
Next
End If
Else
If dr.IsNull("列名") Then
Tables(dr("表名")).Visible = Not dr("不可见")
Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
Else
Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
Tables(dr("表名")).Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
End If
End If
Next
End If
Tables("业主合同信息.房间台账").Visible = False
Tables("业主合同信息.业主押金").Visible = False
Tables("业主合同信息.业主账单").Visible = False
Tables("房间台账.定金违约").Visible = False
Tables("房间台账.水电燃有线").Visible = False
Tables("房间台账.租户账单").Visible = False
Tables("租户合同台账.租户押金").Visible = False
Tables("租户合同台账.水电燃有线").Visible = False
Tables("配货台账.配货流转").Visible = False
Tables("租户合同台账.房间台账").Visible = False
Tables("租户合同台账.租户账单").Visible = False
Tables("业主合同信息.业主生活物品").Visible = False
Tables("房间台账.配货台账").Visible = False
If user.Group <> "全部" Then
With Tables("房屋业绩")
Dim dr1 As DataRow
dr1 = DataTables("房屋业绩").Find("日期 = '" & Date.Today.AddDays(-1) & "'and 账套 = '" & user.Group & "'")
If dr1 Is Nothing Then '如果找到的话
For Each dr As DataRow In DataTables("业主合同信息").DataRows
'Dim dr As Row
'dr = Tables("业主合同信息").Current
If dr("合同状态") <> "已终止" And dr("合同状态") <> "已续租" Then
.AddNew()
.Current("日期") = Date.Today.AddDays(-1)
'output.show(1)
.Current("台账号") = dr("台账号")
'output.show(2)
.Current("区域") = dr("区域")
.Current("房间号") = dr("房间号")
.Current("共几间") = dr("共几间")
.Current("差价") = dr("差价")
.Current("空置间数") = dr("空置间数")
'output.show(3)
.Current("配货") = DataTables("配货流转").Compute("sum(单价)","现台账号 = '" & dr("台账号") & "' and 制单日期 = '" & Date.Today.AddDays(-1) & "'")
'output.show(4)
.Current("维修") = DataTables("报修工单").Compute("sum(维修件单价)","台账号 = '" & dr("台账号") & "' and 制单日期1 = '" & Date.Today.AddDays(-1) & "'")
'output.show(5)
.Current("装修") = DataTables("外联装修维修").Compute("sum(金额)","台账号 = '" & dr("台账号") & "' and 制单日期 = '" & Date.Today.AddDays(-1) & "'")
'output.show(6)
.Current("易耗品") = DataTables("易耗品出库").Compute("sum(配件金额)","台账号 = '" & dr("台账号") & "' and 制单日期 = '" & Date.Today.AddDays(-1) & "'")
'output.show(7)
.Current("水电燃") = DataTables("水电燃有线").Compute("sum(金额)","项目说明 = '公司支付' and 台账号 = '" & dr("台账号") & "' and 制单日期 = '" & Date.Today.AddDays(-1) & "'")
'output.show(8)
.Current("其他") = DataTables("现金银行帐").Compute("sum(支出)","业主合同号 = '" & dr("合同号") & "' and 制单日期 = '" & Date.Today.AddDays(-1) & "' and 类别 = '业主' and 明细科目 = '日常' and 摘要 <> '水费' and 摘要 <> '电费' and 摘要 <> '燃气费' ") + _
DataTables("现金银行帐").Compute("sum(支出)","业主合同号 = '" & dr("合同号") & "' and 制单日期 = '" & Date.Today.AddDays(-1) & "' and 类别 = '业主' and 明细科目 = '维修费' and 摘要 <> '业主承担垫付' ")
End If
Next
End If
End With
End If
全局表的beforeload里:
Dim t As DataTable
t = e.DataTable
Select Case t.Name
Case "分类项目表","节假日","系统数据设置","授权表"
t.loadFilter = "" '一定要清除加载条件
t.load()
Case "现金银行帐"
If User.Group = "全部"
t.loadFilter = "" '一定要清除加载条件
t.loadTop = 20
t.loadPage =t.TotalPages - 1
t.load()
Else
t.loadFilter = "账套 = '" & User.Group & "' " '一定要清除加载条件
t.loadTop = 20
t.loadPage = t.TotalPages - 1
t.load()
End If
Case Else
If User.Group = "全部"
t.loadFilter = "" '一定要清除加载条件
t.load()
Else
t.loadFilter = "账套 = '" & User.Group & "' " '一定要清除加载条件
t.load()
End If
End Select
If User.Type = UserTypeEnum.User Then
' msgbox(User.Type & "=" & UserTypeEnum.User )
For Each dr As DataRow In DataTables("授权表").Select("角色名 like '" & User.Roles & "'" )
If dr.Isnull("表名") Then
If dr.IsNull("列名") Then
Else
For Each t2 As Table In Tables
If t2.Cols.Contains(dr("列名")) Then
t2.Cols(dr("列名")).Visible = Not dr("不可见")
t2.Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
End If
Next
End If
Else
If dr.IsNull("列名") Then
Tables(dr("表名")).Visible = Not dr("不可见")
Tables(dr("表名")).AllowEdit = Not dr("不可编辑")
Else
Tables(dr("表名")).Cols(dr("列名")).Visible = Not dr("不可见")
Tables(dr("表名")).Cols(dr("列名")).AllowEdit = Not dr("不可编辑")
End If
End If
Next
End If
全局表的startedit里
Dim r As Row = e.Table.Current
If r.DataRow.RowState = DataRowState.Added Then '新增行正常编辑
Return
End If
If QQClient.Ready = False Then '如果QQClient没有启动,则禁止编辑
PopMessage("必须启动QQClient,才能编辑此表数据!","提示",PopIconEnum.Infomation,5)
e.Cancel = True
Return
End If
Dim key As String = e.Table.DataTable.Name & ":" & r("_Identify")
If tbrk.Contains(key) Then '如果本人之前已经编辑此行,则正常编辑
Return
Else '如果本人之前没有编辑此行
Dim msg = QQClient.SendWait("?#" & Key & "#?",5) '向服务器发送请求编辑信息
If msg = "OK" Then '如果服务器返回OK
tbrk.Add(key) '在本地登记正在编辑此行
ElseIf msg > "" Then '否则显示服务器返回的信息,并取消编辑
PopMessage("无法编辑此行,因为:" & vbcrlf & msg ,"提示",PopIconEnum.Infomation,5)
e.Cancel = True
Else '如果服务器没有返回信息,则取消编辑
PopMessage("因服务器无响应,无法编辑此行!" ,"提示",PopIconEnum.Infomation,5)
e.Cancel = True
End If
End If