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

📄 stockstore.frm

📁 即时通讯
💻 FRM
📖 第 1 页 / 共 4 页
字号:
'*******************************************************
'*    模 块 名 称 :清除窗体的所填的内容
'*    功 能 描 述 :清除窗体的所填的内容
'*******************************************************
Private Sub clear()
        storenotenum.text = GetBillNo(3)
        suppliername.text = ""
        storedate.text = CDate(Date + Time())
        deliverydate.text = Format(Date, "yyyy-mm-dd")
        superinrtendent.text = ""
        store.text = ""
        phone.text = ""
        memo.text = ""
        counterman.text = Trim(MainForm.g_application.m_userName)
        inputman.text = Trim(MainForm.g_application.m_userName)
        shhe.text = ""
        Text1.text = ""
        Text1.Tag = ""
        MSHFlexGrid1.clear
    Call showform
End Sub
'*******************************************************
'*    模 块 名 称 :初始化MSHFlexGrid1列的内容
'*    功 能 描 述 :初始化MSHFlexGrid1列的内容
'*******************************************************
Private Sub showform()
    MSHFlexGrid1.TextMatrix(0, 0) = "采购入库明细编号"
    MSHFlexGrid1.TextMatrix(0, 1) = "商品名称"
    MSHFlexGrid1.TextMatrix(0, 2) = "单位"
    MSHFlexGrid1.TextMatrix(0, 3) = "数量"
    MSHFlexGrid1.TextMatrix(0, 4) = "单价"
    MSHFlexGrid1.TextMatrix(0, 5) = "金额"
    MSHFlexGrid1.TextMatrix(0, 6) = "完成数量"
    MSHFlexGrid1.TextMatrix(0, 7) = "备注"
    MSHFlexGrid1.TextMatrix(0, 8) = "商品编号"
    MSHFlexGrid1.TextMatrix(0, 9) = "已经入库数量"
    
                                                                                           '设置列对齐方式  7-右对齐 5-居中对齐 2-左对齐
    MSHFlexGrid1.ColAlignment(0) = 2
    MSHFlexGrid1.ColAlignment(1) = 2
    MSHFlexGrid1.ColAlignment(2) = 2
    MSHFlexGrid1.ColAlignment(3) = 8
    MSHFlexGrid1.ColAlignment(4) = 8
    MSHFlexGrid1.ColAlignment(5) = 8
    MSHFlexGrid1.ColAlignment(6) = 8
    MSHFlexGrid1.ColAlignment(7) = 2
    MSHFlexGrid1.ColAlignment(8) = 2
    MSHFlexGrid1.ColAlignment(9) = 8

    
    MSHFlexGrid1.ColWidth(9) = 5
    MSHFlexGrid1.ColWidth(0) = 5
    MSHFlexGrid1.ColWidth(8) = 5
    MSHFlexGrid1.ColWidth(7) = 2000
End Sub

Private Sub Command1_Click()
    Call Drbmhelp(1, Trim(deliverydate.text))
    '根据设置选择显示编码和名称,并进行存储
    If Len(XT_calendar.Xtfhcs) <> 0 Then
            deliverydate.text = XT_calendar.Xtfhcs  '将日历窗体里取得的值传给建档日期的文本框
    End If
    'deliverydate.SetFocus
End Sub

Private Sub Command2_Click()
    Dim ret As Boolean
            QueryFom.m_currentQuery = QUERY_WAREHOUSE
            QueryFom.show vbModal
            ' 如果此原料已有BOM记录,则调出些条BOM的信息
            ret = m_warehouseDAO.Findwarehouse(m_recordset, _
                                          MainForm.g_application.m_queryResultId)
            If ret Then
                With m_recordset                          '将查询到的记录传到列表显示
                    store.Tag = Trim(.Fields("warehouseid"))
                    store.text = Trim(.Fields("仓库名称"))
                End With
                    
           End If
           m_recordset.Close
End Sub

Private Sub Command3_Click()
        Dim ret As Boolean
            QueryFom.m_currentQuery = QUERY_EMPLOYEE
            QueryFom.show vbModal
            ' 如果此原料已有BOM记录,则调出些条BOM的信息
            ret = m_EmployeeDAO.FindEmployee(m_recordset, _
                                          MainForm.g_application.m_queryResultId)
            If ret Then
                    With m_recordset                          '将查询到的记录传到列表显示
                        counterman.Tag = Trim(.Fields("员工编号"))
                        counterman.text = Trim(.Fields("员工姓名"))
                    End With
                        m_recordset.Close
            End If
End Sub

Private Sub Command4_Click()
            Dim ret As Boolean
            QueryFom.m_currentQuery = QUERY_EMPLOYEE
            QueryFom.show vbModal
            ' 如果此原料已有BOM记录,则调出些条BOM的信息
            ret = m_EmployeeDAO.FindEmployee(m_recordset, _
                                          MainForm.g_application.m_queryResultId)
            If ret Then
                    With m_recordset                          '将查询到的记录传到列表显示
                        inputman.Tag = Trim(.Fields("员工编号"))
                        inputman.text = Trim(.Fields("员工姓名"))
                    End With
                        m_recordset.Close
            End If
