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

📄 newgoodsform.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Top             =   2280
         Width           =   900
      End
   End
End
Attribute VB_Name = "newgoodsform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************************
'*    模 块 名 称 :原料添加系统
'*    程序员姓名  :黄朝和
'*    最后修改人  :
'*    最后修改时间:2005/09/02
'*    备        注:
'*******************************************************
Private m_goodsDAO As GoodsDAO
Private m_recordset As ADODB.Recordset
Private m_stockorderDAO As stockorderDAO
Private s_recordset As ADODB.Recordset

Private Sub Command1_Click()
    goodsmanager.edit_goods = 1
    If Not Check Then                          ' 判断输入的合法性
        Exit Sub
           
    Else
        Dim ret As String
        ret = m_goodsDAO.new_goods(m_recordset, Trim(Text1.text), Trim(Text6.text), Trim(Text2.text), _
                                    Trim(Text3.text), Trim(Text15.text), Trim(Text7.text), Trim(Text8.text), _
                                    Trim(Text9.text), Trim(Text4.text), CDbl(Trim(Text10.text)), _
                                    CDbl(Trim(Text11.text)), CDbl(Trim(Text12.text)), CDbl(Trim(Text13.text)), CDbl(Trim(Text14.text)), Trim(Text5.text))

                                    Call clear
    End If
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Command3_Click()
   If goodsmanager.edit_goods = 0 Then                  ' 表示修改一条记录
            If Not Check Then                           ' 判断输入的合法性
                Exit Sub
            Else
                Call savexgjl
            End If
    ElseIf goodsmanager.edit_goods = 1 Then             ' 表示增加一条记录
            If Not Check Then                           ' 判断输入的合法性
               Exit Sub
            Else
                Call savexzjl
                Unload Me
            End If
    End If
End Sub

Private Sub Form_Load()
    SetToCenter Me
    Set s_recordset = New ADODB.Recordset
    Set m_stockorderDAO = New stockorderDAO
    Set m_goodsDAO = New GoodsDAO
    Set m_recordset = New ADODB.Recordset
    If goodsmanager.edit_goods = 0 Then                     ' 表示编辑商品
            Command1.Visible = False
            Text1.Enabled = True
            Text6.Enabled = True
            Me.caption = "修改商品"
        Dim ret As Boolean
        Dim s_goodsid As String                             'CustomerListForm窗体传过来的参数
        s_goodsid = goodsmanager.goods_id
            ret = m_stockorderDAO.showgoods(m_recordset, s_goodsid)
      If ret = True Then
        Text1.text = Trim(m_recordset.Fields("name"))                           ' 参数-商品名称
        Text1.Tag = Trim(m_recordset.Fields("name"))
        Text2.text = Trim(m_recordset.Fields("acronym"))                        ' 参数-执行标准
        Text3.text = Trim(m_recordset.Fields("pattern"))                        '代号
        Text3.Tag = Trim(m_recordset.Fields("pattern"))                        '代号
        Text4.text = Trim(m_recordset.Fields("switchrelation"))                        ' 参数-转换关系
        Text5.text = Trim(m_recordset.Fields("memo"))                         ' 参数-备注
        Text6.text = Trim(m_recordset.Fields("stripe"))                         ' 参数-型号
        Text6.Tag = Trim(m_recordset.Fields("stripe"))                         ' 参数-型号
        Text7.text = Trim(m_recordset.Fields("smallunit"))                      ' 参数-小单位
        Text8.text = Trim(m_recordset.Fields("bigunit"))                        ' 参数-大单位
        Text9.text = Trim(m_recordset.Fields("specification"))                  ' 参数-税票
        Text9.Tag = Trim(m_recordset.Fields("specification"))                  ' 参数-税票
        Text10.text = CDbl(Trim(m_recordset.Fields("prepriceo")))               ' 参数-业务员
        Text11.text = CDbl(Trim(m_recordset.Fields("prepricet")))               ' 参数-隶属
        Text12.text = CDbl(Trim(m_recordset.Fields("prepriceth")))              ' 参数-备注
        Text13.text = CDbl(Trim(m_recordset.Fields("prepricef")))               ' 参数-业务员
        Text14.text = CDbl(Trim(m_recordset.Fields("presetprice")))             ' 参数-隶属
        Text15.text = Trim(m_recordset.Fields("madein"))                          ' 参数-产地
        m_recordset.Close
    Else
        MainForm.g_msgText = "商品编码不正确,请重新操作!"
        HMsgBox MainForm.g_msgText, 0, 1
        Unload Me
    End If
  End If
  If goodsmanager.edit_goods = 1 Then
            Command1.caption = "新增(&A)"
            Me.caption = "新增商品"
  End If
End Sub



Private Sub clear()
    Text1.text = ""
    Text2.text = ""
    Text3.text = ""
    Text4.text = ""
    Text5.text = ""
    Text6.text = ""
    Text7.text = ""
    Text8.text = ""
    Text9.text = ""
    Text10.text = "1"
    Text11.text = "1"
    Text12.text = "1"
    Text13.text = "1"
    Text14.text = "1"
    Text15.text = ""
End Sub
Private Sub savexzjl()      '保存新增
    Dim ret As String
        ret = m_goodsDAO.new_goods(m_recordset, Trim(Text1.text), Trim(Text6.text), Trim(Text2.text), _
                                    Trim(Text3.text), Trim(Text15.text), Trim(Text7.text), Trim(Text8.text), _
                                    Trim(Text9.text), Trim(Text4.text), CDbl(Trim(Text10.text)), _
                                    CDbl(Trim(Text11.text)), CDbl(Trim(Text12.text)), CDbl(Trim(Text13.text)), CDbl(Trim(Text14.text)), Trim(Text5.text))
                                    Unload Me

