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

📄 frmzcdd.frm

📁 小型超市进销存系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
   Begin VB.Label lblGoods 
      Caption         =   "商品名称:"
      Height          =   375
      Left            =   360
      TabIndex        =   18
      Top             =   2280
      Width           =   975
   End
   Begin VB.Label lblTdate 
      Caption         =   "提货日期:"
      Height          =   255
      Left            =   2760
      TabIndex        =   8
      Top             =   1320
      Width           =   975
   End
   Begin VB.Label lblGoodsid 
      Caption         =   "商品号:"
      Height          =   495
      Left            =   2760
      TabIndex        =   7
      Top             =   2280
      Width           =   1455
   End
   Begin VB.Label lblDdid 
      Caption         =   "Label6"
      ForeColor       =   &H000000FF&
      Height          =   255
      Left            =   3840
      TabIndex        =   5
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label lblAddress 
      Caption         =   "联系地址:"
      Height          =   375
      Left            =   360
      TabIndex        =   4
      Top             =   1800
      Width           =   975
   End
   Begin VB.Label lblName 
      Caption         =   "顾客姓名:"
      Height          =   375
      Left            =   2760
      TabIndex        =   3
      Top             =   840
      Width           =   1095
   End
   Begin VB.Label lblTel 
      Caption         =   "联系电话:"
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   1320
      Width           =   1095
   End
   Begin VB.Label lblDdate 
      Caption         =   "订货日期:"
      Height          =   495
      Left            =   360
      TabIndex        =   1
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "订单号码:"
      Height          =   375
      Left            =   2760
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "frmZCAdddd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim maxId As Integer
Private Sub cmdExit_Click()
 Dim resPonse As Integer
 Dim stra As String
    resPonse = MsgBox("您确定放弃添加吗?", vbOKCancel + vbQuestion)
    If resPonse = 1 Then
    stra = "delete from t_corderdetail where corderid=" & maxId
    Dblink.executeSQL stra
    stra = "delete from t_corder where corderid=" & maxId
    Dblink.executeSQL stra
    Unload Me
    End If
End Sub
Private Sub cmdOk_Click()
 Dim stYle As String
 Dim resPonse As Integer
  Dim stra As String
 If txtName.Text = "" Then
     MsgBox "顾客姓名不能为空!"
       txtName.SetFocus
     Else
      If txtTel.Text = "" Then
      MsgBox "联系电话不能为空!"
      txtTel.SetFocus
      Else
     If txtaddress.Text = "" Then
     MsgBox "联系地址不能为空!"
     txtaddress.SetFocus
     Else
        If Option2.Value = True Then
         stYle = "送货"
         Else
         stYle = "自取"
        End If
        stra = "insert into t_corder values('" & Trim(txtName.Text) & "','" & Trim(txtTel.Text) & "','" _
                 & Trim(txtaddress.Text) & "'," & lblMoney.Caption & ", '" & dtDate.Value & "','" & _
                 dtTdate.Value & "','未提','" & stYle & "',22222" & ")"
         Dblink.executeSQL stra
        resPonse = MsgBox("您还有新的订单需要添加吗?", vbYesNo + vbQuestion)
            If resPonse = 6 Then
              Unload Me
              Me.Show
             Else
              Unload Me
            End If
        End If
      End If
 End If
End Sub

Private Sub Form_Load()
 Dim clmX As ColumnHeader
 Dim itmX As ListItem
 Dim i As Integer
 Dim stra As String
'Stra = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=supermarket;Data Source=."
'Dblink.linkDB Stra
 cmdOk.Enabled = False
 lvMore.View = lvwReport
 Set clmX = lvMore.ColumnHeaders.Add()
 clmX.Width = 1000
 clmX.Text = "商品编号"
 Set clmX = lvMore.ColumnHeaders.Add()
 clmX.Width = 950
 clmX.Text = "订购数量"
 txtNum.Enabled = False
 dtDate.Value = Date
 dtTdate.Value = Date
stra = "select max(corderid) from t_corder"
Dblink.executeSQL stra
    If Dblink.rs.Fields(0) > 0 Then
     maxId = Val(Dblink.rs.Fields(0)) + 1
    Else
     maxId = 1
    End If
    lblDdid.Caption = maxId
