If Forms("明细录入").Opened() Then
Dim lab7 As WinForm.Label = e.Form.Controls("Label7")
Dim st As String = "" .PadLeft(1)
If user.IsRole("结算") = False Then
If e.DataRow("已结算") = True Then
e.DataRow("已结算") = False
MessageBox.Show("你无结算权限","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel = True
End If
Else
Dim chek As WinForm.CheckBox = Forms("明细录入").Controls("CheckBox1")
If chek.Checked = False '用于批量结算时跳过重复执行下面的消息提示
Dim Result As DialogResult
If e.DataRow("已结算")=True Then
Result = MessageBox.Show("请确认是否已结算,确认后将锁定此记录不能再修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
e.DataRow.Locked = True
e.DataRow("已结算") = True
e.DataTable.Save
Else
e.Cancel = True
e.DataRow.Locked = False
e.DataRow("已结算") = False
End If
End If
Dim drs As List(Of DataRow)
drs = DataTables("支出总表").Select("[已结算] = 'false' ")
If drs.Count -1 >= 0 Then
chek.Enabled =True
chek.Checked = False
End If
End If
Dim drss As List(Of DataRow)
drss = DataTables("支出总表").Select("")
If drss.Count -1 < 0 Then
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录"
Else
If DataTables("支出总表").Compute("sum(未结算金额)") = Nothing Then
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录" & st & st & "合计金额 :" & st & DataTables("支出总表").Compute("sum(金额)") & "元" & st & ",其中已结算:" & st & DataTables("支出总表").Compute("sum(已结算金额)") & "元" & st & ",未结算:" & st & "0" & st & "元"
Else
If DataTables("支出总表").Compute("sum(已结算金额)") = Nothing Then
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录" & st & st & "合计金额 :" & st & DataTables("支出总表").Compute("sum(金额)") & "元" & st & ",其中已结算:" & st & "0" & "元" & st & ",未结算:" & st & DataTables("支出总表").Compute("sum(未结算金额)") & "元"
Else
lab7.Text = "共有" & st & DataTables("支出总表").DataRows.Count & st & "条记录" & st & st & "合计金额 :" & st & DataTables("支出总表").Compute("sum(金额)") & "元" & st & ",其中已结算:" & st & DataTables("支出总表").Compute("sum(已结算金额)") & "元" & st & ",未结算:" & st & DataTables("支出总表").Compute("sum(未结算金额)") & "元"
End If
End If
End If
End If
End If