⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.frm

📁 称重管理软件(大型地磅)源码 为农贸市场定制开发
💻 FRM
📖 第 1 页 / 共 5 页
字号:
Dim i As Integer
Dim j As Integer
With chepaiGrid
.Clear
.Rows = 2
.Cols = rstUser.Fields.Count

For i = 0 To .Cols - 1
.TextMatrix(0, i) = rstUser.Fields(i).Name

'将矩阵的第一行设置为表字段名
Next i
.ColWidth(0) = 1000
.ColWidth(1) = 1300
.ColWidth(2) = 1300
.ColWidth(3) = 1700

If rstUser.RecordCount > 0 Then
.Rows = rstUser.RecordCount + 10
i = 1
rstUser.MoveFirst
Do Until rstUser.EOF
'直到rs至结果集末尾退出循环
For j = 0 To rstUser.Fields.Count - 1

.TextMatrix(i, j) = rstUser.Fields(j).Value & ""
'.ColAlignment(i) = center

'将表中的记录导入grid
Next j
rstUser.MoveNext
i = i + 1
Loop
End If
.ColSel = .Cols - 1

End With

    '  Else
   'MsgBox "没有记录!", vbOKOnly, "提示:"
    End If
   .Close

   End With
Exit Sub
p:
MsgBox "chepaiDATA错误!", vbOKOnly, "错误"

End Sub
Private Sub shangpinData()
On Error GoTo p
   With rstUser
   If .State = adStateOpen Then .Close
   .Open "select id as 编号,name as 货物名称 from [goods] order by id desc", cnnUser, adOpenKeyset, adLockReadOnly
   Dim kkk As Integer
   kkk = rstUser.RecordCount
With shangpinGrid
.Clear
End With
   
   If Not .EOF Then
Dim i As Integer
Dim j As Integer
With shangpinGrid
.Clear
.Rows = 2
.Cols = rstUser.Fields.Count

For i = 0 To .Cols - 1
.TextMatrix(0, i) = rstUser.Fields(i).Name

'将矩阵的第一行设置为表字段名
Next i
.ColWidth(0) = 1000
.ColWidth(1) = 2200

If rstUser.RecordCount > 0 Then
.Rows = rstUser.RecordCount + 10
i = 1
rstUser.MoveFirst
Do Until rstUser.EOF
'直到rs至结果集末尾退出循环
For j = 0 To rstUser.Fields.Count - 1

.TextMatrix(i, j) = rstUser.Fields(j).Value & ""
'.ColAlignment(i) = center

'将表中的记录导入grid
Next j
rstUser.MoveNext
i = i + 1
Loop
End If
.ColSel = .Cols - 1

End With

    '  Else
   'MsgBox "没有记录!", vbOKOnly, "提示:"
    End If
   .Close

   End With
Exit Sub
p:
MsgBox "shangpinDATA错误!", vbOKOnly, "错误"

End Sub
Private Sub weiData()
On Error GoTo p
   With rstUser
   If .State = adStateOpen Then .Close
   .Open "select sid as 称重编号,chepai as 车牌号码,maoz as 毛重,piz as 皮重,danjia as 单价 from [data] where maoz = 0 or piz =0 or danjia=0 and sid like '%" & Format(DateTime.Now, "yyMMdd") & "%' order by id desc", cnnUser, adOpenKeyset, adLockReadOnly
   Dim kkk As Integer
   kkk = rstUser.RecordCount
With Grid1
.Clear
End With
   
   If Not .EOF Then
Dim i As Integer
Dim j As Integer
With Grid1
.Clear
.Rows = 2
.Cols = rstUser.Fields.Count

For i = 0 To .Cols - 1
.TextMatrix(0, i) = rstUser.Fields(i).Name

'将矩阵的第一行设置为表字段名
Next i
.ColWidth(0) = 0
.ColWidth(1) = 1200
.ColWidth(2) = 900
.ColWidth(3) = 900
.ColWidth(4) = 900

If rstUser.RecordCount > 0 Then
.Rows = rstUser.RecordCount + 10
i = 1
rstUser.MoveFirst
Do Until rstUser.EOF
'直到rs至结果集末尾退出循环
For j = 0 To rstUser.Fields.Count - 1

.TextMatrix(i, j) = rstUser.Fields(j).Value & ""
'.ColAlignment(i) = center

'将表中的记录导入grid
Next j
rstUser.MoveNext
i = i + 1
Loop
End If
.ColSel = .Cols - 1
'设置起始列
'Dim k As Boolean
'Dim tr As Double
'Dim jj As Integer
'jj = i
'tr = 0
'.AddItem "汇总:", i
'Do While Not jj
'tr = Val(.TextMatrix(jj, 14)) + tr
'jj = jj - 1
'Loop
'.TextMatrix(i, 14) = CStr(tr) & " 元"
'Text2.Text = .TextMatrix(i, 14)
'jj = i
'tr = 0
'Do While Not jj
'tr = Val(.TextMatrix(jj, 16)) + tr
'jj = jj - 1
'Loop
'.TextMatrix(i, 16) = CStr(tr) & " 元"
'Text3.Text = .TextMatrix(i, 16)
End With

    '  Else
   'MsgBox "没有记录!", vbOKOnly, "提示:"
    End If
   .Close

   End With
