欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

frmz.vb

需要在.net环境下运行需要安装框架
VB
第 1 页 / 共 2 页
字号:
        '
        'btnZ
        '
        Me.btnZ.Location = New System.Drawing.Point(288, 8)
        Me.btnZ.Name = "btnZ"
        Me.btnZ.Size = New System.Drawing.Size(88, 24)
        Me.btnZ.TabIndex = 2
        Me.btnZ.Text = "转让"
        '
        'btnF
        '
        Me.btnF.Location = New System.Drawing.Point(416, 8)
        Me.btnF.Name = "btnF"
        Me.btnF.Size = New System.Drawing.Size(88, 24)
        Me.btnF.TabIndex = 3
        Me.btnF.Text = "家庭成员"
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(16, 8)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(32, 16)
        Me.Label9.TabIndex = 4
        Me.Label9.Text = "房号"
        '
        'nudHID
        '
        Me.nudHID.Location = New System.Drawing.Point(80, 8)
        Me.nudHID.Name = "nudHID"
        Me.nudHID.Size = New System.Drawing.Size(152, 21)
        Me.nudHID.TabIndex = 5
        '
        'FRMZ
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(520, 349)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.nudHID, Me.Label9, Me.btnF, Me.btnZ, Me.GroupBox2, Me.GroupBox1})
        Me.Name = "FRMZ"
        Me.Text = "转让"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        CType(Me.nudHID, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private iMe As Integer
    Private Sub btnF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnF.Click
        Dim fmfa As FRMFA = New FRMFA()
        fmfa.ShowDialog()
    End Sub

    Private Sub btnZ_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZ.Click
        If nudHID.Text = "" Then
            MsgBox("请输入房号!", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        End If
        If tbHOName1.Text = "" Or tbHOIDCard1.Text = "" Then
            MsgBox("请输入原房主的信息!", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        End If
        If tbHOName2.Text = "" Or tbHOIDCard2.Text = "" Then
            MsgBox("请输入新房主的信息!", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        End If
        '检查用户输入的信息是否正确
        If Not check() Then
            Exit Sub
        End If
        '计算各自应该付的管理费用
        Dim mySql1 As String = "select iDate from information"
        Dim myDbopera2 As DbOpera = New DbOpera(mySql1)
        mySql1 = "select hoMoney from houseOwner where hID=" & nudHID.Text
        Dim myDbopera3 As DbOpera = New DbOpera(mySql1)
        If myDbopera2.getSum() < Date.Today.Day Then
            MsgBox("你应该付" & myDbopera3.getSum(), MsgBoxStyle.Exclamation, "OK")
            GoTo L
        End If
        Dim allCost As Integer = 0
        allCost = MendAndPark() + ECostAndWCost()
        Dim mySql As String = "select hoMoney from houseOwner where hID=" & nudHID.Text
        Dim myDbopera1 As DbOpera = New DbOpera(mySql)
        allCost = allCost + myDbopera1.getSum()
        If Not ManageCost(allCost) Then
            Exit Sub
        End If

        '插入新的户主的资料,并删除旧的户主的相关的资料(户主资料,家庭成员,报修,投诉,停车场)
        '删除旧的家庭成员信息
        '删除报修的信息
        '删除停车场的信息
        '修改房屋信息中的户主名字

L:      DelAndAddOwner()
        delFamily()
        delAndChg()
        Dim sqlStr As String
        sqlStr = "update houseOwner set hoMoney=" & iMe.ToString() & "  where hID=" & nudHID.Text
        Dim dbopera2 As DbOpera = New DbOpera(sqlStr)
        dbopera2.opera()
    End Sub

    Private Sub delFamily() '删除原房主的家庭成员
        Dim sqlStr As String = "delete from family where hID=" & nudHID.Text
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        dbopera1.opera()
    End Sub
    Private Sub DelAndAddOwner() '删除原房主的信息,加入新房主的信息
        Dim sqlStr As String
        Dim dbopera1 As DbOpera
        Dim dbopera2 As DbOpera
        sqlStr = "delete from houseOwner where hID=" & nudHID.Text
        dbopera1 = New DbOpera(sqlStr)
        dbopera1.opera()
        Dim iM1 As Integer = Date.Today.Month
        Dim iM2 As Integer = Date.Today.Year
        Dim hoCostDate As String = iM2.ToString() & "年" & iM1.ToString() & "月"
        sqlStr = "insert into houseOwner(hoName,hID,hoIDCard,hoSex,hoTel,hoRemark,hoCostDate,hoAddress) values('"
        sqlStr = sqlStr & tbHOName2.Text & "',"
        sqlStr = sqlStr & nudHID.Text & ",'"
        sqlStr = sqlStr & tbHOIDCard2.Text & "','"
        sqlStr = sqlStr & cbHOSex2.Text & "','"
        sqlStr = sqlStr & tbHOTel2.Text & "','"
        sqlStr = sqlStr & tbHORemark2.Text & "','"
        sqlStr = sqlStr & hoCostDate & "','"
        sqlStr = sqlStr & tbHOAddress2.Text & "')"
        'MsgBox(sqlStr, MsgBoxStyle.Exclamation, "OK")
        dbopera2 = New DbOpera(sqlStr)
        dbopera2.opera()
    End Sub
    Private Sub delAndChg()
        '删除报修的信息,更改停车场的信息,更改房屋的户主的姓名
        Dim sqlStr As String
        sqlStr = "delete from lodge where hID=" & nudHID.Text '删除投诉的信息
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        dbopera1.opera()
        sqlStr = "update garage set hID=0,gBook='否' where hID=" & nudHID.Text '更改停车场的使用信息
        Dim dbopera2 As DbOpera = New DbOpera(sqlStr)
        dbopera2.opera()
        sqlStr = "update house set hoName='" & tbHOName2.Text & "' where hID=" & nudHID.Text
        Dim dbopera3 As DbOpera = New DbOpera(sqlStr) '更改房屋的房主信息
        dbopera3.opera()
        sqlStr = "delete from mend where hID=" & nudHID.Text '删除报修信息
        Dim dbopera4 As DbOpera = New DbOpera(sqlStr)
        dbopera4.opera()
    End Sub
    Private Function check() As Boolean
        Dim sqlStr As String
        sqlStr = "select * from houseOwner where hID=" & nudHID.Text
        sqlStr = sqlStr & " and hoName='" & tbHOName1.Text & "' and  hoIDCard='"
        sqlStr = sqlStr & tbHOIDCard1.Text & "'"
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        If Not dbopera1.checkValid() Then
            MsgBox("该房号所住的可能不是该用户,用户名错或身份证号错!", MsgBoxStyle.Exclamation, "OK")
            check = False
            Exit Function
        End If
        check = True
    End Function
    Private Function MendAndPark() As Integer  '报修和停车场的使用费用
        Dim iM1 As Integer = Date.Today.Day '今天是本月的第几天
        Dim iM2 As Integer = Date.DaysInMonth(Date.Today.Year, Date.Today.Month) '本月有多少天
        Dim sqlStr As String
        Dim iM3 As Integer = 0
        '计算原住户应该付的报修费用,停车场使用费
        sqlStr = "select gPrice from garage where hID=" & nudHID.Text
        Dim dbopera2 As DbOpera = New DbOpera(sqlStr)
        iM3 = Int(dbopera2.getSum() * iM1 / iM2) + iM3
        '计算报修费用
        sqlStr = "select mSumFee from mend where hID=" & nudHID.Text & " and mUse='否'"
        Dim dbopera3 As DbOpera = New DbOpera(sqlStr)
        iM3 = iM3 + dbopera3.getSum()
        MendAndPark = iM3
    End Function
    Private Function ECostAndWCost() As Integer '注意电费和水费的计算单位是分,所以要进行换算
        Dim sqlStr As String
        Dim iM4 As Integer = Date.Today.Month.Parse(Date.Today.Month.ToString())
        '看看本月的电费是否已经录入了,否则本月的电费使用上个月的电费来进行折算
        '先看本月的电费和水费是否已经录入了,如果没有录入,就根据上个月的电费来进行折算
        '如果已经录入了,那么电费和水费就已经计算到了原住户的欠款项中了,所以就要检查用户欠款
        sqlStr = "select iMonth from information"
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        Dim dbopera2 As DbOpera
        If iM4 = dbopera1.getSum() Then '说明本月的电费和水费已经录入了
            sqlStr = "select hoMoney from houseOwner where hID=" & nudHID.Text
            dbopera2 = New DbOpera(sqlStr)
            ECostAndWCost = dbopera2.getSum()
            Exit Function
        End If
        sqlStr = "select eCost from eletrityCost where hID=" & nudHID.Text
        dbopera2 = New DbOpera(sqlStr)
        iM4 = dbopera2.getSum()
        sqlStr = "select wCost from waterCost where hID=" & nudHID.Text
        Dim dbopera3 As DbOpera = New DbOpera(sqlStr)
        iM4 = iM4 + dbopera3.getSum()
        '下面进行折算
        Dim iM1 As Integer = Date.Today.Day '今天是本月的第几天
        Dim iM2 As Integer = Date.DaysInMonth(Date.Today.Year, Date.Today.Month) '本月有多少天
        iM4 = Int(iM4 * iM1 / iM2)
        ECostAndWCost = iM4
    End Function
    Private Function ManageCost(ByVal oCost As Integer) As Boolean  '计算本月的管理费用,新旧户主所应该付的份额
        Dim sqlStr As String
        sqlStr = "select iManageCost from information"
        Dim mCost As Integer
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        mCost = dbopera1.getSum() '月管理费
        Dim iM1 As Integer = Date.Today.Day '今天是本月的第几天
        Dim iM2 As Integer = Date.DaysInMonth(Date.Today.Year, Date.Today.Month) '本月有多少天
        Dim iM3 As Integer
        Dim iM4 As Integer
        iM3 = Int(mCost * iM1 / iM2) '原户主应该付的本月的管理费
        iMe = 0 - iM3
        'iM4 = mCost - iM3 '新户主应该付的本月的管理费
        iM3 = oCost + iM3

        sqlStr = "  原住户应该付:" & iM3.ToString()
        If MsgBox(sqlStr, MsgBoxStyle.YesNo, "OK") = MsgBoxResult.Yes Then
            ManageCost = True
        Else
            ManageCost = False
        End If
    End Function

    Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -