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

📄 frm_stockbook.frm

📁 这是个进销存管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Top             =   600
            Width           =   900
         End
         Begin VB.Label LabStock 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            ForeColor       =   &H80000008&
            Height          =   270
            Left            =   6405
            TabIndex        =   11
            Top             =   570
            Width           =   1455
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            Caption         =   "出库数量:"
            Height          =   180
            Left            =   2715
            TabIndex        =   8
            Top             =   600
            Width           =   900
         End
         Begin VB.Label LabExcStock 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            ForeColor       =   &H80000008&
            Height          =   270
            Left            =   3630
            TabIndex        =   7
            Top             =   570
            Width           =   1455
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "入库数量:"
            Height          =   180
            Left            =   165
            TabIndex        =   6
            Top             =   600
            Width           =   900
         End
         Begin VB.Label LabEnterStock 
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            ForeColor       =   &H80000008&
            Height          =   270
            Left            =   1065
            TabIndex        =   5
            Top             =   570
            Width           =   1455
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            Caption         =   "商品名称:"
            Height          =   180
            Left            =   165
            TabIndex        =   4
            Top             =   210
            Width           =   900
         End
         Begin VB.Label Label4 
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H80000005&
            BorderStyle     =   1  'Fixed Single
            ForeColor       =   &H80000008&
            Height          =   285
            Left            =   1065
            TabIndex        =   3
            Top             =   180
            Width           =   4005
         End
      End
   End
   Begin MSFlexGridLib.MSFlexGrid MS1 
      Height          =   4335
      Left            =   75
      TabIndex        =   10
      Top             =   870
      Width           =   9870
      _ExtentX        =   17410
      _ExtentY        =   7646
      _Version        =   393216
   End
