frm_view_sales.frm

来自「很好一套库存管理」· FRM 代码 · 共 546 行 · 第 1/2 页

FRM
546
字号
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column07 
         DataField       =   "price_per_unit"
         Caption         =   "Rate Per Unit"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column08 
         DataField       =   "P_INVOICE_NO"
         Caption         =   "Purchase Invoice"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column09 
         DataField       =   "P_PARTY_NAME"
         Caption         =   "Purchased From"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column10 
         DataField       =   "P_DATE"
         Caption         =   "Purchase Date"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column11 
         DataField       =   "P_RATE"
         Caption         =   "Purchase Rate"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   1033
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         AllowFocus      =   0   'False
         AllowRowSizing  =   0   'False
         AllowSizing     =   0   'False
         RecordSelectors =   0   'False
         BeginProperty Column00 
            ColumnAllowSizing=   0   'False
            ColumnWidth     =   0
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   1094.74
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   0
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   0
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   1500.095
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   1995.024
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   494.929
         EndProperty
         BeginProperty Column07 
            ColumnWidth     =   1305.071
         EndProperty
         BeginProperty Column08 
            ColumnWidth     =   1604.976
         EndProperty
         BeginProperty Column09 
            ColumnWidth     =   2085.166
         EndProperty
         BeginProperty Column10 
            ColumnWidth     =   2085.166
         EndProperty
         BeginProperty Column11 
            ColumnWidth     =   2085.166
         EndProperty
      EndProperty
   End
   Begin VB.Image Image1 
      Height          =   525
      Left            =   10080
      Picture         =   "frm_view_sales.frx":174D
      Top             =   120
      Width           =   540
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Customer Name"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   6
      Top             =   120
      Width           =   1575
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Invoice Number"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   120
      TabIndex        =   5
      Top             =   600
      Width           =   1575
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Sales Date"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   2
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   1575
   End
End
Attribute VB_Name = "frm_view_sales"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cust_names As New ADODB.Recordset
Dim rs_data As New ADODB.Recordset


Private Sub Combo1_Click(Index As Integer)
If Index = 0 Then
    Dim invoice As New ADODB.Recordset
    invoice.Open "select distinct Invoice_no from Sales_master where Party_name='" & Combo1(0).Text & "'", db, adOpenKeyset, adLockOptimistic
    Combo1(1).Clear
    
    While invoice.EOF <> True
        Combo1(1).AddItem invoice.Fields(0).Value
        invoice.MoveNext
    Wend
    
ElseIf Index = 1 Then
    GETDATA
    Text1.Text = rs_data.Fields(3).Value
End If
End Sub

Private Sub Combo1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If Len(Combo1(Index)) > 0 Then
        SendKeys "{TAB}"
    End If
End If
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 27 Then
    Unload Me
End If
End Sub

Private Sub Form_Load()
KeyPreview = True
Me.Left = 0
Me.Top = 0
cust_names.Open "select distinct Party_name from Sales_master", db, adOpenKeyset, adLockOptimistic

If cust_names.RecordCount = 0 Then
    MsgBox "No Record Found ...", vbInformation, "No Record Found ..."
    Unload Me
    Exit Sub
End If

Combo1(0).Clear

While cust_names.EOF <> True
    Combo1(0).AddItem cust_names.Fields(0).Value
    cust_names.MoveNext
Wend


End Sub

Public Sub GETDATA()
If rs_data.State <> adStateClosed Then
    rs_data.Close
End If
rs_data.CursorLocation = adUseClient
rs_data.Open "select * from Sales_master where Party_name='" & Combo1(0).Text & "' and Invoice_no='" & Combo1(1).Text & "'", db, adOpenKeyset, adLockOptimistic
Set DataGrid1.DataSource = rs_data
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
cust_names.Close
rs_data.Close
Exit Sub
End Sub

Private Sub LaVolpeButton1_Click()
On Error Resume Next
If Len(Text1.Text) > 0 Then
With CrystalReport1
.DataFiles(0) = App.Path & "\Master_Database.mdb"
.ReportFileName = App.Path & "\Report\sales_bill.rpt"
.SelectionFormula = "{Sales_master.Invoice_no} = '" & Combo1(1).Text & "'"
.username = "Admin"
.Password = "1010101010" & Chr(10) & "1010101010"
.Action = 1
End With
Else
    MsgBox "Select Customer name and Invoice Number and then Click on Print Bill Button ....", vbInformation
End If

End Sub

⌨️ 快捷键说明

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