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

📄 form10.frm

📁 我用VB开发的饲料经营进销存管理程序,包含购入、售出管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sum_arr(30, 2)
Private Sub Command1_Click()
    Printer.Orientation = 2
    Printer.FontSize = 13
    Printer.FontName = "黑体"
    Printer.Print Space(30) & Label12.Caption
    Printer.Print " "
    doc = Space(3) & Label11.Caption & Space(7) & Label23.Caption & Space(1) & Label24.Caption & Space(1) & Label16.Caption & Space(1) & _
    Label25.Caption & Space(1) & Space(1) & Label17.Caption & Space(1) & Label29.Caption & _
    Space(1) & Label19.Caption & Space(1) & Label30.Caption & Space(3) & Label31.Caption
    Printer.Print doc
    Printer.Print " "
    For i = 0 To List1.ListCount - 1
        If Int(i / 24) = (i / 24) And i <> 0 Then
            Printer.NewPage
            Printer.FontSize = 13
            Printer.Print Space(30) & Label12.Caption
            Printer.Print " "
            doc = Space(3) & Label11.Caption & Space(7) & Label23.Caption & Space(1) & Label24.Caption & Space(1) & Label16.Caption & Space(1) & _
            Label25.Caption & Space(1) & Space(1) & Label17.Caption & Space(1) & Label29.Caption & _
            Space(1) & Label19.Caption & Space(1) & Label30.Caption & Space(3) & Label31.Caption
            Printer.Print doc
            Printer.Print " "
        End If
        Printer.FontSize = 11
        Printer.Print Space(3) & List1.List(i)
        Printer.FontSize = 3
        Printer.Print Chr(vbKeyReturn)
        doc = "---------------------------------------------------------------------------------------------------------" & _
        "-------------------------------------------------------------------------------------------------------------" & _
        "-------------------------------------------------------------------------------------------------------------" & _
        "-------------------------------------------------------------------------------------------------------------" & _
        "--------------------------------------------------------------"
        Printer.Print doc
    Next
    Printer.EndDoc
End Sub

Private Sub Command2_Click()
    Printer.Orientation = 1
    Printer.FontName = "黑体"
    Printer.Print Chr(vbKeyReturn) & Chr(vbKeyReturn)
    Printer.FontSize = 13
    Printer.Print "     " & Label12.Caption
    Printer.Print " "
    Printer.Print "     " & "汇总项目" & "         " & "金额"
    Printer.Print "    --------------------------------"
    For i = 0 To List2.ListCount - 1
        Printer.Print "    " & List2.List(i)
    Next
    Printer.Print "    --------------------------------"
    Printer.EndDoc
End Sub

Private Sub Command3_Click()
    Form10.Hide
    Form39.Show
End Sub

Private Sub Form_Load()
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Dim rs1 As ADODB.Recordset
    Dim rs2 As ADODB.Recordset
    Dim rs3 As ADODB.Recordset
    Dim rs4 As ADODB.Recordset
    Set cnn1 = New ADODB.Connection
    cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\jujumao\My Documents\粤丰饲料\粤丰饲料经营情况.mdb;"
    Set cmd1 = New ADODB.Command
    SQL = "select * from 月结转表  where 年份 =" & g_year & "and 月份 = " & g_month & " order by 品种"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    If rs1.EOF Then
        MsgBox ("没有查询到数据,退出!")
        Unload Form10
    End If
    j = 0
    rs1.MoveFirst
    While Not rs1.EOF
        If rs1.Fields(3) = 0 And rs1.Fields(5) = 0 And rs1.Fields(10) = 0 Then
            GoTo break_while
        End If
        S = ""
        For i = 0 To rs1.Fields.Count - 1
            Select Case i
                Case 0
                    tt_len = Len(rs1.Fields(i).Value)
                    t_len = 0
                    For t = 1 To tt_len
                        If Asc((Mid((rs1.Fields(i).Value), t, 1))) < 0 Then
                            t_len = t_len + 2
                        Else
                            t_len = t_len + 1
                        End If
                    Next
                    t_len = 18 - t_len
                    S1 = ""
                    For t = 1 To t_len
                        S1 = S1 & " "
                    Next
                    S = S & rs1.Fields(i).Value & S1
                Case 1, 2, 6, 8, 9, 11, 13
                    
                Case 4, 7, 12, 15, 16
                    t_len = 0
                    t_value = Round(rs1.Fields(i).Value, 2)
                    t_len = 11 - Len(t_value)
                    S1 = ""
                    If t_value = Int(t_value) Then
                        S1 = S1 & ".00"
                        t_len = t_len - 3
                    Else
                        If (t_value * 10) = Int(t_value * 10) Then
                            S1 = S1 & "0"
                            t_len = t_len - 1
                        End If
                    End If
                    For t = 1 To t_len
                        S1 = S1 & " "
                    Next
                    S = S & t_value & S1
                Case Else
                    t_len = 0
                    t_len = 11 - Len(rs1.Fields(i).Value)
                    S1 = ""
                    For t = 1 To t_len
                        S1 = S1 & " "
                    Next
                    S = S & rs1.Fields(i).Value & S1
            End Select
        Next
        List1.AddItem S, j
        j = j + 1
