开票情况录入.frm

来自「本软件为咨询公司开发的合同管理软件,运用MDB数据库.」· FRM 代码 · 共 346 行

FRM
346
字号
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form 开票情况录入 
   Caption         =   "项目单位:"
   ClientHeight    =   5415
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10935
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   12
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H8000000D&
   Icon            =   "开票情况录入.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   5415
   ScaleWidth      =   10935
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Combo3 
      Height          =   360
      Left            =   5760
      TabIndex        =   18
      Top             =   360
      Width           =   2295
   End
   Begin VB.ComboBox Combo2 
      Height          =   360
      Left            =   5760
      TabIndex        =   17
      Top             =   960
      Width           =   2295
   End
   Begin VB.ComboBox Combo1 
      Height          =   360
      Left            =   5760
      TabIndex        =   16
      Top             =   2160
      Width           =   2295
   End
   Begin MSComCtl2.DTPicker DTP1 
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "gg yy/MM/dd"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   3
      EndProperty
      Height          =   375
      Left            =   1680
      TabIndex        =   15
      Top             =   960
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   661
      _Version        =   393216
      Format          =   23855105
      CurrentDate     =   39418
   End
   Begin VB.TextBox Text7 
      Height          =   375
      Left            =   1680
      TabIndex        =   14
      Top             =   2160
      Width           =   2295
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   5760
      TabIndex        =   13
      Top             =   1560
      Width           =   2295
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1680
      TabIndex        =   12
      Top             =   1560
      Width           =   2295
   End
   Begin MSFlexGridLib.MSFlexGrid Grid1 
      Height          =   2535
      Left            =   120
      TabIndex        =   4
      Top             =   2880
      Width           =   10815
      _ExtentX        =   19076
      _ExtentY        =   4471
      _Version        =   393216
      Cols            =   9
      BackColorFixed  =   12648447
   End
   Begin VB.CommandButton Command2 
      Caption         =   "返   回"
      Height          =   375
      Left            =   9000
      TabIndex        =   3
      Top             =   1680
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确  定"
      Height          =   375
      Left            =   9000
      TabIndex        =   2
      Top             =   720
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1680
      TabIndex        =   0
      Top             =   360
      Width           =   2295
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   4200
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3720
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.Label Label8 
      Caption         =   "开票情况:"
      Height          =   375
      Left            =   4560
      TabIndex        =   11
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label7 
      Caption         =   "开 票 人:"
      Height          =   375
      Left            =   480
      TabIndex        =   10
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label6 
      Caption         =   "票    号:"
      Height          =   375
      Left            =   4560
      TabIndex        =   9
      Top             =   1560
      Width           =   1335
   End
   Begin VB.Label Label5 
      Caption         =   "开票金额:"
      Height          =   375
      Left            =   480
      TabIndex        =   8
      Top             =   1560
      Width           =   1335
   End
   Begin VB.Label Label4 
      Caption         =   "开票种类:"
      Height          =   375
      Left            =   4560
      TabIndex        =   7
      Top             =   960
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "开票日期:"
      Height          =   375
      Left            =   480
      TabIndex        =   6
      Top             =   960
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "部    门:"
      Height          =   375
      Left            =   4560
      TabIndex        =   5
      Top             =   360
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   "合同编号:"
      Height          =   375
      Left            =   480
      TabIndex        =   1
      Top             =   360
      Width           =   1335
   End
End
Attribute VB_Name = "开票情况录入"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db1 As ADODB.Connection
Dim db2 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim sqlcx As String
Dim i As String * 2

Private Sub Command1_Click()
 
If Trim(Text1.Text = "") Or Trim(Combo3.Text = "") Or Trim(Combo2.Text = "") Or Trim(Text5.Text = "") Or Trim(Text6.Text = "") Or Trim(Text7.Text = "") Or Trim(Combo1.Text = "") Then
 MsgBox "录入的项目不能为空,请检查!!", vbOKOnly, "提示信息!!"
Else
 aa = MsgBox("你输入的数据正确吗?, 真的要保存数据吗?", vbYesNo, "保存按是, 否则按否!")

 
 If aa = 6 Then
 i = i + 1
 Grid1.Rows = Grid1.Rows + 1
 Data1.Recordset.AddNew
 Data1.Recordset.Fields(0) = Trim(Text1.Text)
 Data1.Recordset.Fields(1) = Trim(Combo3.Text)
 Data1.Recordset.Fields(2) = CStr(Format(DTP1.Value, "yy-mm-dd"))
 Data1.Recordset.Fields(3) = Trim(Combo2.Text)
 Data1.Recordset.Fields(4) = Trim(Text6.Text)
 Data1.Recordset.Fields(5) = Trim(Text7.Text)
 Data1.Recordset.Fields(6) = Trim(Combo1.Text)
 Data1.Recordset.Fields(7) = Trim(Text5.Text)
 Data1.Recordset.Update
 Grid1.TextMatrix(i, 1) = Trim(Text1.Text)
 Grid1.TextMatrix(i, 2) = Trim(Combo3.Text)
 Grid1.TextMatrix(i, 3) = CStr(Format(DTP1.Value, "yy-mm-dd"))
 Grid1.TextMatrix(i, 4) = Trim(Combo2.Text)
 Grid1.TextMatrix(i, 5) = Trim(Text5.Text)
 Grid1.TextMatrix(i, 6) = Trim(Text6.Text)
 Grid1.TextMatrix(i, 7) = Trim(Text7.Text)
 Grid1.TextMatrix(i, 8) = Trim(Combo1.Text)
 Text1.Text = ""
 Combo3.Text = ""
 Combo2.Text = ""
 Text5.Text = ""
 Text6.Text = ""
 Text7.Text = ""
 Combo1.Text = ""
  End If
End If

End Sub

Private Sub Command2_Click()
On orrer GoTo aa
'rs1.Close
'rs1.ActiveConnection = Nothing
'db1.Close
'Data1.Recordset.Close
Unload Me
aa:
Exit Sub
End Sub

Private Sub Command2_LostFocus()
'aa = MsgBox("你输入的合同号不存在, 你要重新输入吗?", vbYesNo, "重新输入按是, 否则按否!")
'If aa <> 6 Then
rs1.Close
rs1.ActiveConnection = Nothing
Data1.Recordset.Close
Unload Me
'End If

End Sub

Private Sub Form_Load()
Combo1.AddItem "第一笔"
Combo1.AddItem "第二笔"
Combo1.AddItem "第三笔"
Combo2.AddItem "增票"
Combo2.AddItem "普票"
Combo2.AddItem "收据"
Combo3.AddItem "本部"
Combo3.AddItem "丁部"
Combo3.AddItem "郭部"
Combo3.AddItem "王部"



'dblj = "c:\htgl\data\htxxk.mdb"
Set db2 = New ADODB.Connection
Set rs2 = New ADODB.Recordset
db2.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & dblj & ";Persist Security Info=False"
rs2.Open "开票情况表", db2
Data1.DatabaseName = dblj
Data1.RecordSource = "开票情况表"
    Grid1.ColWidth(0) = 0
    Grid1.ColWidth(1) = 800
    Grid1.ColWidth(2) = 1900
    Grid1.ColWidth(3) = 1200
    Grid1.ColWidth(4) = 1200
    Grid1.ColWidth(5) = 1300
    Grid1.ColWidth(6) = 1200
    Grid1.ColWidth(7) = 1200
    Grid1.ColWidth(8) = 1850
    Grid1.Rows = 2
    Grid1.TextMatrix(0, 1) = "编  号"
    Grid1.TextMatrix(0, 2) = "   部    门"

    Grid1.TextMatrix(0, 3) = " 开票日期"
    Grid1.TextMatrix(0, 4) = " 开票种类"
    Grid1.TextMatrix(0, 5) = " 开票金额"
    Grid1.TextMatrix(0, 6) = " 票  号"
    Grid1.TextMatrix(0, 7) = " 开票人"
    Grid1.TextMatrix(0, 8) = "  开票情况"
    i = 0
    
    DTP1.Value = Date

End Sub

Private Sub Text1_LostFocus()
Set db1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
db1.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & dblj & ";Persist Security Info=False"
sqlcx = "select * from  合同信息表 where 编号 = " & "'" & Trim(Text1.Text) & "'"
rs1.Open sqlcx, db1, adOpenKeyset, adLockBatchOptimistic
If rs1.EOF Then
aa = MsgBox("你输入的合同号不存在, 请重新输入", vbOKOnly)
开票情况录入.Caption = "项目单位名称:"
'Text1.Text = ""
Text1.SetFocus

Else

开票情况录入.Caption = ""
开票情况录入.Caption = "项目单位名称:" & 开票情况录入.Caption & rs1!单位名称 & "     签约人:" & rs1!签约人
End If

End Sub

⌨️ 快捷键说明

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