End
Attribute VB_Name = "Frm_stockBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim billcode, BCsource As String
Dim sellcode, SCsource As String
Dim BC As String
Dim SC As String
Dim ms As Integer   '计算MS1控件开始到那一行了
Private Sub Form_Load()
  Adodc1.ConnectionString = PublicStr
  Adodc2.ConnectionString = PublicStr
  On Error Resume Next
  Me.Caption = Me.Caption + "  " + CStr(frm_addDate.DTPicker1.Value) + "至" + CStr(frm_addDate.DTPicker2.Value)
  BCsource = "JH"
  SCsource = "XS"
  If frm_Stock.Stock = 1 Then Label4.Caption = frm_addDate.DataCombo2.Text    '为库存商品明细
  If frm_stockChangeTb.Tb = 1 Then Label4.Caption = frm_stockChangeTb.Adodc1.Recordset.Fields(1).Value   '为进销存变动表明细
     Call MSF1
     If frm_Stock.Stock = 1 Then
        frm_addDate.Adodc2.RecordSource = "select * from tbS_stock where fullname='" & frm_addDate.DataCombo2.Text & "'"
        frm_addDate.Adodc2.Refresh
        BC = frm_addDate.Adodc2.Recordset.Fields(0).Value           '提取商品编号(库存)
     End If
     If frm_stockChangeTb.Tb = 1 Then BC = frm_stockChangeTb.Adodc1.Recordset.Fields(0)    '提取商品编号(进销存变动表)。
         For ms = 1 To 99       '判断数据录入到那一行
             If MS1.TextMatrix(ms, 1) = "" Then Exit For
         Next ms
         '///////////////////////////////////////////////////////进货退货
           'ADO控件的RecordSource执行SQL语句
            Adodc2.RecordSource = " select * from tbS_rewarehouse_detailed where (tradecode='" + BC + "'AND billdate BETWEEN '" & frm_addDate.DTPicker1.Value & "' AND '" & frm_addDate.DTPicker2.Value & "')ORDER BY tsum"
            Adodc2.Refresh
            If Adodc2.Recordset.RecordCount > 0 Then
                   For j = ms To ms + Adodc2.Recordset.RecordCount
                       Adodc1.RecordSource = " select * from tbS_rewarehouse_main where billcode='" + Adodc2.Recordset.Fields("billcode") + "'"
                       Adodc1.Refresh
                       MS1.TextMatrix(j, 1) = Adodc2.Recordset.Fields("billdate")
                       MS1.TextMatrix(j, 2) = Adodc2.Recordset.Fields(0)
                       On Error Resume Next
                       MS1.TextMatrix(j, 3) = "从『" & Adodc1.Recordset.Fields("units") & "』 进货退货:【" & Adodc2.Recordset.Fields("fullname") & "】" & " :" & Adodc1.Recordset.Fields("handle")
                       MS1.TextMatrix(j, 5) = Adodc2.Recordset.Fields("qty")
                       Adodc2.Recordset.MoveNext
                       Adodc1.Recordset.MoveNext
                    Next j
            End If
           '////////////////////////////////////////////////////////////进货
           For ms = 1 To 99       '判断数据录入到那一行
               If MS1.TextMatrix(ms, 1) = "" Then Exit For
           Next ms
             'ADO控件的RecordSource执行SQL语句
            Adodc2.RecordSource = " select * from tbS_warehouse_detailed where (tradecode='" + BC + "'AND billdate BETWEEN '" & frm_addDate.DTPicker1.Value & "' AND '" & frm_addDate.DTPicker2.Value & "')ORDER BY tsum"
            Adodc2.Refresh
            If Adodc2.Recordset.RecordCount > 0 Then
                   For j = ms To ms + Adodc2.Recordset.RecordCount
                      'ADO控件的RecordSource执行SQL语句
                       Adodc1.RecordSource = " select * from tbS_warehouse_main where billcode='" + Adodc2.Recordset.Fields("billcode") + "'"
                       Adodc1.Refresh
                       MS1.TextMatrix(j, 1) = Adodc2.Recordset.Fields("billdate")
                       MS1.TextMatrix(j, 2) = Adodc2.Recordset.Fields(0)
                       On Error Resume Next
                       MS1.TextMatrix(j, 3) = "从『" & Adodc1.Recordset.Fields("units") & "』 进货:【" & Adodc2.Recordset.Fields("fullname") & "】" & " :" & Adodc1.Recordset.Fields("handle")
                       MS1.TextMatrix(j, 4) = Adodc2.Recordset.Fields("qty")
                       Adodc2.Recordset.MoveNext
                       Adodc1.Recordset.MoveNext
                    Next j
            End If
         '//////////////////////////////////////////////////////////////////////////////////////销售退货
          For ms = 1 To 99       '判断数据录入到那一行
               If MS1.TextMatrix(ms, 1) = "" Then Exit For   '结束For循环
           Next ms
             'ADO控件的RecordSource执行SQL语句
            Adodc2.RecordSource = " select * from tbS_resell_detailed where (tradecode='" + BC + "'AND billdate BETWEEN '" & frm_addDate.DTPicker1.Value & "' AND '" & frm_addDate.DTPicker2.Value & "')ORDER BY tsum"
            Adodc2.Refresh
            If Adodc2.Recordset.RecordCount > 0 Then
                   For j = ms To ms + Adodc2.Recordset.RecordCount
                      'ADO控件的RecordSource执行SQL语句
                       Adodc1.RecordSource = " select * from tbS_resell_main where billcode='" + Adodc2.Recordset.Fields("billcode") + "'"
                       Adodc1.Refresh
                       MS1.TextMatrix(j, 1) = Adodc2.Recordset.Fields("billdate")
                       MS1.TextMatrix(j, 2) = Adodc2.Recordset.Fields(0)
                       On Error Resume Next
                       MS1.TextMatrix(j, 3) = "从『" & Adodc1.Recordset.Fields("units") & "』 销售退货:【" & Adodc2.Recordset.Fields("fullname") & "】" & " :" & Adodc1.Recordset.Fields("handle")
                       MS1.TextMatrix(j, 4) = Adodc2.Recordset.Fields("qty")
                       Adodc2.Recordset.MoveNext
                       Adodc1.Recordset.MoveNext
                    Next j
            End If
         '//////////////////////////////////////////////////////////////////////////////////////销售
            For ms = 1 To 99       '判断数据录入到那一行
                If MS1.TextMatrix(ms, 1) = "" Then Exit For
            Next ms
            'ADO控件的RecordSource执行SQL语句
            Adodc2.RecordSource = " select * from tbS_sell_detailed where (tradecode='" + BC + "'AND billdate BETWEEN '" & frm_addDate.DTPicker1.Value & "' AND '" & frm_addDate.DTPicker2.Value & "')ORDER BY tsum"
            Adodc2.Refresh
            If Adodc2.Recordset.RecordCount > 0 Then
                   For j = ms To ms + Adodc2.Recordset.RecordCount
                       Adodc1.RecordSource = " select * from tbS_sell_main where billcode='" + Adodc2.Recordset.Fields("billcode") + "'"
                       Adodc1.Refresh
                       MS1.TextMatrix(j, 1) = Adodc2.Recordset.Fields("billdate")
                       MS1.TextMatrix(j, 2) = Adodc2.Recordset.Fields(0)
                       On Error Resume Next
                       MS1.TextMatrix(j, 3) = "从『" & Adodc1.Recordset.Fields("units") & "』 销售:【" & Adodc2.Recordset.Fields("fullname") & "】" & " :" & Adodc1.Recordset.Fields("handle")
                       MS1.TextMatrix(j, 5) = Adodc2.Recordset.Fields("qty")
                       Adodc2.Recordset.MoveNext
                       Adodc1.Recordset.MoveNext
                    Next j
            End If
         '////////////////////////////////////////////////////////////////////////////////////////
  Dim fg, ff As Single
  For F = 1 To 99
      fg = fg + Val(MS1.TextMatrix(F, 4))
      ff = ff + Val(MS1.TextMatrix(F, 5))

      If MS1.TextMatrix(F, 4) = "" And MS1.TextMatrix(F, 5) = "" Then Exit For
  Next F
  LabEnterStock.Caption = ""
  LabExcStock.Caption = ""
  LabEnterStock.Caption = fg
  LabExcStock.Caption = ff
  LabStock.Caption = fg - ff
  SBar1.Panels(2) = "入库数量: " & fg
  SBar1.Panels(3) = "出库数量: " & ff
  SBar1.Panels(4) = "库存数量: " & LabStock.Caption
