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

📄 frmaltercost.frm

📁 < 飞鸿商品>>零售是基于VB+SQL2000开的商品零售管理系统. 开发的很好.可以一看
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      TabIndex        =   11
      Top             =   5700
      Width           =   1275
      _ExtentX        =   2249
      _ExtentY        =   820
      Caption         =   "修  改"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin Manage.xpcmdbutton cmdQuery 
      Height          =   465
      Left            =   5250
      TabIndex        =   12
      Top             =   5700
      Width           =   1275
      _ExtentX        =   2249
      _ExtentY        =   820
      Caption         =   "查  询"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   1620
      Top             =   3090
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmAlterCost.frx":08CA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmAlterCost.frx":191C
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSFlexGridLib.MSFlexGrid Grid 
      Height          =   3585
      Left            =   2760
      TabIndex        =   24
      Top             =   60
      Width           =   6255
      _ExtentX        =   11033
      _ExtentY        =   6324
      _Version        =   393216
      Cols            =   4
      FixedCols       =   0
      SelectionMode   =   1
      AllowUserResizing=   2
      Appearance      =   0
      FormatString    =   " 商 品 编 码  |^ 商 品 名 称  |^ 单  位  |^ 成    本  "
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComctlLib.TreeView tvw 
      Height          =   5445
      Left            =   60
      TabIndex        =   25
      Top             =   60
      Width           =   2625
      _ExtentX        =   4630
      _ExtentY        =   9604
      _Version        =   393217
      HideSelection   =   0   'False
      Indentation     =   353
      LabelEdit       =   1
      LineStyle       =   1
      Style           =   7
      ImageList       =   "ImageList1"
      BorderStyle     =   1
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "frmAlterCost"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdAlter_Click()
If Grid.Text = "" Then Exit Sub

  lblID.Caption = Grid.TextMatrix(Grid.RowSel, 0)
  lblName.Caption = Grid.TextMatrix(Grid.RowSel, 1)
  lblUnit.Caption = Grid.TextMatrix(Grid.RowSel, 2)
  txtNum.Text = Grid.TextMatrix(Grid.RowSel, 3)
  pic.Visible = True
  txtNum.SelStart = 0
  txtNum.SelLength = Len(txtNum.Text)
  txtNum.SetFocus
  cmdQuery.Enabled = False
  cmdAlter.Enabled = False
  Grid.Height = 3585
End Sub

Private Sub cmdCancel_Click()
  Grid.Enabled = True
  tvw.Enabled = True
  cmdQuery.Enabled = True
  cmdAlter.Enabled = True
  Grid.Height = 5445
  pic.Visible = False
End Sub

Private Sub cmdClose_Click()
  Unload Me
End Sub

Private Sub cmdExec_Click()
Dim A As Collection, B As Collection
Dim SQL As String

If cobOper.ListIndex = -1 Or cobObject.ListIndex = -1 Or txt.Text = "" Then Exit Sub
Set A = New Collection
Set B = New Collection
A.Add "a.id "
A.Add "name "
A.Add "unit "
A.Add "cost "
B.Add "="
B.Add ">"
B.Add "<"

If cobObject.ListIndex = 3 Then
  SQL = "select a.id,name,unit,cost from yaopin_list as a,yaopin_cost as b,yaopin_unit as c " & _
      " where a.id=b.id and a.id=c.id and c.switch=1 and " & "" & A(cobObject.ListIndex + 1) & _
      " " & B(cobOper.ListIndex + 1) & " " & txt.Text
Else
  SQL = "select a.id,name,unit,cost from yaopin_list as a,yaopin_cost as b,yaopin_unit as c " & _
      "where a.id=b.id and a.id=c.id and c.switch=1 and " & "" & A(cobObject.ListIndex + 1) & _
      " " & B(cobOper.ListIndex + 1) & " '" & txt.Text & "'"
End If
FillGrid " 商 品 编 码  |^ 商 品 名 称  |^ 单  位  |^ 成    本  ", SQL, Grid, 4
Set A = Nothing
Set B = Nothing

cmdExit_Click
End Sub

Private Sub cmdExit_Click()
  Grid.Enabled = True
  tvw.Enabled = True
  cmdQuery.Enabled = True
  cmdAlter.Enabled = True
  Grid.Height = 5445
  picQuery.Visible = False
