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

📄 frmtakeoutedit.frm

📁 用vb编的一个商品库存管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   720
      End
      Begin VB.Label Label23 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "产品单价"
         Height          =   180
         Left            =   3240
         TabIndex        =   13
         Top             =   420
         Width           =   720
      End
      Begin VB.Label Label24 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "选择仓库"
         Height          =   180
         Left            =   240
         TabIndex        =   12
         Top             =   900
         Width           =   720
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "入库日期"
         Height          =   180
         Left            =   9240
         TabIndex        =   11
         Top             =   900
         Width           =   720
      End
      Begin VB.Label Label27 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "经办人"
         Height          =   180
         Left            =   6240
         TabIndex        =   10
         Top             =   900
         Width           =   540
      End
      Begin VB.Label lblOptDate 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "OptDate"
         Height          =   180
         Left            =   10320
         TabIndex        =   9
         Top             =   900
         Width           =   630
      End
      Begin VB.Label lblEmpName 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "EmpName"
         Height          =   180
         Left            =   7320
         TabIndex        =   8
         Top             =   900
         Width           =   630
      End
   End
   Begin VB.CommandButton Cmd_Cancel 
      Cancel          =   -1  'True
      Caption         =   "取 消"
      Height          =   400
      Left            =   6385
      MouseIcon       =   "FrmTakeoutEdit.frx":0D3D
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4800
      Width           =   1300
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确 定"
      Height          =   400
      Left            =   4225
      MouseIcon       =   "FrmTakeoutEdit.frx":1047
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   4800
      Width           =   1300
   End
End
Attribute VB_Name = "FrmTakeoutEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriId As Long
'客户信息
Public OriClt As String
Public OriCltType As Integer
'产品信息
Public OriType1, OriType2 As String
Public OriPro As String
'仓库信息
Public OriStore As String

Private Sub Fill_Clt()
  If ComboClt.Text = "" Then
    txtContact = ""
    txtAddr = ""
    txtCode = ""
    txtPhone = ""
    txtFax = ""
    txtDescribe = ""
  Else
    MyClt.GetInfo (MyClt.GetId(ComboClt.Text))
    txtContact = MyClt.Contact
    txtAddr = MyClt.Address
    txtCode = MyClt.Postcode
    txtPhone = MyClt.Phone
    txtFax = MyClt.Fax
    txtDescribe = MyClt.Describe
  End If
End Sub

Private Sub Fill_Pro()
  If ComboPro.Text = "" Then
    txtStyle = ""
    txtUnit = ""
    txtPrice = ""
    txtMin = ""
    txtMax = ""
    txtValid = ""
    txtAlarm = ""
  Else
    MyPro.GetInfo (MyPro.GetId(ComboPro.Text))
    txtStyle = MyPro.ProStyle
    txtUnit = MyPro.ProUnit
    txtPrice = MyPro.ProPrice
    txtMin = MyPro.ProLow
    txtMax = MyPro.ProHigh
    txtValid = MyPro.Valid
    txtAlarm = MyPro.AlarmDays
  End If
  
  Fill_Pronum
End Sub

Private Sub Fill_Pronum()
  Dim TmpProId, TmpStoreId As Long
  TmpProId = MyPro.GetId(ComboPro.Text)
  TmpStoreId = MyStore.GetId(ComboStore.Text)
  lblNum = MyProInStore.GetSumPro(TmpStoreId, TmpProId)
End Sub

Private Function Check() As Boolean
  If Trim(ComboClt.Text) = "" Then
    MsgBox "请选择客户单位"
    Check = False
    Exit Function
  End If
  If Trim(ComboPro.Text) = "" Then
    MsgBox "请选择产品名称"
    Check = False
    Exit Function
  End If
  If txtNum = "" Then
    MsgBox "请输入产品数量"
    txtNum.SetFocus
    Check = False
    Exit Function
  End If
  If ComboStore.Text = "" Then
    MsgBox "请选择存储的仓库"
    Check = False
    Exit Function
  End If
  If Val(txtNum) > Val(lblNum) Then
    MsgBox "出库数量不能大于库存数量"
    Exit Function
  End If
  
  Check = True
End Function

Private Sub Cmd_OK_Click()
  Dim TmpId As Long
  Dim TmpNum As Integer
  
  If Check = False Then
    Exit Sub
  End If
  
  With MyTakeout
  .TakeOutType = ComboTakeoutType.Text
  .ProId = MyPro.GetId(ComboPro.Text)
  .ProPrice = Val(txtPrice1)
  .ProNum = Val(txtNum)
  .ClientId = MyClt.GetId(ComboClt.Text)
  .StoreId = MyStore.GetId(ComboStore.Text)
  .EmpName = CurUser.EmpName
  .OptDate = Format(Now, "yyyy-mm-dd")
  
  .Insert
  
  '从仓库中提取产品
  Call MyProInStore.LoadPro(.StoreId, .ProId)
  TmpNum = Val(txtNum)
  i = 0
  Do While TmpNum > 0
    If TmpNum > Arr_StoreProNum(i) Then
      TmpNum = TmpNum - Arr_StoreProNum(i)
      MyProInStore.ProNum = 0
    Else
      MyProInStore.ProNum = Arr_StoreProNum(i) - TmpNum
      TmpNum = 0
    End If
    MyProInStore.Update (Arr_StoreProId(i))
    i = i + 1
  Loop
  
  MsgBox "完成出库操作"
  End With
  
  Unload Me
End Sub

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub

Private Sub ComboClt_Click()
  Fill_Clt
End Sub

Private Sub ComboPro_Click()
  Fill_Pro
End Sub

Private Sub ComboStore_Click()
  Fill_Pronum
End Sub

Private Sub ComboTakeoutType_Click()
  If ComboTakeoutType.ListIndex < 2 Then
    txtPrice1.Enabled = True
  Else
    txtPrice1 = 0
    txtPrice1.Enabled = False
  End If
End Sub

Private Sub ComboType_Click()
  ComboClt.Clear
  '装入客户数据
  MyClt.Load_Client (ComboType.ListIndex + 1)
  i = 0
  Do While Arr_Client(i) <> ""
    ComboClt.AddItem Arr_Client(i)
    i = i + 1
  Loop
  If ComboClt.ListCount > 0 Then
    ComboClt.ListIndex = 0
  End If
 
  Fill_Clt
End Sub

Private Sub ComboType1_Click()
  '装入二级类目
  TmpType = MyProType.GetId(ComboType1.Text)
  MyProType.Load_by_Upper (TmpType)
  ComboType2.Clear
  i = 0
  Do While Arr_ProType(i) <> ""
    ComboType2.AddItem Arr_ProType(i)
    i = i + 1
  Loop
  If ComboType2.ListCount > 0 Then
    ComboType2.ListIndex = 0
  End If
  '装入产品名称
  TmpType = MyProType.GetId(ComboType2.Text)
  MyPro.Load_by_Type (TmpType)
  ComboPro.Clear
  i = 0
  Do While Arr_Product(i) <> ""
    ComboPro.AddItem Arr_Product(i)
    i = i + 1
  Loop
  If ComboPro.ListCount > 0 Then
    ComboPro.ListIndex = 0
  End If
  Fill_Pro
End Sub

Private Sub ComboType2_Click()
  '装入产品名称
  TmpType = MyProType.GetId(ComboType2.Text)
  MyPro.Load_by_Type (TmpType)
  i = 0
  ComboPro.Clear
  Do While Arr_Product(i) <> ""
    ComboPro.AddItem Arr_Product(i)
    i = i + 1
  Loop
  If ComboPro.ListCount > 0 Then
    ComboPro.ListIndex = 0
  End If
  Fill_Pro
End Sub

