F_LaoWuFeiDengJi.frm
上传用户:xiao_xia32
上传日期:2022-07-21
资源大小:1174k
文件大小:21k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  4. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  5. Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
  6. Begin VB.Form F_LaoWuFeiDengJi 
  7.    BorderStyle     =   3  'Fixed Dialog
  8.    Caption         =   "劳务费登记"
  9.    ClientHeight    =   6270
  10.    ClientLeft      =   1095
  11.    ClientTop       =   330
  12.    ClientWidth     =   9525
  13.    ControlBox      =   0   'False
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form1"
  16.    LockControls    =   -1  'True
  17.    MaxButton       =   0   'False
  18.    MinButton       =   0   'False
  19.    Moveable        =   0   'False
  20.    ScaleHeight     =   6270
  21.    ScaleWidth      =   9525
  22.    StartUpPosition =   2  '屏幕中心
  23.    Begin VB.Frame Frame1 
  24.       Height          =   6015
  25.       Left            =   240
  26.       TabIndex        =   8
  27.       Top             =   120
  28.       Width           =   9135
  29.       Begin TabDlg.SSTab SSTab1 
  30.          Height          =   5415
  31.          Left            =   240
  32.          TabIndex        =   14
  33.          Top             =   360
  34.          Width           =   8655
  35.          _ExtentX        =   15266
  36.          _ExtentY        =   9551
  37.          _Version        =   393216
  38.          Tabs            =   2
  39.          TabHeight       =   520
  40.          TabCaption(0)   =   "编辑"
  41.          TabPicture(0)   =   "F_LaoWuFeiDengJi.frx":0000
  42.          Tab(0).ControlEnabled=   -1  'True
  43.          Tab(0).Control(0)=   "Frame2"
  44.          Tab(0).Control(0).Enabled=   0   'False
  45.          Tab(0).Control(1)=   "picButtons"
  46.          Tab(0).Control(1).Enabled=   0   'False
  47.          Tab(0).ControlCount=   2
  48.          TabCaption(1)   =   "列表"
  49.          TabPicture(1)   =   "F_LaoWuFeiDengJi.frx":001C
  50.          Tab(1).ControlEnabled=   0   'False
  51.          Tab(1).Control(0)=   "Frame4"
  52.          Tab(1).ControlCount=   1
  53.          Begin VB.Frame Frame4 
  54.             Height          =   4695
  55.             Left            =   -74760
  56.             TabIndex        =   24
  57.             Top             =   480
  58.             Width           =   8175
  59.             Begin MSDataGridLib.DataGrid DataGrid1 
  60.                Height          =   4095
  61.                Left            =   240
  62.                TabIndex        =   26
  63.                Top             =   360
  64.                Width           =   7695
  65.                _ExtentX        =   13573
  66.                _ExtentY        =   7223
  67.                _Version        =   393216
  68.                HeadLines       =   1
  69.                RowHeight       =   14
  70.                BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  71.                   Name            =   "MS Sans Serif"
  72.                   Size            =   8.25
  73.                   Charset         =   0
  74.                   Weight          =   400
  75.                   Underline       =   0   'False
  76.                   Italic          =   0   'False
  77.                   Strikethrough   =   0   'False
  78.                EndProperty
  79.                BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  80.                   Name            =   "宋体"
  81.                   Size            =   9
  82.                   Charset         =   134
  83.                   Weight          =   400
  84.                   Underline       =   0   'False
  85.                   Italic          =   0   'False
  86.                   Strikethrough   =   0   'False
  87.                EndProperty
  88.                ColumnCount     =   2
  89.                BeginProperty Column00 
  90.                   DataField       =   ""
  91.                   Caption         =   ""
  92.                   BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  93.                      Type            =   0
  94.                      Format          =   ""
  95.                      HaveTrueFalseNull=   0
  96.                      FirstDayOfWeek  =   0
  97.                      FirstWeekOfYear =   0
  98.                      LCID            =   2052
  99.                      SubFormatType   =   0
  100.                   EndProperty
  101.                EndProperty
  102.                BeginProperty Column01 
  103.                   DataField       =   ""
  104.                   Caption         =   ""
  105.                   BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  106.                      Type            =   0
  107.                      Format          =   ""
  108.                      HaveTrueFalseNull=   0
  109.                      FirstDayOfWeek  =   0
  110.                      FirstWeekOfYear =   0
  111.                      LCID            =   2052
  112.                      SubFormatType   =   0
  113.                   EndProperty
  114.                EndProperty
  115.                SplitCount      =   1
  116.                BeginProperty Split0 
  117.                   BeginProperty Column00 
  118.                   EndProperty
  119.                   BeginProperty Column01 
  120.                   EndProperty
  121.                EndProperty
  122.             End
  123.          End
  124.          Begin VB.PictureBox picButtons 
  125.             Appearance      =   0  'Flat
  126.             BorderStyle     =   0  'None
  127.             ForeColor       =   &H80000008&
  128.             Height          =   420
  129.             Left            =   2040
  130.             ScaleHeight     =   420
  131.             ScaleWidth      =   6480
  132.             TabIndex        =   23
  133.             Top             =   4680
  134.             Width           =   6480
  135.             Begin Threed.SSCommand cmdAdd 
  136.                Height          =   325
  137.                Left            =   480
  138.                TabIndex        =   9
  139.                Top             =   0
  140.                Width           =   1095
  141.                _Version        =   65536
  142.                _ExtentX        =   1931
  143.                _ExtentY        =   573
  144.                _StockProps     =   78
  145.                Caption         =   "&A.增 加"
  146.                Font3D          =   3
  147.             End
  148.             Begin Threed.SSCommand cmdEdit 
  149.                Height          =   325
  150.                Left            =   1680
  151.                TabIndex        =   10
  152.                Top             =   0
  153.                Width           =   1095
  154.                _Version        =   65536
  155.                _ExtentX        =   1931
  156.                _ExtentY        =   573
  157.                _StockProps     =   78
  158.                Caption         =   "&E.编 辑"
  159.                Font3D          =   3
  160.             End
  161.             Begin Threed.SSCommand cmdDelete 
  162.                Height          =   325
  163.                Left            =   2880
  164.                TabIndex        =   11
  165.                Top             =   0
  166.                Width           =   1095
  167.                _Version        =   65536
  168.                _ExtentX        =   1931
  169.                _ExtentY        =   573
  170.                _StockProps     =   78
  171.                Caption         =   "&S.删 除"
  172.                Font3D          =   3
  173.             End
  174.             Begin Threed.SSCommand cmdRefresh 
  175.                Height          =   325
  176.                Left            =   4080
  177.                TabIndex        =   27
  178.                Top             =   0
  179.                Width           =   1095
  180.                _Version        =   65536
  181.                _ExtentX        =   1931
  182.                _ExtentY        =   573
  183.                _StockProps     =   78
  184.                Caption         =   "&R.刷 新"
  185.                Font3D          =   3
  186.             End
  187.             Begin Threed.SSCommand cmdUpdate 
  188.                Height          =   300
  189.                Left            =   4080
  190.                TabIndex        =   12
  191.                Top             =   0
  192.                Width           =   1095
  193.                _Version        =   65536
  194.                _ExtentX        =   1931
  195.                _ExtentY        =   529
  196.                _StockProps     =   78
  197.                Caption         =   "&Y.保存"
  198.                Font3D          =   3
  199.             End
  200.             Begin Threed.SSCommand cmdClose 
  201.                Height          =   325
  202.                Left            =   5280
  203.                TabIndex        =   28
  204.                Top             =   0
  205.                Width           =   1095
  206.                _Version        =   65536
  207.                _ExtentX        =   1931
  208.                _ExtentY        =   573
  209.                _StockProps     =   78
  210.                Caption         =   "&Q.关 闭"
  211.                Font3D          =   3
  212.             End
  213.             Begin Threed.SSCommand cmdCancel 
  214.                Height          =   300
  215.                Left            =   5280
  216.                TabIndex        =   13
  217.                Top             =   0
  218.                Width           =   1095
  219.                _Version        =   65536
  220.                _ExtentX        =   1931
  221.                _ExtentY        =   529
  222.                _StockProps     =   78
  223.                Caption         =   "&C.取消"
  224.                Font3D          =   3
  225.             End
  226.          End
  227.          Begin VB.Frame Frame2 
  228.             Height          =   3855
  229.             Left            =   480
  230.             TabIndex        =   15
  231.             Top             =   480
  232.             Width           =   7935
  233.             Begin VB.ComboBox Combo1 
  234.                Appearance      =   0  'Flat
  235.                DataField       =   "所属部门"
  236.                Height          =   300
  237.                Left            =   1560
  238.                TabIndex        =   2
  239.                Top             =   1320
  240.                Width           =   2055
  241.             End
  242.             Begin MSComCtl2.DTPicker DTPicker1 
  243.                DataField       =   "时间"
  244.                Height          =   300
  245.                Left            =   1560
  246.                TabIndex        =   0
  247.                Top             =   600
  248.                Width           =   2055
  249.                _ExtentX        =   3625
  250.                _ExtentY        =   529
  251.                _Version        =   393216
  252.                CheckBox        =   -1  'True
  253.                DateIsNull      =   -1  'True
  254.                Format          =   69795841
  255.                CurrentDate     =   36187
  256.             End
  257.             Begin VB.TextBox txtFields 
  258.                Appearance      =   0  'Flat
  259.                DataField       =   "实发金额"
  260.                Enabled         =   0   'False
  261.                Height          =   285
  262.                Index           =   6
  263.                Left            =   5280
  264.                TabIndex        =   7
  265.                Top             =   2640
  266.                Width           =   2055
  267.             End
  268.             Begin VB.TextBox txtFields 
  269.                Appearance      =   0  'Flat
  270.                DataField       =   "个人税"
  271.                Height          =   285
  272.                Index           =   5
  273.                Left            =   1560
  274.                TabIndex        =   6
  275.                Top             =   2640
  276.                Width           =   2055
  277.             End
  278.             Begin VB.TextBox txtFields 
  279.                Appearance      =   0  'Flat
  280.                DataField       =   "税率"
  281.                Height          =   285
  282.                Index           =   4
  283.                Left            =   5280
  284.                TabIndex        =   5
  285.                Top             =   2040
  286.                Width           =   2055
  287.             End
  288.             Begin VB.TextBox txtFields 
  289.                Appearance      =   0  'Flat
  290.                DataField       =   "税前工资"
  291.                Height          =   285
  292.                Index           =   3
  293.                Left            =   1560
  294.                TabIndex        =   4
  295.                Top             =   2040
  296.                Width           =   2055
  297.             End
  298.             Begin VB.TextBox txtFields 
  299.                Appearance      =   0  'Flat
  300.                DataField       =   "人数"
  301.                Height          =   285
  302.                Index           =   2
  303.                Left            =   5280
  304.                TabIndex        =   3
  305.                Top             =   1320
  306.                Width           =   2055
  307.             End
  308.             Begin VB.TextBox txtFields 
  309.                Appearance      =   0  'Flat
  310.                DataField       =   "项目"
  311.                Height          =   285
  312.                Index           =   1
  313.                Left            =   5280
  314.                TabIndex        =   1
  315.                Top             =   600
  316.                Width           =   2055
  317.             End
  318.             Begin VB.Label lblLabels 
  319.                Caption         =   "所属部门"
  320.                Height          =   255
  321.                Index           =   7
  322.                Left            =   360
  323.                TabIndex        =   25
  324.                Top             =   1320
  325.                Width           =   975
  326.             End
  327.             Begin VB.Label lblLabels 
  328.                Caption         =   "实发金额"
  329.                Height          =   255
  330.                Index           =   6
  331.                Left            =   4320
  332.                TabIndex        =   22
  333.                Top             =   2640
  334.                Width           =   855
  335.             End
  336.             Begin VB.Label lblLabels 
  337.                Caption         =   "个人税"
  338.                Height          =   255
  339.                Index           =   5
  340.                Left            =   360
  341.                TabIndex        =   21
  342.                Top             =   2640
  343.                Width           =   1815
  344.             End
  345.             Begin VB.Label lblLabels 
  346.                Caption         =   "税  率"
  347.                Height          =   255
  348.                Index           =   4
  349.                Left            =   4320
  350.                TabIndex        =   20
  351.                Top             =   2040
  352.                Width           =   735
  353.             End
  354.             Begin VB.Label lblLabels 
  355.                Caption         =   "税前工资"
  356.                Height          =   255
  357.                Index           =   3
  358.                Left            =   360
  359.                TabIndex        =   19
  360.                Top             =   2040
  361.                Width           =   975
  362.             End
  363.             Begin VB.Label lblLabels 
  364.                Caption         =   "人  数"
  365.                Height          =   255
  366.                Index           =   2
  367.                Left            =   4320
  368.                TabIndex        =   18
  369.                Top             =   1320
  370.                Width           =   975
  371.             End
  372.             Begin VB.Label lblLabels 
  373.                Caption         =   "项  目"
  374.                Height          =   255
  375.                Index           =   1
  376.                Left            =   4320
  377.                TabIndex        =   17
  378.                Top             =   600
  379.                Width           =   1815
  380.             End
  381.             Begin VB.Label lblLabels 
  382.                Caption         =   "时  间"
  383.                Height          =   255
  384.                Index           =   0
  385.                Left            =   360
  386.                TabIndex        =   16
  387.                Top             =   600
  388.                Width           =   1815
  389.             End
  390.          End
  391.       End
  392.    End
  393. End
  394. Attribute VB_Name = "F_LaoWuFeiDengJi"
  395. Attribute VB_GlobalNameSpace = False
  396. Attribute VB_Creatable = False
  397. Attribute VB_PredeclaredId = True
  398. Attribute VB_Exposed = False
  399. Dim WithEvents adoPrimaryRS As Recordset
  400. Attribute adoPrimaryRS.VB_VarHelpID = -1
  401. Dim mvBookMark As Variant
  402. Dim mbEditFlag As Boolean
  403. Dim mbAddNewFlag As Boolean
  404. Private Sub Combo1_KeyPress(KeyAscii As Integer)
  405. If KeyAscii = vbKeyReturn Then
  406.     SendKeys "{TAB}"
  407. End If
  408. End Sub
  409. Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
  410. If KeyAscii = vbKeyReturn Then
  411.     SendKeys "{TAB}"
  412. End If
  413. End Sub
  414. Private Sub Form_Load()
  415. On Error Resume Next
  416.     For Each TextBox In Me.Controls
  417.         TextBox.Font.Name = "宋体"
  418.         TextBox.Font.Size = 9
  419.     Next
  420. Dim SqlBuMen As String
  421.   Set adoPrimaryRS = New Recordset
  422.   adoPrimaryRS.Open "select * from 劳务费登记", db, adOpenStatic, adLockOptimistic
  423.   Set DataGrid1.DataSource = adoPrimaryRS
  424.   
  425.   SetButtons True
  426.   
  427.  Set DTPicker1.DataSource = adoPrimaryRS
  428.   
  429.   Dim oText As TextBox
  430.   'Bind the text boxes to the data provider
  431.   For Each oText In Me.txtFields
  432.     Set oText.DataSource = adoPrimaryRS
  433.   Next
  434.   
  435.   Set DTPicker1.DataSource = adoPrimaryRS
  436.   Set Combo1.DataSource = adoPrimaryRS
  437.   
  438.   SqlBuMen = "select  distinct 部门名称 from 部门维护表"
  439.   Set RsBuMen = db.Execute(SqlBuMen)
  440.    
  441.   While Not RsBuMen.EOF
  442.      Combo1.AddItem Trim(RsBuMen("部门名称"))
  443.     RsBuMen.MoveNext
  444.   Wend
  445. End Sub
  446. Private Sub Form_Unload(Cancel As Integer)
  447.   Screen.MousePointer = vbDefault
  448. End Sub
  449. Private Sub cmdAdd_Click()
  450.   On Error GoTo AddErr
  451.   With adoPrimaryRS
  452.     If Not (.BOF And .EOF) Then
  453.       mvBookMark = .Bookmark
  454.     End If
  455.     .AddNew
  456.     mbAddNewFlag = True
  457.     SetButtons False
  458.   End With
  459.   On Error GoTo 0
  460.   Exit Sub
  461. AddErr:
  462.   MsgBox "增加操作有错误", vbExclamation + vbOKOnly, pTitle
  463.   
  464. End Sub
  465. Private Sub cmdDelete_Click()
  466.   On Error GoTo DeleteErr
  467.   If MsgBox("确认是否删除劳务费记录?", vbYesNo + vbQuestion, "系统提示") = vbNo Then Exit Sub
  468.   With adoPrimaryRS
  469.     .Delete
  470.     .MoveNext
  471.     If .EOF Then .MoveLast
  472.   End With
  473.   Exit Sub
  474. DeleteErr:
  475.   MsgBox "删除操作有错误", vbExclamation + vbOKOnly, pTitle
  476. End Sub
  477. Private Sub cmdRefresh_Click()
  478.   'This is only needed for multi user apps
  479.   On Error GoTo RefreshErr
  480.   adoPrimaryRS.Requery
  481.   On Error GoTo 0
  482.   Exit Sub
  483. RefreshErr:
  484.    MsgBox "刷新操作有错误", vbExclamation + vbOKOnly, pTitle
  485. End Sub
  486. Private Sub cmdEdit_Click()
  487.   On Error GoTo EditErr
  488.   mbEditFlag = True
  489.   SetButtons False
  490.   On Error GoTo 0
  491.   Exit Sub
  492. EditErr:
  493.    MsgBox "更改操作有错误", vbExclamation + vbOKOnly, pTitle
  494. End Sub
  495. Private Sub cmdCancel_Click()
  496.  ' On Error Resume Next
  497.  On Error GoTo CancelErr
  498.   mbEditFlag = False
  499.   mbAddNewFlag = False
  500.   adoPrimaryRS.CancelUpdate
  501.   If mvBookMark > 0 Then
  502.    adoPrimaryRS.Bookmark = mvBookMark
  503.   Else
  504.     If Len(mvBookMark) = 0 Then Exit Sub
  505.    adoPrimaryRS.MoveFirst
  506.   End If
  507.  SetButtons True
  508.  On Error GoTo 0
  509.   Exit Sub
  510. CancelErr:
  511.    
  512.    MsgBox "取消操作有错误", vbExclamation + vbOKOnly, pTitle
  513. End Sub
  514. Private Sub cmdUpdate_Click()
  515.   On Error GoTo UpdateErr
  516.   If MsgBox("是否确认此操作?", vbYesNo + vbQuestion, "系统提示") = vbNo Then Exit Sub
  517.   adoPrimaryRS.UpdateBatch adAffectAll
  518.   If mbAddNewFlag Then
  519.     adoPrimaryRS.MoveLast              'move to the new record
  520.   End If
  521.   mbEditFlag = False
  522.   mbAddNewFlag = False
  523.   SetButtons True
  524.   On Error GoTo 0
  525.   Exit Sub
  526. UpdateErr:
  527.    MsgBox "保存操作有错误", vbExclamation + vbOKOnly, pTitle
  528. End Sub
  529. Private Sub cmdClose_Click()
  530.   RSGL.Enabled = True
  531.   Unload Me
  532. End Sub
  533. Private Sub SetButtons(bVal As Boolean)
  534.   CmdAdd.Visible = bVal
  535.   cmdEdit.Visible = bVal
  536.   cmdUpdate.Visible = Not bVal
  537.   cmdCancel.Visible = Not bVal
  538.   CmdDelete.Visible = bVal
  539.   cmdClose.Visible = bVal
  540.   cmdRefresh.Visible = bVal
  541.   If bVal Then
  542.    Set DataGrid1.DataSource = adoPrimaryRS
  543.   Else
  544.    Set DataGrid1.DataSource = Nothing
  545.   End If
  546.   
  547.    Dim oText As TextBox
  548.   'Bind the text boxes to the data provider
  549.   For Each oText In Me.txtFields
  550.     oText.Enabled = Not bVal
  551.   Next
  552.   
  553.   DTPicker1.Enabled = Not bVal
  554. End Sub
  555. Private Sub txtFields_Change(Index As Integer)
  556.   If IsNumeric(txtFields(3).Text) And IsNumeric(txtFields(5).Text) Then
  557.    txtFields(6) = CDbl(txtFields(3)) - CDbl(txtFields(5))
  558.   End If
  559.   
  560. End Sub
  561. Private Sub txtFields_KeyPress(Index As Integer, KeyAscii As Integer)
  562. If KeyAscii = vbKeyReturn Then
  563.     SendKeys "{TAB}"
  564. End If
  565. End Sub
  566. Private Sub txtFields_LostFocus(Index As Integer)
  567. If Not IsNumeric(txtFields(2).Text) And (txtFields(2).Text <> "") Then
  568.     MsgBox "请在“人数”中输入数字", vbExclamation + vbOKOnly, pTitle
  569.      txtFields(2).SetFocus
  570.      txtFields(2).SelLength = Len(txtFields(2))
  571.      txtFields(2).SelStart = 0
  572. End If
  573. If Not IsNumeric(txtFields(3).Text) And (txtFields(3).Text <> "") Then
  574.     MsgBox "请在“税前工资”中输入数字", vbExclamation + vbOKOnly, pTitle
  575.      txtFields(3).SetFocus
  576.      txtFields(3).SelLength = Len(txtFields(3))
  577.      txtFields(3).SelStart = 0
  578. End If
  579. If Not IsNumeric(txtFields(4).Text) And (txtFields(4).Text <> "") Then
  580.     MsgBox "请在“税率”中输入数字", vbExclamation + vbOKOnly, pTitle
  581.      txtFields(4).SetFocus
  582.      txtFields(4).SelLength = Len(txtFields(4))
  583.      txtFields(4).SelStart = 0
  584. End If
  585. If Not IsNumeric(txtFields(5).Text) And (txtFields(5).Text <> "") Then
  586.     MsgBox "请在“个人税”中输入数字", vbExclamation + vbOKOnly, pTitle
  587.      txtFields(5).SetFocus
  588.      txtFields(5).SelLength = Len(txtFields(5))
  589.      txtFields(5).SelStart = 0
  590. End If
  591. End Sub