Exit Sub
p:
MsgBox "WEIDATA错误!", vbOKOnly, "错误"

End Sub
Private Sub data()
coShangpin.Clear
coChepai.Clear
coFahuo.Clear
coShouhuo.Clear

On Error GoTo p

  With rstUser
    If .State = adStateOpen Then .Close
    .Open "Select * from goods", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coShangpin.AddItem rstUser.Fields("name").Value
    Me.cooShangpin.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
        .Open "Select * from che", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coChepai.AddItem rstUser.Fields("chepai").Value
    Me.cooChepai.AddItem rstUser.Fields("chepai").Value
    .MoveNext
     Loop
    .Close
            .Open "select * from users where adm = '0'", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.cooSby.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
        .Open "Select * from danwei where tag ='1'", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coFahuo.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
        .Open "Select * from danwei where tag ='2'", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coShouhuo.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
       .Open "Select * from feilv", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.txtFeilv.Text = Format(CStr(rstUser.Fields("feilv").Value), "0.00")
    Me.ttFl.Text = Format(CStr(rstUser.Fields("feilv").Value), "0.00")
    .MoveNext
     Loop
    .Close
   
    
  End With
   
  Exit Sub
p:
  MsgBox "DATA数据库读取错误!", vbOKOnly, "错误"
  End
End Sub
Private Sub fh()

coFahuo.Clear
On Error GoTo p

  With rstUser
    If .State = adStateOpen Then .Close

        .Open "Select * from danwei where tag ='1'", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coFahuo.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
    
  End With
   
  Exit Sub
p:
  MsgBox "fh()数据库读取错误!", vbOKOnly, "错误"
  End
End Sub
Private Sub sh()

coShouhuo.Clear
On Error GoTo p

  With rstUser
    If .State = adStateOpen Then .Close

        .Open "Select * from danwei where tag ='2'", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coShouhuo.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
    
  End With
   
  Exit Sub
p:
  MsgBox "sh()数据库读取错误!", vbOKOnly, "错误"
  End
End Sub
Private Sub sp()

coShangpin.Clear
cooShangpin.Clear
On Error GoTo p

  With rstUser
    If .State = adStateOpen Then .Close

    .Open "Select * from goods", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coShangpin.AddItem rstUser.Fields("name").Value
    Me.cooShangpin.AddItem rstUser.Fields("name").Value
    .MoveNext
     Loop
    .Close
    
  End With
   
  Exit Sub
p:
  MsgBox "sp()数据库读取错误!", vbOKOnly, "错误"
  End
End Sub
Private Sub cp()

coChepai.Clear
cooChepai.Clear
On Error GoTo p

  With rstUser
    If .State = adStateOpen Then .Close

        .Open "Select * from che", cnnUser, adOpenKeyset, adLockOptimistic
    Do While Not .EOF
    Me.coChepai.AddItem rstUser.Fields("chepai").Value
    Me.cooChepai.AddItem rstUser.Fields("chepai").Value
    .MoveNext
     Loop
    .Close
    
  End With
   
  Exit Sub
p:
  MsgBox "cp()数据库读取错误!", vbOKOnly, "错误"
  End
End Sub
Private Sub riqi()
On Error GoTo p

  With rstUser
    If .State = adStateOpen Then .Close

        .Open "Select min(ctime) from data ", cnnUser, adOpenKeyset, adLockOptimistic
    If Not .EOF Then
   If rstUser.Fields(0).Value <> "" Then
    DTPicker1.MinDate = Format(rstUser.Fields(0).Value, "yyyy-MM-dd")
    DTPicker2.MinDate = Format(rstUser.Fields(0).Value, "yyyy-MM-dd")
    DTPicker1.Value = Format(rstUser.Fields(0).Value, "yyyy-MM-dd")
    End If
    End If
    .Close
        .Open "Select max(ctime) from data", cnnUser, adOpenKeyset, adLockOptimistic
    If Not .EOF Then
    If rstUser.Fields(0).Value <> "" Then
    DTPicker1.MaxDate = Format(rstUser.Fields(0).Value, "yyyy-MM-dd")
    DTPicker2.MaxDate = Format(rstUser.Fields(0).Value, "yyyy-MM-dd")
    End If
    End If
    .Close
    
    
    
  End With
   
  Exit Sub
p:
  MsgBox "Riqi数据库读取错误!", vbOKOnly, "错误"
  End
End Sub



Private Sub cheLiangGrid_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With cheLiangGrid
.Row = .MouseRow
.Col = 0
.ColSel = .Cols - 1
End With
End Sub


Private Sub chepaiGrid_DblClick()
 kDanwei.Text = ""
kZizhong.Text = ""
kChepai.Text = ""
 kZizhong.Text = chepaiGrid.TextMatrix(chepaiGrid.Row, 2)
 kChepai.Text = chepaiGrid.TextMatrix(chepaiGrid.Row, 1)
 
 With rstUser
    If .State = adStateOpen Then .Close
    .Open "Select name from danwei where id ='" & chepaiGrid.TextMatrix(chepaiGrid.Row, 3) & "'", cnnUser, adOpenKeyset, adLockOptimistic
    If Not .EOF Then
     kDanwei.Text = rstUser.Fields("name").Value
    End If
    .Close
End With
 
End Sub

Private Sub chepaiGrid_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With c

⌨️ 快捷键说明

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