Private Sub Form_Load()
  Dim TmpType As Long
  Dim i As Integer
  
  If Modify = True Then
    OriId = FrmTakeoutMan.Adodc1.Recordset.Fields(0)
    If InCombo(Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(2)), ComboTakeoutType) = True Then
      ComboTakeoutType.Text = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(2))
    End If
    '读取产品名称和类目
    OriPro = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(3))
    MyPro.GetInfo (MyPro.GetId(Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(3))))
    OriType2 = MyProType.GetName(MyPro.TypeId)
    MyProType.GetInfo (MyPro.TypeId)
    OriType1 = MyProType.GetName(MyProType.UpperId)
    ComboPro.Enabled = False
    ComboType1.Enabled = False
    ComboType2.Enabled = False
    
    ComboCreateDate.Text = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(5))
    txtPrice1 = FrmTakeoutMan.Adodc1.Recordset.Fields(6)
    txtNum = FrmTakeoutMan.Adodc1.Recordset.Fields(7)
    OriClt = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(8))
    MyClt.GetInfo (MyClt.GetId(Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(8))))
    OriCltType = MyClt.ClientType
    ComboClt.Enabled = False
    ComboType.Enabled = False
    txtPrice1.Enabled = False
    ComboTakeoutType.Enabled = False
    ComboCreateDate.Enabled = False
        
    OriStore = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(9))
    lblEmpName = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(10))
    lblOptDate = Trim(FrmTakeoutMan.Adodc1.Recordset.Fields(11))
    ComboStore.Enabled = False
  End If
  
  '装入客户数据
  ComboType.ListIndex = OriCltType - 1
  MyClt.Load_Client (OriCltType)
  i = 0
  ComboClt.Clear
  Do While Arr_Client(i) <> ""
    ComboClt.AddItem Arr_Client(i)
    i = i + 1
  Loop
  If Modify = False Then
    If ComboClt.ListCount > 0 Then
      ComboClt.ListIndex = 0
    End If
  Else
    If InCombo(OriClt, ComboClt) = True Then
      ComboClt.Text = OriClt
    End If
  End If
  Fill_Clt
  
  '装入产品信息
  '装入一级类目
  MyProType.Load_by_Upper (0)
  i = 0
  ComboType1.Clear
  Do While Arr_ProType(i) <> ""
    ComboType1.AddItem Arr_ProType(i)
    i = i + 1
  Loop
  If OriType1 = "" Then
    If ComboType1.ListCount > 0 Then
      ComboType1.ListIndex = 0
    End If
  Else
    If InCombo(OriType1, ComboType1) = True Then
      ComboType1.Text = OriType1
    End If
  End If
  '装入二级类目
  TmpType = MyProType.GetId(ComboType1.Text)
  MyProType.Load_by_Upper (TmpType)
  ComboType2.Clear
  i = 0
  Do While Arr_ProType(i) <> ""
    ComboType2.AddItem Arr_ProType(i)
    i = i + 1
  Loop
  If OriType2 = "" Then
    If ComboType2.ListCount > 0 Then
      ComboType2.ListIndex = 0
    End If
  Else
    If InCombo(OriType2, ComboType2) = True Then
      ComboType2.Text = OriType2
    End If
  End If
  '装入产品名称
  TmpType = MyProType.GetId(ComboType2.Text)
  MyPro.Load_by_Type (TmpType)
  i = 0
  ComboPro.Clear
  Do While Arr_Product(i) <> ""
    ComboPro.AddItem Arr_Product(i)
    i = i + 1
  Loop
  If OriPro = "" Then
    If ComboPro.ListCount > 0 Then
      ComboPro.ListIndex = 0
    End If
  Else
    If InCombo(OriPro, ComboPro) = True Then
      ComboPro.Text = OriPro
    End If
  End If
  Fill_Pro
  
  '入库信息
  ComboType.ListIndex = 0
  MyStore.Load_Store
  i = 0
  ComboStore.Clear
  Do While Arr_Store(i) <> ""
    ComboStore.AddItem Arr_Store(i)
    i = i + 1
  Loop
  If OriStore = "" Then
    If ComboStore.ListCount > 0 Then
      ComboStore.ListIndex = 0
    End If
  Else
    If InCombo(OriStore, ComboStore) = True Then
      ComboStore.Text = OriStore
    End If
  End If
End Sub

Private Sub txtNum_Change()
  txtAmount = Val(txtPrice1) * Val(txtNum)
End Sub

Private Sub txtNum_KeyPress(KeyAscii As Integer)
  EnterTAB (KeyAscii)
  If In_Int(KeyAscii) = False Then
    KeyAscii = 0
  End If
End Sub

Private Sub txtPos_KeyPress(KeyAscii As Integer)
  EnterTAB (KeyAscii)
End Sub

Private Sub txtPrice1_Change()
  txtAmount = Val(txtPrice1) * Val(txtNum)
End Sub

Private Sub txtPrice1_KeyPress(KeyAscii As Integer)
  EnterTAB (KeyAscii)
  If In_Single(KeyAscii) = False Then
    KeyAscii = 0
  End If
End Sub


⌨️ 快捷键说明

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