End Sub

Private Sub savexgjl()      '保存修改
    Dim ret As String
        ret = m_goodsDAO.edit_goods1(m_recordset, Trim(Text1.text), Trim(Text6.text), Trim(Text2.text), _
                                    Trim(Text3.text), Trim(Text15.text), Trim(Text7.text), Trim(Text8.text), _
                                    Trim(Text9.text), Trim(Text4.text), CDbl(Trim(Text10.text)), _
                                    CDbl(Trim(Text11.text)), CDbl(Trim(Text12.text)), CDbl(Trim(Text13.text)), CDbl(Trim(Text14.text)), Trim(Text5.text), Trim(goodsmanager.goods_id))
                                    Unload Me

End Sub
 

Private Function Check() As Boolean             '判断文本框内容的有效性
    Check = True
'    If goodsmanager.edit_goods = 0 Then
'        Dim ret As Boolean
'        Dim l As Integer
'        ret = m_goodsDAO.goods2_show(s_recordset, Trim(Text1.Tag))
'        Do While Not s_recordset.EOF
'            If Text1.Tag = Trim(s_recordset.Fields("name")) Then
'                MsgBox "该商品名称已经存在", vbOKOnly, "提示"
'                Text1.SetFocus
'                Check = False
'                Exit Function
'            End If
'        s_recordset.MoveNext
'        l = l + 1
'        Loop
'    ElseIf goodsmanager.edit_goods = 1 Then
'        Dim ret7 As Boolean
'        ret7 = m_goodsDAO.judge_goods(s_recordset, Trim(Text1.text))
'        If ret7 Then
'            MsgBox "该商品名称已经存在", vbOKOnly, "提示"
'            Text1.SetFocus
'            Check = False
'            Exit Function
'        End If
'    End If
'    If Len(Trim(Text10.text)) = 0 Then                       ' 判断完成数量是否为空
'        MainForm.g_msgText = "预售价1用不能为空!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text10.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Not IsNumeric(Text10.text) Then
'        MainForm.g_msgText = "预售价1,你输入的格式有错误!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text10.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Len(Trim(Text11.text)) = 0 Then                       ' 判断完成数量是否为空
'        MainForm.g_msgText = "预售价2用不能为空!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text11.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Not IsNumeric(Text11.text) Then
'        MainForm.g_msgText = "预售价2,你输入的格式有错误!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text11.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Len(Trim(Text12.text)) = 0 Then                       ' 判断完成数量是否为空
'        MainForm.g_msgText = "预售价3用不能为空!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text12.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Not IsNumeric(Text12.text) Then
'        MainForm.g_msgText = "预售价3,你输入的格式有错误!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text12.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Len(Trim(Text13.text)) = 0 Then                       ' 判断完成数量是否为空
'        MainForm.g_msgText = "预售价4用不能为空!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text13.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Not IsNumeric(Text13.text) Then
'        MainForm.g_msgText = "预售价4,你输入的格式有错误!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text13.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Len(Trim(Text14.text)) = 0 Then                       ' 判断完成数量是否为空
'        MainForm.g_msgText = "预设进价用不能为空!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text14.SetFocus
'        Check = False
'        Exit Function
'    End If
'    If Not IsNumeric(Text14.text) Then
'        MainForm.g_msgText = "预设进价,你输入的格式有错误!"
'        Call HMsgBox(MainForm.g_msgText, 0, 1)
'        Text14.SetFocus
'        Check = False
'        Exit Function
'    End If
    If Len(Trim(Text7.text)) = 0 Or Len(Trim(Text8.text)) = 0 Then
        MainForm.g_msgText = "小单位和大单位至少填一个!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text7.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text1.text)) = 0 Then
        MainForm.g_msgText = "商品名称不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text1.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text6.text)) = 0 Then
        MainForm.g_msgText = "代号不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text6.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text3.text)) = 0 Then
        MainForm.g_msgText = "材质不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text3.SetFocus
        Check = False
        Exit Function
    End If
    If Len(Trim(Text9.text)) = 0 Then
        MainForm.g_msgText = "规格不能为空!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Text9.SetFocus
        Check = False
        Exit Function
    End If
    m_goodsDAO.goods_all m_recordset
    While Not m_recordset.EOF
'        If Text3.text <> Text3.Tag Then
'            If Text3.text = Trim(m_recordset.Fields("pattern")) Then
'                MainForm.g_msgText = "型号已存在,请重新输入!"
'                Call HMsgBox(MainForm.g_msgText, 0, 1)
'                Text3.SetFocus
'                Check = False
'                m_recordset.Close
'                Exit Function
'            End If
'        End If
        If Text6.text <> Text6.Tag Then
            If Text6.text = Trim(m_recordset.Fields("stripe")) Then
                MainForm.g_msgText = "代号已存在,请重新输入!"
                Call HMsgBox(MainForm.g_msgText, 0, 1)
                Text6.SetFocus
                Check = False
                m_recordset.Close
                Exit Function
            End If
        End If
'        If Text9.text <> Text9.Tag Then
'            If Text9.text = Trim(m_recordset.Fields("specification")) Then
'                MainForm.g_msgText = "规格已存在,请重新输入!"
'                Call HMsgBox(MainForm.g_msgText, 0, 1)
'                Text9.SetFocus
'                Check = False
'                m_recordset.Close
'                Exit Function
'            End If
'        End If
        m_recordset.MoveNext
    Wend
    m_recordset.Close
End Function
'
'Private Sub Text4_KeyPress(KeyAscii As Integer)
'    InputFieldLimit Text4, 6, KeyAscii
'
'End Sub

⌨️ 快捷键说明

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