End Sub
Private Sub MHF_DblClick()
Dim intOldRow As Integer
Dim N As Integer
 Dim stra As String
    N = MHF.Row
    If intOldRow < MHF.Rows Then
    MHF.TextMatrix(intOldRow, 0) = "" '将上个"★"清空
    Else
    intOldRow = 0
    End If
    MHF.Row = intOldRow
    If MHF.Row > 0 Then
        For i = 1 To Dblink.rs.Fields.Count '给上次加色的列清色
            MHF.Col = i
            MHF.CellBackColor = vbWhite
        Next i
    End If
    MHF.Row = N
    MHF.TextMatrix(MHF.Row, 0) = "★" '给第0列加上"★"符号
    For i = 1 To Dblink.rs.Fields.Count '给指定列加颜色
        MHF.Col = i
        MHF.CellBackColor = vbGreen
    Next i
    intOldRow = MHF.Row
        txtGoodsID.Text = MHF.TextMatrix(MHF.Row, 1)
        txtSell.Text = MHF.TextMatrix(MHF.Row, 8)
        stra = "select store from t_goods where goodsid='" & txtGoodsID.Text & "'"
        Dblink.executeSQL stra
        txtStock.Text = Dblink.rs.Fields(0)
      If txtStock.Text <> "0" Then
        txtNum.Enabled = True
        txtNum.SetFocus
        Else
        MsgBox "没有库存不能订货,请选择其它商品!"
      End If

End Sub
Private Sub txtaddress_KeyPress(KeyAscii As Integer)
  Cmd1 KeyAscii
End Sub
Private Sub txtGoodsName_KeyPress(KeyAscii As Integer)
 Dim stra As String
Cmd1 KeyAscii
 If KeyAscii = 13 Then
  stra = "select * from t_price where goodsName like '%" & txtGoodsname.Text & "%'"
  Dblink.executeSQL stra
  If Dblink.rs.RecordCount = 0 Then
       MsgBox "未找到记录,请重新查询!"
       txtGoodsname.Text = ""
      Exit Sub
       Else
        Set MHF.DataSource = Dblink.executeSQL(stra)
        MHF.ColWidth(0) = 240
      End If
  End If
End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer)
 Cmd1 KeyAscii
End Sub
Private Sub txtNum_KeyPress(KeyAscii As Integer)
 Dim stra As String
Cmd KeyAscii
If KeyAscii = 13 Then
  If Val(Trim(txtNum.Text)) > Val(txtStock.Text) Then
    MsgBox "对不起,该商品最大可订数量为" & txtStock.Text & " 请重新确认数量!"
    txtNum.Text = ""
    txtNum.SetFocus
  Else
    If Val(Trim(Trim(txtNum.Text))) < 1 Then
      MsgBox "对不起订购数量必须大于等于1,请重新确认数量!"
    Else
     Set itmX = lvMore.ListItems.Add()
     itmX.Text = txtGoodsID.Text
     itmX.SubItems(1) = txtNum.Text
     Set itmX = lvMore.ListItems.Add()
     itmX.ForeColor = vbGreen
     itmX.Text = "---------"
     lvMore.ForeColor = vbGreen
     itmX.SubItems(1) = "-----------"
     stra = "insert into t_corderdetail values(" & maxId & ",'" & txtGoodsID.Text & "','" & MHF.TextMatrix(MHF.Row, 2) _
           & "'," & Val(Trim(txtNum.Text)) & "," & txtSell.Text & ")"
      Dblink.executeSQL stra
      lblMoney.Caption = Val(Trim(txtNum.Text)) * Val(Trim(txtSell.Text)) + lblMoney.Caption
      txtNum.Enabled = False
      cmdOk.Enabled = True
      txtGoodsname.SetFocus
    End If
   txtNum.Text = ""
  End If
 End If
End Sub
Private Sub txtTel_KeyPress(KeyAscii As Integer)
  Cmd KeyAscii
End Sub

⌨️ 快捷键说明

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