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

📄 form14.frm

📁 我用VB开发的饲料经营进销存管理程序,包含购入、售出管理
💻 FRM
📖 第 1 页 / 共 3 页
字号:
                Case Else
            End Select
        Next
        List2.AddItem S, j
        f_repay_table(j, 0) = rs1.Fields(0).Value
        j = j + 1
        rs1.MoveNext
        List2.ListIndex = 0
    Wend
    cnn1.Close
    Set cnn1 = Nothing
exit_Command1_Click:
End Sub

Private Sub Command2_Click()
    t_YesNo = MsgBox("是否确认打印", vbYesNo)
    If t_YesNo = 7 Then
        GoSub exit_command2_click
    End If
    If List3.ListCount = 0 Then
        GoSub exit_command2_click
    End If
    Printer.FontSize = 13
    Printer.FontName = "黑体"
    Printer.Print "帐本号      帐单号       制单日期      期初欠款金额   期内还款金额   欠款金额合计     "
    Printer.Print " "
    For Row = 0 To List3.ListCount - 1
        t_sum = 0
        For i = 0 To List1.ListCount - 1
            If List3.List(Row) = f_reckon_table(i, 4) Then
                t_sum = t_sum + f_reckon_table(i, 7) - f_reckon_table(i, 8)
            End If
        Next
        print_sum = True
        For i = 0 To List1.ListCount - 1
            If List3.List(Row) = f_reckon_table(i, 4) Then
                S = ""
                tt_len = Len(f_reckon_table(i, 4))
                t_len = 0
                For t = 1 To tt_len
                    If Asc((Mid((f_reckon_table(i, 4)), t, 1))) < 0 Then
                        t_len = t_len + 2
                    Else
                        t_len = t_len + 1
                    End If
                Next
                t_len = 12 - t_len
                S1 = ""
                For t = 1 To t_len
                    S1 = S1 & " "
                Next
                S = S & f_reckon_table(i, 4) & S1
                tt_len = Len(f_reckon_table(i, 5))
                t_len = 0
                For t = 1 To tt_len
                    If Asc((Mid((f_reckon_table(i, 5)), t, 1))) < 0 Then
                        t_len = t_len + 2
                    Else
                        t_len = t_len + 1
                    End If
                Next
                t_len = 12 - t_len
                S1 = ""
                For t = 1 To t_len
                    S1 = S1 & " "
                Next
                S = S & f_reckon_table(i, 5) & S1
                date_string = Round(f_reckon_table(i, 1), 0) & "年"
                If Len(f_reckon_table(i, 2)) = 1 Then
                    date_string = date_string & "0" & Round(f_reckon_table(i, 2), 0) & "月"
                Else
                    date_string = date_string & Round(f_reckon_table(i, 2), 0) & "月"
                End If
                If Len(f_reckon_table(i, 3)) = 1 Then
                    date_string = date_string & "0" & Round(f_reckon_table(i, 3), 0) & "日"
                Else
                    date_string = date_string & Round(f_reckon_table(i, 3), 0) & "日"
                End If
                t_len = 14 - Len(date_string)
                S1 = ""
                For t = 1 To t_len
                    S1 = S1 & " "
                Next
                S = S & date_string & S1
                t_len = 0
                t_value = Round(f_reckon_table(i, 7), 2)
                t_len = 14 - 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
                t_len = 0
                t_value = Round(f_reckon_table(i, 8), 2)
                t_len = 16 - 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 print_sum = True Then
                    t_len = 0
                    t_value = Round(t_sum, 2)
                    t_len = 14 - 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
                    Printer.Print S
                Else
                    Printer.Print S
                End If
                print_sum = False
            End If
        Next
    Next
    Printer.EndDoc
exit_command2_click:
End Sub

Private Sub Command3_Click()
    If List3.ListCount > 0 Then
        For j = List3.ListIndex To List3.ListCount - 2
            List3.List(j) = List3.List(j + 1)
        Next
        List3.RemoveItem (List3.ListCount - 1)
        If List3.ListCount > 0 Then
            List3.ListIndex = 0
        End If
    Else
        MsgBox ("没有数据")
    End If