break_while:
        rs1.MoveNext
    Wend
    SQL = "select sum(购入金额),sum(运费),sum(卸车费),sum(售出金额)," & _
    "sum(结存金额),sum(毛利) from 月结转表  where 年份 =" & g_year & "and 月份 = " & g_month
    
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs2 = cmd1.Execute
    rs2.MoveFirst
    sum_arr(0, 0) = "购入总金额"
    sum_arr(0, 1) = rs2.Fields(0)
    sum_arr(1, 0) = "售出总金额"
    sum_arr(1, 1) = rs2.Fields(3)
    sum_arr(2, 0) = "结存总金额"
    sum_arr(2, 1) = rs2.Fields(4)
    g_kucun = sum_arr(2, 1)
    SQL = "select * from 资产项目表"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs4 = cmd1.Execute
    sum_arr(3, 0) = "资产总值"
    sum_arr(3, 1) = 0
    sum_arr(4, 0) = "折旧合计"
    sum_arr(4, 1) = 0
    If Not rs4.EOF Then
        rs4.MoveFirst
        While Not rs4.EOF
            sum_arr(3, 1) = sum_arr(3, 1) + rs4.Fields(4)
            sum_arr(4, 1) = sum_arr(4, 1) + ((g_year - rs4.Fields(1)) * 12 + (g_month - rs4.Fields(2))) * rs4.Fields(4) / rs4.Fields(5) / 12
            rs4.MoveNext
        Wend
    End If
    g_gudingzichan = sum_arr(3, 1) - sum_arr(4, 1)
    
    j = 5
    t_fee = 0
    t1 = 0
    SQL = "select 费用名称,sum(金额) from 跟单费用表 where 年份=" & g_year & " and 月份=" & g_month & " group by 费用名称"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs4 = cmd1.Execute
    If Not rs4.EOF Then
        rs4.MoveFirst
        While Not rs4.EOF
            sum_arr(j, 0) = rs4.Fields(0)
            sum_arr(j, 1) = rs4.Fields(1)
            t_fee = t_fee + rs4.Fields(1)
            t1 = t1 + 1
            j = j + 1
            rs4.MoveNext
        Wend
    Else
        sum_arr(j, 0) = "运费"
        sum_arr(j, 1) = rs2.Fields(1)
        j = j + 1
        t1 = t1 + 1
        sum_arr(j, 0) = "卸车费"
        sum_arr(j, 1) = rs2.Fields(2)
        j = j + 1
        t1 = t1 + 1
    End If
    SQL = "select count(*),sum(支出金额) from 费用明细表 where 年份=" & g_year & " and 月份=" & g_month
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs4 = cmd1.Execute
    sum_arr(j, 0) = "其他费用"
    sum_arr(j, 1) = 0
    rs4.MoveFirst
    If rs4.Fields(0) > 0 Then
        sum_arr(j, 1) = rs4.Fields(1)
        t_fee = t_fee + rs4.Fields(1)
    End If
    j = j + 1
    t1 = t1 + 1

    SQL = "select count(*),sum(少收金额) from 帐单表 where 年份=" & g_year & " and 月份=" & g_month
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs4 = cmd1.Execute
    sum_arr(j, 0) = "少收金额"
    sum_arr(j, 1) = 0
    rs4.MoveFirst
    If rs4.Fields(0) > 0 Then
        sum_arr(j, 1) = rs4.Fields(1)
        t_fee = t_fee + rs4.Fields(1)
    End If
    j = j + 1
    t1 = t1 + 1
     
    SQL = "select count(*),sum(欠款金额),sum(还款金额) from 帐单表 "
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs4 = cmd1.Execute
    sum_arr(j, 0) = "应收款合计"
    sum_arr(j, 1) = 0
    rs4.MoveFirst
    If rs4.Fields(0) > 0 Then
        sum_arr(j, 1) = rs4.Fields(1) - rs4.Fields(2)
    End If
    g_yingshoukuan = sum_arr(j, 1)
    j = j + 1
    
    SQL = "select count(*),sum(未付金额),sum(还款金额) from 购入帐单表"
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs4 = cmd1.Execute
    sum_arr(j, 0) = "应付款合计"
    sum_arr(j, 1) = 0
    rs4.MoveFirst
    If rs4.Fields(0) > 0 Then
        sum_arr(j, 1) = rs4.Fields(1) - rs4.Fields(2)
    End If
    g_yingfukuan = sum_arr(j, 1)
    j = j + 1
    
    sum_arr(j, 0) = "毛  利"
    sum_arr(j, 1) = rs2.Fields(5)
    j = j + 1
    sum_arr(j, 0) = "净  利"
    sum_arr(j, 1) = sum_arr(j - 1, 1) - t_fee
    
    For i = 0 To j
        S = ""
        tt_len = Len(sum_arr(i, 0))
        t_len = 0
        For t = 1 To tt_len
            If Asc((Mid((sum_arr(i, 0)), t, 1))) < 0 Then
                t_len = t_len + 2
            Else
                t_len = t_len + 1
            End If
        Next
        t_len = 14 - t_len
        S1 = ""
        For t = 1 To t_len
            S1 = S1 & " "
        Next
        S = S & sum_arr(i, 0) & S1
        t_len = 0
        t_value = Round(sum_arr(i, 1), 2)
        t_len = 11 - Len(t_value)
        S1 = ""
        If t_value = Int(t_value) Then
            S1 = S1 & ".00"
            t_len = t_len - 3
        Else
            If (t_value * 10) = Int(t_value * 10) Then
                S1 = S1 & "0"
                t_len = t_len - 1
            End If
        End If
        For t = 1 To t_len
            S1 = S1 & " "
        Next
        S = S & t_value & S1
        If i = 3 Or i = 5 Or i = (5 + t1) Or i = (5 + t1 + 2) Then
            List2.AddItem "-----------------------------"
        End If
        List2.AddItem S
    Next
    List2.ListIndex = 0
    Label12.Caption = g_year & "年" & g_month & "月汇总数据查询"
    cnn1.Close
    Set cnn1 = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Form15.Show
End Sub

⌨️ 快捷键说明

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