End Sub

Private Sub cmdQuery_Click()
  picQuery.Visible = True
  cmdQuery.Enabled = False
  cmdAlter.Enabled = False
  cobObject.ListIndex = -1
  cobOper.ListIndex = -1
  txt.Text = ""
  Grid.Height = 3585
End Sub

Private Sub cmdSave_Click()
Dim Cmd As ADODB.Command
Dim SQL As String

If IsNumeric(txtNum.Text) = False Then MsgBox "您填写的成本不是有效的数字!", 64: Exit Sub

Conn.BeginTrans

SQL = "update yaopin_cost set cost =" & txtNum.Text & " where id='" & lblID.Caption & "'"
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
SQL = "insert into yaopin_alter_cost values('" & lblID.Caption & "','" & _
  Format(Date$, "yyyy-mm-dd") & "','" & Format(Time$, "hh:mm:ss") & "','" & _
  UserName & "'," & Grid.TextMatrix(Grid.RowSel, 3) & "," & txtNum.Text & ")"
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute

Conn.CommitTrans

Grid.TextMatrix(Grid.RowSel, 3) = txtNum.Text

cmdCancel_Click

End Sub

Private Sub Form_Load()
Dim Rst As ADODB.Recordset
Dim CRst As ADODB.Recordset
Dim SQL As String
Dim I As Integer
Dim J As Integer
Dim Pid As Integer
Dim Nod As Node

Grid.FormatString = " 商 品 编 码  |^ 商 品 名 称  |^ 单  位  |^ 成    本  "
Grid.Height = 5445
pic.Visible = False
picQuery.Visible = False
pic.Left = 2760
pic.Top = 3720
picQuery.Left = 2760
picQuery.Top = 3720

cobObject.AddItem "商品编码"
cobObject.AddItem "商品名称"
cobObject.AddItem "单  位"
cobObject.AddItem "成  本"

cobOper.AddItem "等于"
cobOper.AddItem "大于"
cobOper.AddItem "小于"

tvw.Nodes.Add , , "all", "所有类别", 1
Pid = tvw.Nodes(1).Index

Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
SQL = "select * from yaopin_types where len(id)=2"
Rst.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
If Rst.EOF Then Exit Sub

For I = 1 To Rst.RecordCount
  Set Nod = tvw.Nodes.Add
  Nod.Text = Rst.Fields("name").Value
  Nod.Key = "n" & Rst.Fields("id").Value
  Nod.Image = 1
  Set Nod.Parent = tvw.Nodes(1)
  
  Set CRst = New ADODB.Recordset
  CRst.CursorLocation = adUseClient
  SQL = "select * from yaopin_types where id like '" & Rst.Fields("id") & "%' and len(id)=4"
  CRst.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
  If CRst.EOF Then GoTo move1
  
  For J = 1 To CRst.RecordCount
    tvw.Nodes.Add Nod.Index, tvwChild, "s" & CRst.Fields("id"), CRst.Fields("name").Value, 1
    CRst.MoveNext
  Next
move1:
  CRst.Close
  Set CRst = Nothing
  
  Rst.MoveNext
Next
Rst.Close

Set Rst = Nothing
End Sub

Private Sub tvw_NodeClick(ByVal Node As MSComctlLib.Node)
Dim SQL As String
Dim ID As String

If Node.Key = "all" Then
  SQL = "select a.id,name,unit,cost from yaopin_list as a,yaopin_cost as b,yaopin_unit as c " & _
      "where a.id=b.id and a.id=c.id and c.switch=1"
Else
  SQL = "select a.id,name,unit,cost from yaopin_list as a,yaopin_cost as b,yaopin_unit as c " & _
      "where a.id=b.id and a.id=c.id and c.switch=1 and a.id like '" & Mid(Node.Key, 2) & "%'"
End If

FillGrid " 商 品 编 码  |^ 商 品 名 称  |^ 单  位  |^ 成    本  ", SQL, Grid, 4

End Sub

Private Sub txtNum_KeyPress(KeyAscii As Integer)
  If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 46 Then KeyAscii = 0
End Sub

⌨️ 快捷键说明

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