End Sub
Sub MSF1()
    MS1.Rows = 100: MS1.Cols = 6  '定义MS1控件的总行数、总列数。
  '定义MS1表的宽度
  MS1.ColWidth(0) = 12 * 25 * 1
  MS1.ColWidth(1) = 12 * 25 * 4
  MS1.ColWidth(2) = 12 * 25 * 6
  MS1.ColWidth(3) = 12 * 25 * 15
  MS1.ColWidth(4) = 12 * 25 * 3
  MS1.ColWidth(5) = 12 * 25 * 3
  '设置固定行、列
  MS1.FixedRows = 1: MS1.FixedCols = 1
  '定义MS1表的表头
  MS1.TextMatrix(0, 0) = "NO。"
  MS1.TextMatrix(0, 1) = "日期"
  MS1.TextMatrix(0, 2) = "单据编号"
  MS1.TextMatrix(0, 3) = "摘要"
  MS1.TextMatrix(0, 4) = "入库数量"
  MS1.TextMatrix(0, 5) = "出库数量"
  '定义MS1表的列序号
  For i = 1 To 99
      MS1.TextMatrix(i, 0) = i
  Next i
End Sub

Private Sub Form_Unload(Cancel As Integer)
  If frm_Stock.Stock = 1 Then
     frm_Stock.Stock = 22222
     frm_addDate.DataCombo2.Visible = False
     frm_addDate.Label5.Visible = False
  End If
  Unload Me
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
       Case Is = "Exit"
       If frm_Stock.Stock = 1 Then frm_Stock.Stock = 22222: frm_addDate.DataCombo2.Visible = False: frm_addDate.Label5.Visible = False
       Unload Me
End Select
End Sub

⌨️ 快捷键说明

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