End Sub

Private Sub Command4_Click()
    t_YesNo = MsgBox("是否确认打印", vbYesNo)
    If t_YesNo = 7 Then
        GoSub exit_command4_click
    End If
    If List3.ListCount = 0 Then
        GoSub exit_command4_click
    End If
    Printer.FontSize = 13
    Printer.FontName = "黑体"
    Printer.Print "帐本号       欠款金额合计     "
    Printer.Print " "
    For Row = 0 To List3.ListCount - 1
        t_sum = 0
        For i = 0 To List1.ListCount - 1
            If List3.List(Row) = f_reckon_table(i, 4) Then
                t_sum = t_sum + f_reckon_table(i, 7) - f_reckon_table(i, 8)
            End If
        Next
        
        S = ""
        tt_len = Len(List3.List(Row))
        t_len = 0
        For t = 1 To tt_len
            If Asc((Mid((List3.List(Row)), 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 & List3.List(Row) & S1
        t_len = 0
        t_value = Round(t_sum, 2)
        t_len = 14 - 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
        Printer.Print S
    Next
    Printer.EndDoc
exit_command4_click:
End Sub

Private Sub Form_Load()
    Dim cnn1 As ADODB.Connection
    Dim cmd1 As ADODB.Command
    Dim rs1 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
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    rs1.MoveFirst
    i = 0
    While Not rs1.EOF
        Combo1.AddItem rs1.Fields(0), i
        rs1.MoveNext
        i = i + 1
    Wend
    Combo1.AddItem "全  部", i
    
    Select Case g_query_method
        Case 1
            Label1.Caption = "已还清欠款查询画面"
            SQL = "select * from 帐单表 where 欠款金额>0 and 欠款金额=还款金额 order by 帐本号,年份,月份,日期"
        Case 2
            Label1.Caption = "未还清欠款查询画面"
            SQL = "select * from 帐单表 where 欠款金额>0 and 欠款金额<>还款金额 order by 帐本号,年份,月份,日期"
    End Select
    With cmd1
        .ActiveConnection = cnn1
        .CommandText = SQL
        .CommandType = adCmdText
    End With
    Set rs1 = cmd1.Execute
    If rs1.EOF Then
        MsgBox ("没有查询到记录")
        cnn1.Close
        Set cnn1 = Nothing
        GoSub exit_form_load
    End If
    j = 0
    rs1.MoveFirst
    While Not rs1.EOF
        S = ""
        For i = 1 To rs1.Fields.Count - 1
            Select Case i
                Case 4, 5
                    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 = 12 - t_len
                    S1 = ""
                    For t = 1 To t_len
                        S1 = S1 & " "
                    Next
                    S = S & rs1.Fields(i).Value & S1
                Case 7, 8
                    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 1
                    date_string = Round(rs1.Fields(1).Value, 0) & "年"
                    If Len(rs1.Fields(2).Value) = 1 Then
                        date_string = date_string & "0" & Round(rs1.Fields(2).Value, 0) & "月"
                    Else
                        date_string = date_string & Round(rs1.Fields(2).Value, 0) & "月"
                    End If
                    If Len(rs1.Fields(3).Value) = 1 Then
                        date_string = date_string & "0" & Round(rs1.Fields(3).Value, 0) & "日"
                    Else
                        date_string = date_string & Round(rs1.Fields(3).Value, 0) & "日"
                    End If
        
                    t_len = 14 - Len(date_string)
                    S1 = ""
                    For t = 1 To t_len
                        S1 = S1 & " "
                    Next
                    S = S & date_string & S1
            End Select
        Next
        List1.AddItem S, j
        f_reckon_table(j, 0) = rs1.Fields(0).Value
        f_reckon_table(j, 1) = rs1.Fields(1).Value
        f_reckon_table(j, 2) = rs1.Fields(2).Value
        f_reckon_table(j, 3) = rs1.Fields(3).Value
        f_reckon_table(j, 4) = rs1.Fields(4).Value
        f_reckon_table(j, 5) = rs1.Fields(5).Value

⌨️ 快捷键说明

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