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

📄 frm库存统计.frm

📁 适合于中小型企业管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      TabIndex        =   14
      Top             =   119
      Width           =   11535
      _ExtentX        =   20346
      _ExtentY        =   10478
      _Version        =   393216
      AllowUpdate     =   0   'False
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   9
      BeginProperty Column00 
         DataField       =   "仓库名称"
         Caption         =   "仓库名称"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "物资编号"
         Caption         =   "物资编号"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "类别编码"
         Caption         =   " 类别"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "物资名称"
         Caption         =   "   物资名称"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "物资型号"
         Caption         =   "    物资型号"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "上期结转"
         Caption         =   "上期结转"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "本期入库"
         Caption         =   "本期入库"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "本期出库"
         Caption         =   "本期出库"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "仓库结存"
         Caption         =   "仓库结存"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   900.284
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   870.236
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   615.118
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1454.74
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   1800
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   959.811
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   975.118
         EndProperty
         BeginProperty Column07 
            ColumnWidth     =   929.764
         EndProperty
         BeginProperty Column08 
            ColumnWidth     =   1035.213
         EndProperty
      EndProperty
   End
   Begin vsElasticLightLibCtl.vsElasticLight vsElasticLight1 
      Left            =   0
      OleObjectBlob   =   "Frm库存统计.frx":279E
      Top             =   0
   End
End
Attribute VB_Name = "Frm库存统计"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Rstmp As ADODB.Recordset
Dim mrc As ADODB.Recordset
Dim TxtSql As String

Private Sub Command1_Click()
    Dim CmdExe As ADODB.Command
    Set CmdExe = New ADODB.Command
    CmdExe.ActiveConnection = Cw_DataEnvi.DataConnect
            
    CmdExe.CommandText = "execute Fl_仓库汇总 '" & txt03.Value & "','" & txt02.Value & "'"
    CmdExe.Execute
    If Check1.Value = 0 Then
        TxtSql = "select * from(select a.物资编号,a.仓库名称,b.类别编码,b.物资名称,b.物资型号, sum(a.期进1-a.期出1) as 上期结转,sum(a.期出2-a.期出1) as 本期出库,sum(a.期进2-a.期进1) as 本期入库,sum(a.期进2-a.期出2)as 仓库结存 from Fl_仓库汇总表 AS a INNER JOIN fl_物资信息表 as b ON a.物资编号=b.物资编号 group by a.仓库名称,a.物资编号,b.类别编码,b.物资名称,b.物资型号) DERIVEDTBL WHERE not((上期结转 = 0) AND (本期出库 = 0) AND (本期入库 = 0) AND (仓库结存 = 0)) and 类别编码 like '%" & Text1.Text & "%' and 物资名称 like '%" & Text2.Text & "%' and 物资型号 like '%" & Text3.Text & "%' and 仓库名称 LIKE '%" & combo1.Text & "%' order by 类别编码,物资名称,物资型号,仓库名称"
    Else
        TxtSql = "select * from(select a.物资编号,a.仓库名称,b.类别编码,b.物资名称,b.物资型号, sum(a.期进1-a.期出1) as 上期结转,sum(a.期出2-a.期出1) as 本期出库,sum(a.期进2-a.期进1) as 本期入库,sum(a.期进2-a.期出2)as 仓库结存 from Fl_仓库汇总表 AS a INNER JOIN fl_物资信息表 as b ON a.物资编号=b.物资编号 group by a.仓库名称,a.物资编号,b.类别编码,b.物资名称,b.物资型号) DERIVEDTBL WHERE not((本期出库 = 0) AND (本期入库 = 0)) and 类别编码 like '%" & Text1.Text & "%' and 物资名称 like '%" & Text2.Text & "%' and 物资型号 like '%" & Text3.Text & "%' and 仓库名称 LIKE '%" & combo1.Text & "%' order by 类别编码,物资名称,物资型号,仓库名称"
    End If
    OutTxt.Text = "C:\辅料仓库汇总.xls"
    Set Rstmp = New ADODB.Recordset
    Rstmp.Open TxtSql, Cw_DataEnvi.DataConnect, adOpenStatic, adLockPessimistic, adCmdText
    Set DataGrid1.DataSource = Rstmp
End Sub

Private Sub Form_Load()
    txt02.Value = Date
    txt03.Value = Date
    
    Dim RsCk As ADODB.Recordset
    Set RsCk = New ADODB.Recordset
    
    RsCk.Open "Fl_辅料仓库表", Cw_DataEnvi.DataConnect, adOpenStatic, adLockPessimistic, adCmdTable
    combo1.Clear
    Do While Not RsCk.EOF
        combo1.AddItem RsCk!仓库名称
        RsCk.MoveNext
    Loop
    If combo1.ListCount > 0 Then combo1.ListIndex = 0
    RsCk.Close
End Sub

'纪录导出到Execl
Public Sub RecordsetToExcel(Rs As ADODB.Recordset, excel_sheet As Excel.Worksheet)
    Dim i As Long, j As Long
    Dim excel_range As Excel.Range
    Dim col_count As Long

    If Rs.RecordCount = 0 Then
        Exit Sub
    End If

    Set excel_range = excel_sheet.Cells
    col_count = Rs.Fields.Count
                
    For i = 0 To col_count - 1
        excel_sheet.Cells(1, i + 1).Value = Rs.Fields(i).Name
    Next
    excel_sheet.Range(excel_sheet.Cells(1, 1), _
                      excel_sheet.Cells(1, col_count)).Font.Bold = True
        
    excel_sheet.Range("A2").CopyFromRecordset Rs
            
End Sub

Private Sub Command2_Click()
On Error GoTo errs
    Dim Rs As ADODB.Recordset
    Dim ExcelApp As Excel.Application
    Dim ExcelBook As Excel.Workbook
    Dim ExcelSheet As Excel.Worksheet

    Set ExcelApp = New Excel.Application
    ExcelApp.Visible = False
    Set ExcelBook = ExcelApp.Workbooks.Add
    Set ExcelSheet = ExcelBook.Worksheets.Item(1)
    
    Set Rs = New ADODB.Recordset
     
    Rs.Open TxtSql, Cw_DataEnvi.DataConnect, , adLockPessimistic, adCmdText
    RecordsetToExcel Rs, ExcelSheet
    If OutTxt.Text = "" Then
      MsgBox "请指定输出文件位置和文件名!", 16, "严重错误"
      Exit Sub
    End If
    On Error GoTo ErrSave
     ExcelBook.Close True, OutTxt.Text
     MsgBox "输出成功!文件位于" & OutTxt.Text
     Rs.Close

Exit Sub
errs:
    MsgBox "Select 语句错误!", 16, "严重错误"
    ExcelBook.Close False
     Exit Sub
ErrSave:
    MsgBox "输出错误!", 16, "严重错误"
End Sub

Private Sub Command3_Click()
    Cdlg.DialogTitle = "另存为Excel文件:"
    Cdlg.Filter = "Excel文件|*.Xls|所有文件|*.*"
    Cdlg.ShowSave
    If Cdlg.FileName = "" Then Exit Sub
         OutTxt.Text = Cdlg.FileName
End Sub




⌨️ 快捷键说明

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