End Sub

'*******************************************************
'*    模 块 名 称 :删除商品的一条记录
'*    功 能 描 述 :删除商品的一条记录
'*******************************************************
Private Sub deletegoods_Click()
     If Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 1)) = "" Then
        MainForm.g_msgText = "请选择一条记录!!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Exit Sub
    End If
    If MSHFlexGrid1.Rows <= 2 Then
        MainForm.g_msgText = "不能删除该记录,由于总的只有一条记录!!"
        Call HMsgBox(MainForm.g_msgText, 0, 1)
        Exit Sub
    End If
        If MSHFlexGrid1.Rows <= 2 Then
            MainForm.g_msgText = "请先添加一条记录!!"
            Call HMsgBox(MainForm.g_msgText, 0, 1)
        Else
            MSHFlexGrid1.RemoveItem MSHFlexGrid1.row
            j = j - 1
        End If
End Sub
Public Sub Drbmhelp(bzlx As Integer, Scdwnr As String)                    '调入编码参照窗体

    '函数参数:帮助类型(0-通用型 1-日期型 2-特殊型),帮助编码,首次定位内容

    On Error GoTo ErrHandle
    XT_calendar.Xtfhcs = ""
    Select Case bzlx
        Case 1
            XT_calendar.xtcdcs = Date
            XT_calendar.show 1      '显示日历窗体

    End Select

ErrHandle:

End Sub



'*******************************************************
'*    模 块 名 称 :加载窗体
'*    功 能 描 述 :加载窗体
'*******************************************************
Private Sub Form_Load()
    SetToCenter Me
Set m_EmployeeDAO = New employeeDAO
Set m_warehouseDAO = New WarehouseDAO
Set m_recordset = New ADODB.Recordset
Set m_stockstoreDAO = New stockstoreDAO
Set m_supplierDAO = New supplierDAO
Set s_recordset = New ADODB.Recordset
Set m_goodsDAO = New GoodsDAO
Set g_recordset = New ADODB.Recordset
Set s_stockorderDAO = New stockorderDAO
Set t_recordset = New ADODB.Recordset
Set h_recordset = New ADODB.Recordset
Set k_recordset = New ADODB.Recordset
        If stockstorelistform.stockstore_type = 0 Then                              '判断该页是否是从stockorderlistsupplier传过来的   0--表示是,1--表示否
                Call suppliershow
                Call goodsshow
                Call form_enabled
        ElseIf stockstorelistform.stockstore_type = 1 Then
                If stockstore_form = 1 Then
                    Tlb_Action.Buttons("cx").Enabled = False
                    Call clear
                    Call cxjl
                Else
                    Call clear
                    Call showform
        
                End If
        End If
End Sub


'*******************************************************
'*    模 块 名 称 :修改mshflexgrid1使得可以编辑
'*    功 能 描 述 :编辑各行各列
'*******************************************************
Private Sub MSHFlexGrid1_Click()
        If stockstorelistform.stockstore_type = 1 Then
            m_row = MSHFlexGrid1.MouseRow
                m_col = MSHFlexGrid1.MouseCol
            If m_row < MSHFlexGrid1.FixedRows Then m_row = MSHFlexGrid1.FixedRows
            If m_col < MSHFlexGrid1.FixedCols Then m_col = MSHFlexGrid1.FixedCols
                MSHFlexGrid1.row = m_row: MSHFlexGrid1.col = m_col
            If m_col = 3 Then
                Text2.Visible = False
                Text2.Move MSHFlexGrid1.Left + MSHFlexGrid1.CellLeft, MSHFlexGrid1.Top + MSHFlexGrid1.CellTop, MSHFlexGrid1.CellWidth + 20, (MSHFlexGrid1.CellHeight - 50)
                Text2.text = Trim(MSHFlexGrid1.text)
                Text2.Visible = True
                Text2.SetFocus
            End If
            If m_col = 4 Then
                Text2.Visible = False
                Text2.Move MSHFlexGrid1.Left + MSHFlexGrid1.CellLeft, MSHFlexGrid1.Top + MSHFlexGrid1.CellTop, MSHFlexGrid1.CellWidth + 20, (MSHFlexGrid1.CellHeight - 50)
                Text2.text = Trim(MSHFlexGrid1.text)
                Text2.Visible = True
                Text2.SetFocus
            End If
            If m_col = 7 Then
                Text2.Visible = False
                Text2.Move MSHFlexGrid1.Left + MSHFlexGrid1.CellLeft, MSHFlexGrid1.Top + MSHFlexGrid1.CellTop, MSHFlexGrid1.CellWidth + 20, (MSHFlexGrid1.CellHeight - 50)
                Text2.text = Trim(MSHFlexGrid1.text)
                Text2.Visible = True
                Text2.SetFocus
            End If
      End If
