您的位置:首页 > 其它

机房收费系统总结篇(三)

2016-06-05 09:14 337 查看
              结账是我敲机房遇到问题最多的地方,无论是界面的设计还是代码遇到的问题都比较多,机房验收了两遍结账这个窗体还是存在问题。现在终于差不多没什么大问题了。我就来总结总结我所遇到的问题吧!

       


     开始我一直不知道这是个什么东东,我以为是画一张frame框架,然后在上边添加一个按钮,我简直是太天真了。这原来是一个叫做sstab的控件。

       

     


    第一遍验机房的时候我只是添加了操作员,但是师傅说管理员也结过账,管理员收的金额,管理员退的卡怎么办?要么你就不让管理员收取金额,要么就再添加管理员。所以我还是选择后者再添加管理员吧!上述界面的功能是,点操作员按钮,操作员可选,点管理员按钮,管理员可选。师傅说我设计的还不错。

    下面看我的代码设计部分:

     首先我们屡清一下思路,购卡,充值,退卡,临时用户用到的表分别是student——info,recharge——info,cancelcard——info,student——info。

    如果你选择购卡,则出现购卡的信息:

    

If SSTab1.Caption = "购卡" Then
myflexgrid2.Visible = True
With myflexgrid2
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "学号"
.TextMatrix(0, 1) = "卡号"
.TextMatrix(0, 2) = "日期"
.TextMatrix(0, 3) = "时间"
End With
'myflexgrid1.Visible = False

'myflexgrid1.Visible = True
txtSQL = "select * from student_Info where userID = '" & Combo1.Text & "'"
Set mrcc = executeSQL(txtSQL, msgText)

With myflexgrid2
.Rows = 1
Do While Not mrcc.EOF

.Rows = .Rows + 1
.CellAlignment = 4
.AllowUserResizing = flexResizeColumns
.TextMatrix(.Rows - 1, 0) = Trim(mrcc.Fields(1))
.TextMatrix(.Rows - 1, 1) = Trim(mrcc.Fields(0))
.TextMatrix(.Rows - 1, 2) = Trim(mrcc.Fields(12))
.TextMatrix(.Rows - 1, 3) = Trim(mrcc.Fields(13))
mrcc.MoveNext
'a = a + 1
Loop

End With
mrcc.CloseIf SSTab1.Caption = "购卡" Then
myflexgrid2.Visible = True
With myflexgrid2
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "学号"
.TextMatrix(0, 1) = "卡号"
.TextMatrix(0, 2) = "日期"
.TextMatrix(0, 3) = "时间"
End With
'myflexgrid1.Visible = False

'myflexgrid1.Visible = True
txtSQL = "select * from student_Info where userID = '" & Combo1.Text & "'"
Set mrcc = executeSQL(txtSQL, msgText)

With myflexgrid2
.Rows = 1
Do While Not mrcc.EOF

.Rows = .Rows + 1
.CellAlignment = 4
.AllowUserResizing = flexResizeColumns
.TextMatrix(.Rows - 1, 0) = Trim(mrcc.Fields(1))
.TextMatrix(.Rows - 1, 1) = Trim(mrcc.Fields(0))
.TextMatrix(.Rows - 1, 2) = Trim(mrcc.Fields(12))
.TextMatrix(.Rows - 1, 3) = Trim(mrcc.Fields(13))
mrcc.MoveNext
'a = a + 1
Loop

End With
mrcc.Close
      那么最重要的一块便是我们的结账了。

      1.做到用户名和姓名的同步:

Private Sub Command1_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
Combo1.Enabled = True
Combo2.Enabled = True
txtSQL = "select * from User_Info where level='操作员'"
Set mrc = executeSQL(txtSQL, msgtext)

Do While Not mrc.EOF
Combo1.AddItem Trim(mrc.Fields(0))
'Combo2.AddItem Trim(mrc.Fields(3))
mrc.MoveNext
Loop
mrc.Close
End Sub
Private Sub Combo1_Click()
Dim txtSQL1 As String
Dim msgtext As String
Dim mrc As ADODB.Recordset
txtSQL1 = "select * from User_Info where userID= '" & Trim(Combo1.Text) & "'"
Set mrc = executeSQL(txtSQL1, msgtext)
Combo2.Text = Trim(mrc.Fields(3))

End Sub
     2.应收金额:固定用户:充值金额-退卡金额

        临时用户:充值金额+临时消费金额-退卡金额

        总售卡张数:售卡张数-退卡张数

If SSTab1.Caption = "汇总" Then
cmdCheckout.Visible = True
'售卡张数
txtSQL = "select * from student_Info where UserID='" & Trim(Combo1.Text) & "'"
Set mra = executeSQL(txtSQL, msgtext)
Text2.Text = mra.RecordCount
'退卡张数
txtSQL = "select * from CancelCard_Info where UserID='" & Trim(Combo1.Text) & "' and status='" & "未结账" & "'"
Set mrb = executeSQL(txtSQL, msgtext)
Text1.Text = mrb.RecordCount
'充值金额
txtSQL = "select sum(addmoney) from Recharge_Info where UserID='" & Trim(Combo1.Text) & "'and status='" & "未结账" & "'"
Set mrd = executeSQL(txtSQL, msgtext)
If IsNull(mrd.Fields(0)) Then
Text3.Text = 0
Else
Text3.Text = mrd.Fields(0)
End If
'退卡金额
txtSQL = "select sum(CancelCash) from CancelCard_Info where UserID='" & Trim(Combo1.Text) & "'and status='" & "未结账" & "'"
Set rst = executeSQL(txtSQL, msgtext)
If IsNull(rst.Fields(0)) Then
Text5.Text = 0
Else
Text5.Text = rst.Fields(0)
End If
'临时收费金额
'     txtSQL = "select sum(addmoney) from ReCharge_Info where type ='临时用户'and status='未结账'and UserID='" & Val(Trim(Comboname.Text)) & "'"
txtSQL = "select sum(addmoney) from ReCharge_Info where status='未结账'and UserID='" & Val(Trim(Combo1.Text)) & "'"
Set mraa = executeSQL(txtSQL, msgtext)
If IsNull(mraa.Fields(0)) Then
Text4.Text = 0
Else
Text4.Text = mraa.Fields(0)
End If
'总售卡数
Text6.Text = Val(Text2.Text) - Val(Text1.Text)
'应收金额
Text7.Text = Val(Text3.Text) - Val(Text5.Text)
     对于结账之后更新各个表的状态我还是没有很好的弄明白,所以后续再说。

              

  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: