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

📄 frm_showfeetype.frm

📁 这是个进销存管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_EMS"
      OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_EMS"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSFlexGridLib.MSFlexGrid MS1 
      Height          =   3420
      Left            =   0
      TabIndex        =   0
      Top             =   840
      Width           =   9045
      _ExtentX        =   15954
      _ExtentY        =   6033
      _Version        =   393216
      AllowUserResizing=   3
   End
End
Attribute VB_Name = "frm_stockBillAnalyse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub Stock()
  '清空MS1中数据
  On Error Resume Next
  For i = 1 To 99
      For j = 1 To MS1.Cols + 1
          MS1.TextMatrix(i, j) = ""
      Next j
  Next i
  Dim tradecode, fullname As String
  Dim avgprice, qty, tsum As Single
  Adodc3.RecordSource = "SELECT a.tradecode, a.fullname, a.averageprice, b.qty, b.tsum FROM tbS_stock a INNER JOIN (SELECT SUM(qty) AS qty, SUM(tsum) AS tsum, fullname FROM tbS_warehouse_detailed GROUP BY fullname) b ON a.fullname = b.fullname WHERE (a.price > '0 ')"
  Adodc3.Refresh
  
         MS1.Rows = Adodc3.Recordset.RecordCount + 1: MS1.Cols = 6 '定义MS1控件的总行数、总列数。
        '定义MS1表的宽度
        MS1.ColWidth(0) = 12 * 25 * 1
        MS1.ColWidth(1) = 12 * 25 * 4
        MS1.ColWidth(2) = 12 * 25 * 12
        MS1.ColWidth(3) = 12 * 25 * 4
        MS1.ColWidth(4) = 12 * 25 * 4
        MS1.ColWidth(5) = 12 * 25 * 4
        
        '设置固定行、列
        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 Adodc3.Recordset.RecordCount + 1
            MS1.TextMatrix(i, 0) = i
        Next i
  
  For i = 1 To Adodc3.Recordset.RecordCount

      If Adodc3.Recordset.RecordCount > 0 Then
         tradecode = Adodc3.Recordset.Fields(0)
         fullname = Adodc3.Recordset.Fields(1)
         avgprice = Adodc3.Recordset.Fields(2)
         qty = Adodc3.Recordset.Fields(3)
         tsum = Adodc3.Recordset.Fields(4)
      End If
      Adodc4.RecordSource = "SELECT tradecode, fullname, sum(qty) as qty,sum(tsum) as tsum FROM tbS_rewarehouse_detailed where (tradecode='" + tradecode + "')GROUP BY tradecode, fullname"
      Adodc4.Refresh
      If Adodc4.Recordset.RecordCount > 0 Then
         qty = qty - Adodc4.Recordset.Fields(2)     '计算进货分析数量:进货总数-退货总数
         tsum = tsum - Adodc4.Recordset.Fields(3)   '计算进货分析金额:进货总金额-退货总金额
      End If
         avgprice = tsum / qty                        '计算进货总金额:进货分析金额/进货分析数量
         MS1.TextMatrix(i, 1) = tradecode
         MS1.TextMatrix(i, 2) = fullname
         MS1.TextMatrix(i, 3) = qty
         MS1.TextMatrix(i, 4) = Round(avgprice, 4)    '通过Round函数 小数点后保留4位,四舍五入
         MS1.TextMatrix(i, 5) = tsum
         Adodc3.Recordset.MoveNext
      If Adodc3.Recordset.EOF Then Exit Sub
  Next i
End Sub


Sub allStock()
    '清空MS1中数据
  On Error Resume Next
  For i = 1 To MS1.Cols + 1
      For j = 1 To 5
          MS1.TextMatrix(i, j) = ""
      Next j
  Next i
    '开始检索所有进货明细表中的的信息商品
  Adodc1.RecordSource = "select tradecode,fullname,sum(qty) as qty,AVG(price) AS price,sum(tsum) as tsum from tbS_warehouse_detailed group by tradecode,fullname"
  Adodc1.Refresh
  
         MS1.Rows = Adodc1.Recordset.RecordCount + 1: MS1.Cols = 6 '定义MS1控件的总行数、总列数。
        '定义MS1表的宽度
        MS1.ColWidth(0) = 12 * 25 * 1
        MS1.ColWidth(1) = 12 * 25 * 4
        MS1.ColWidth(2) = 12 * 25 * 12
        MS1.ColWidth(3) = 12 * 25 * 4
        MS1.ColWidth(4) = 12 * 25 * 4
        MS1.ColWidth(5) = 12 * 25 * 4
        '设置固定行、列
        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 Adodc1.Recordset.RecordCount + 1
            MS1.TextMatrix(i, 0) = i
        Next i
  
  
  
  
   If Adodc1.Recordset.RecordCount > 0 Then    '判断是否有记录
        With Adodc1.Recordset      'With语句用来在一个单一对象或一个用户定义类型上执行一系列的语句。
          For rs = 1 To Adodc1.Recordset.RecordCount

              If .Fields("fullname") <> "" Then
                 '赋值给ms1表格
                 If .Fields("tradecode") <> "" Then MS1.TextMatrix(rs, 1) = Trim(.Fields("tradecode"))
                 If .Fields("fullname") <> "" Then MS1.TextMatrix(rs, 2) = Trim(.Fields("fullname"))
                 If .Fields("qty") <> "" Then MS1.TextMatrix(rs, 3) = Trim(.Fields("qty"))
                 If .Fields("price") <> "" Then MS1.TextMatrix(rs, 4) = Round(.Fields("price"), 4)
                 If .Fields("tsum") <> "" Then MS1.TextMatrix(rs, 5) = .Fields("tsum")
               Else
                 MsgBox ("无数据选择!")
              End If
              .MoveNext
              If .EOF Then Exit Sub
          Next rs
        End With
     End If
End Sub

Private Sub Form_Load()
  Adodc1.ConnectionString = PublicStr
  Adodc1.RecordSource = "select * from tbS_warehouse_detailed"
  Adodc1.Refresh
  Adodc3.ConnectionString = PublicStr
  Adodc4.ConnectionString = PublicStr

End Sub

Private Sub Form_Unload(Cancel As Integer)
  frm_main.Enabled = True
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  Select Case Button.Key
    Case Is = "allStock"
               Call allStock
    Case Is = "stock"
               Call Stock
    Case Is = "exit"
               frm_main.Enabled = True
               Unload Me
  End Select
End Sub
'版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整(不得修改代码、注释和相关内容),否则,我公司将追究其法律责任。
'《Visual Basic编程词典》软件是由吉林省明日科技有限公司开发的面向程序员和编程爱好者的技术最全、案例最多和使用最方便的Visual Basic编程技术词典。它包含30个实际项目的开发过程和源码(每月新增加一个实际开发项目源码);最完整、最全面、最实用的函数、控件和基础技术大全;上千个编程技巧和几百个典型实例;同时还提供了编程中所需的各种素材和资源。价值无限,服务无限。技术服务及升级请访问www.cccxy.com
'《Visual Basic编程词典》是各级编程人员不可缺少的编程技术资源管理软件。如果您是初学者,本软件提供了大量实例、项目的源码及其详尽、完整的开发过程文档和技术说明文件,同时还配有各方面的学习录像,让您快速入门,快速精通;如果您是编程设计高手,本软件提供了大量编程技巧、源码速查和全方位的技术资源,让您轻松编程、轻松赚钱。
'《Visual Basic编程词典》软件是软件开发商和软件服务商的资源宝库,它提供了几十个实际项目案例的项目源码、软件升级和有限服务支持,同时每月还提供新的行业软件,让您用最好、最多的软件资源开拓您的软件市场,创造更多的利润空间。价值无限,服务无限。技术服务及升级请访问www.cccxy.com
'《Visual Basic编程词典》对所有源码项目的实例的开发过程和代码功能都作了详细说明,让您真正融会贯通,迅速提高编程本领。
'如果您在使用《Visual Basic编程词典》中有疑问或好的建议,请访问我公司"编程词典"技术服务网站www.cccxy.com或拨打我公司电话(0431-4978981,4978982),我们愿为广大编程者提供最好的产品和最佳的服务。对于提出好的建议的读者,我们将给与奖励,详情请访问www.cccxy.com。
'吉林省明日科技有限公司 www.mingrisoft.com  www.cccxy.com  价值无限,服务无限
'(0431)4978981,4978982

⌨️ 快捷键说明

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