End Sub
'*******************************************************
'*    模 块 名 称 :右键菜单显示
'*    功 能 描 述 :右键菜单显示
'*******************************************************
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = 2 Then                            '如果是鼠标右键按下时
    PopupMenu mnufile, 0, X, 3500    '弹出右键菜单
  End If
End Sub


'*******************************************************
'*    模 块 名 称 :输入文本框的数据
'*    功 能 描 述 :对文本框的数据进行判断和对各类数据进行相应的计算
'*******************************************************
Private Sub Text2_Change()
  If stockstorelistform.stockstore_type = 1 Then
    If Len(Trim(Text2.text)) = 0 Then
        Exit Sub
    End If
    If m_col = 6 Then
        Text2.Visible = False
    End If
    If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 1) = "" Then
            MainForm.g_msgText = "您的操作有误,请重试!!"
'            MainForm.g_msgText = "请您先点击新增,添加一条采购定单或者先添加一种商品!!"
            Call HMsgBox(MainForm.g_msgText, 0, 1)
            Text2.text = ""
            Exit Sub
    Else
        MSHFlexGrid1.TextMatrix(m_row, m_col) = Text2.text
        If Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 3)) <> "" Then
            If CDbl(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 3)) > CDbl(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 9)) Then
                        MainForm.g_msgText = "你输入的数量的值太大了,数量值最大应该是!!" & CDbl(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 9))
                        Call HMsgBox(MainForm.g_msgText, 0, 1)
                        Text2.text = CDbl(Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 9)))
                        Exit Sub
            End If
            MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 5) = "¥" & CDbl(Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 3)) * CDbl(Replace(Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 4)), "¥", "")))
'            MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 9) = CDbl(Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 3)))
        End If
        If Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 4)) <> "" Then
            MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 5) = "¥" & CDbl(Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 3)) * CDbl(Replace(Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 4)), "¥", "")))
        End If
    End If
  End If
End Sub
'*******************************************************
'*    模 块 名 称 :文本框失去焦点
'*******************************************************
Private Sub Text2_LostFocus()
    Text2.Visible = False
End Sub
'*******************************************************
'*    模 块 名 称 :菜单按钮的设置
'*    功 能 描 述 :对菜单按钮各种设置所对应的不同操作
'*******************************************************
Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)
 If stockstorelistform.stockstore_type = 1 Then
    Select Case Button.Key
            Case "bc"
                If Not Check Then                              ' 判断输入文本的内容
                    Exit Sub
                End If
                If Not judge_position Then
                    Exit Sub
                End If
                If Not judge_position1 Then
                    Exit Sub
                End If
                    Call xzjl
                    Call clear
                    Unload Me                   ' 关闭窗体
                
            Case "tc"
                Unload Me
            Case "cx"
                stockstore_form = 0
                cxjl
            Case "dy"
                If Not Check Then                              ' 判断输入文本的内容
                    Exit Sub
                End If
                If Not judge_position Then
                    Exit Sub
                End If
                If Not judge_position1 Then
                    Exit Sub
                End If
                    Call xzjl
                    Call clear
                PrintData (stockstoreid_d)
   End Select
 ElseIf stockstorelistform.stockstore_type = 0 Then
    Select Case Button.Key
        Case "tc"
           Unload Me
        Case "dy"
            PrintData (Trim(stockstorelistform.stockstoreid))
    End Select
End If
End Sub
'*******************************************************
'*    模 块 名 称 :新增一条采购入库的记录
'*    最后修改时间:2005/08/31
'*    备        注:
'*******************************************************
Private Sub xzjl()
    MainForm.g_application.m_databaseCon.m_adoConnection.BeginTrans
    On Error GoTo EXITSUB
    If stockstore_form = 0 Then
        stockstoreid_d = m_stockstoreDAO.addstockstore(m_recordset, Trim(storenotenum.text), Trim(suppliername.text), Trim(superinrtendent.text), CDate(storedate.text), CDate(deliverydate.text), Trim(phone.text), Trim(store.Tag), Trim(counterman.text), Trim(inputman.text), 1, Trim(memo.text), Trim(MainForm.g_application.m_queryResultId))

    ElseIf stockstore_form = 1 And stockstorelistform.stockstore_type = 1 Then
        stockstoreid_d = m_stockstoreDAO.addstockstore(m_recordset, Trim(storenotenum.text), Trim(suppliername.text), Trim(superinrtendent.text), CDate(storedate.text), CDate(deliverydate.text), Trim(phone.text), Trim(store.Tag), Trim(counterman.text), Trim(inputman.text), 1, Trim(memo.text), Trim(stockstore_stockstoreid))
    End If
    For currentrow2 = 1 To MSHFlexGrid1.Rows - 1
    
        If Trim(MSHFlexGrid1.TextMatrix(currentrow2, 8)) <> "" Then
            m_stockstoreDAO.addstockstoredetail k_recordset, Trim(stockstoreid_d), _
            Trim(MSHFlexGrid1.TextMatrix(currentrow2, 8)), _
            Trim(MSHFlexGrid1.TextMatrix(currentrow2, 2)), _

⌨️ 快捷键说明

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