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

📄 frmsysyb.frm

📁 广翔税务代理版打印,能制作非常复杂的报表.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
Next i

MsgBox "您已经成功保存企业" & frmqy.qybm & "累计数", vbOKOnly + vbCritical, "成功保存!"

End Sub

Private Sub Form_Load()
Text2 = frmqy.qymc
DTPicker1 = Date
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Grid1.TextMatrix(0, 0) = "         项           目"
Grid1.TextMatrix(0, 1) = "   行数"
Grid1.TextMatrix(0, 2) = "        本月数"
Grid1.TextMatrix(0, 3) = "      本年累计数"
Grid1.TextMatrix(1, 0) = "一、产品销售收入"
Grid1.TextMatrix(1, 1) = "     1"
Grid1.TextMatrix(2, 0) = "    减:销售折扣与折让"
Grid1.TextMatrix(2, 1) = "     2"
Grid1.TextMatrix(3, 0) = "    商品销售收入净额"
Grid1.TextMatrix(3, 1) = "     3"
Grid1.TextMatrix(4, 0) = "    减:商品销售成本"
Grid1.TextMatrix(4, 1) = "     4"
Grid1.TextMatrix(5, 0) = "        经营费用"
Grid1.TextMatrix(5, 1) = "     5"
Grid1.TextMatrix(6, 0) = "        商品销售税金及附加"
Grid1.TextMatrix(6, 1) = "     6"
Grid1.TextMatrix(7, 0) = "二、商品销售利润"
Grid1.TextMatrix(7, 1) = "     7"
Grid1.TextMatrix(8, 0) = "    加:代购代销收入"
Grid1.TextMatrix(8, 1) = "     8"
Grid1.TextMatrix(9, 0) = "三、主营业务利润"
Grid1.TextMatrix(9, 1) = "     9"
Grid1.TextMatrix(10, 0) = "    加:其他业务利润"
Grid1.TextMatrix(10, 1) = "    10"
Grid1.TextMatrix(11, 0) = "    减:管理费用"
Grid1.TextMatrix(11, 1) = "    11"
Grid1.TextMatrix(12, 0) = "        财务费用"
Grid1.TextMatrix(12, 1) = "    12"
Grid1.TextMatrix(13, 0) = "        汇兑损失(亏损以“-”号表示)"
Grid1.TextMatrix(13, 1) = "    13"
Grid1.TextMatrix(14, 0) = "四、营业利润"
Grid1.TextMatrix(14, 1) = "    14"
Grid1.TextMatrix(15, 0) = "    加:投资收益(亏损以“-”号表示)"
Grid1.TextMatrix(15, 1) = "    15"
Grid1.TextMatrix(16, 0) = "        补贴收入"
Grid1.TextMatrix(16, 1) = "    16"
Grid1.TextMatrix(17, 0) = "        营业外收入"
Grid1.TextMatrix(17, 1) = "    17"
Grid1.TextMatrix(18, 0) = "    减:营业外支出"
Grid1.TextMatrix(18, 1) = "    18"
Grid1.TextMatrix(19, 0) = "    加:以前年度损益调整"
Grid1.TextMatrix(19, 1) = "    19"
Grid1.TextMatrix(20, 0) = "五、利润总额(亏损以“-”号表示)"
Grid1.TextMatrix(20, 1) = "    20"
Grid1.TextMatrix(21, 0) = "    减:所得税"
Grid1.TextMatrix(21, 1) = "    21"
Grid1.TextMatrix(22, 0) = "六、净利润(亏损以“-”号表示)"
Grid1.TextMatrix(22, 1) = "    22"
Grid1.TextStyleFixed = flexTextFlat
Grid1.ColWidth(0) = (Grid1.Width / 4) + 1150
    Grid1.ColWidth(1) = (Grid1.Width / 4) - 1200
    Grid1.ColWidth(2) = (Grid1.Width / 4) - 25
    Grid1.ColWidth(3) = (Grid1.Width / 4) - 25
For i = 1 To 22
Grid1.TextMatrix(i, 2) = Format(0, "###0.00")
Grid1.TextMatrix(i, 3) = Format(0, "###0.00")
    Next i
Grid1.Row = 3
Grid1.Col = 3
'Grid1.CellForeColor = vbRed
'Grid1.CellType = 2
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 3
Grid1.Col = 2
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 7
Grid1.Col = 2
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 7
Grid1.Col = 3
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 9
Grid1.Col = 2
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 9
Grid1.Col = 3
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 14
Grid1.Col = 2
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 14
Grid1.Col = 3
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 20
Grid1.Col = 2
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 20
Grid1.Col = 3
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 22
Grid1.Col = 2
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
Grid1.Row = 22
Grid1.Col = 3
'Grid1.CellForeColor = vbRed
Grid1.CellBackColor = &HE0E0E0
LoadLeiJi
End Sub

Private Sub Grid1_DblClick()
' Move the text box to the current grid cell:
Text1.Top = Grid1.CellTop + Grid1.Top
Text1.Left = Grid1.CellLeft + Grid1.Left
' Save the position of the grids Row and Col for later:
gRow = Grid1.Row
gCol = Grid1.Col
If gRow = 3 And gCol = 2 Then Exit Sub
If gRow = 3 And gCol = 3 Then Exit Sub
If gRow = 7 And gCol = 2 Then Exit Sub
If gRow = 7 And gCol = 3 Then Exit Sub
If gRow = 9 And gCol = 2 Then Exit Sub
If gRow = 9 And gCol = 3 Then Exit Sub
If gRow = 14 And gCol = 2 Then Exit Sub
If gRow = 14 And gCol = 3 Then Exit Sub
If gRow = 20 And gCol = 2 Then Exit Sub
If gRow = 20 And gCol = 3 Then Exit Sub
If gRow = 22 And gCol = 2 Then Exit Sub
If gRow = 22 And gCol = 3 Then Exit Sub

' Make text box same size as current grid cell:
Text1.Width = Grid1.CellWidth '- 2 * Screen.TwipsPerPixelX
Text1.Height = Grid1.CellHeight ' - 2 * Screen.TwipsPerPixelY
' Transfer the grid cell text:
Text1.Text = Grid1.Text
' Show the text box:
Text1.Visible = True
Text1.ZOrder 0 ' 把 Text1 放到最前面!
Text1.SetFocus
' Redirect this KeyPress event to the text box:
If KeyAscii <> ASC_ENTER Then
SendKeys Chr$(KeyAscii)
End If
End Sub

Private Sub Grid1_KeyPress(KeyAscii As Integer)
Call Grid1_DblClick
End Sub

Private Sub Text1_GotFocus()
 Text1.SelStart = 0
    Text1.SelLength = Len(Text1)
End Sub

'6 增加代码到 Text1_KeyPress 过程:

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = ASC_ENTER Then
Grid1.SetFocus ' Set focus back to grid, see Text_LostFocus.
KeyAscii = 0 ' Ignore this KeyPress.
End If
 If KeyAscii <> 8 And KeyAscii <> 45 And KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 57 Then
       ' 'Beep
KeyAscii = 0
    End If
End Sub

'7 增加代码到 Text1_LostFocus 过程:

Private Sub Text1_LostFocus()
On Error GoTo errorhandler
Dim tmpRow As Integer
Dim tmpCol As Integer
' Save current settings of Grid Row and col. This is needed only if
' the focus is set somewhere else in the Grid.
tmpRow = Grid1.Row
tmpCol = Grid1.Col
' Set Row and Col back to what they were before Text1_LostFocus:
Grid1.Row = gRow
Grid1.Col = gCol
Grid1.Text = Format(Val(Text1.Text), "###0.00") ' Transfer text back to grid.
Text1.SelStart = 0 ' Return caret to beginning.
Text1.Visible = False ' Disable text box.
' Return row and Col contents:
Grid1.Row = tmpRow
Grid1.Col = tmpCol
Grid1.TextMatrix(3, 2) = Format(Val(Grid1.TextMatrix(1, 2)) - Val(Grid1.TextMatrix(2, 2)), "###0.00")
Grid1.TextMatrix(3, 3) = Format(Val(Grid1.TextMatrix(1, 3)) - Val(Grid1.TextMatrix(2, 3)), "###0.00")
Grid1.TextMatrix(7, 3) = Format(Val(Grid1.TextMatrix(3, 3)) - Val(Grid1.TextMatrix(4, 3)) - Val(Grid1.TextMatrix(5, 3)) - Val(Grid1.TextMatrix(6, 3)), "###0.00")
Grid1.TextMatrix(7, 2) = Format(Val(Grid1.TextMatrix(3, 2)) - Val(Grid1.TextMatrix(4, 2)) - Val(Grid1.TextMatrix(5, 2)) - Val(Grid1.TextMatrix(6, 2)), "###0.00")
Grid1.TextMatrix(9, 2) = Format(Val(Grid1.TextMatrix(7, 2)) + Val(Grid1.TextMatrix(8, 2)), "###0.00")
Grid1.TextMatrix(9, 3) = Format(Val(Grid1.TextMatrix(7, 3)) + Val(Grid1.TextMatrix(8, 3)), "###0.00")
Grid1.TextMatrix(14, 2) = Format(Val(Grid1.TextMatrix(9, 2)) + Val(Grid1.TextMatrix(10, 2)) - Val(Grid1.TextMatrix(11, 2)) - Val(Grid1.TextMatrix(12, 2)) - Val(Grid1.TextMatrix(13, 2)), "###0.00")
Grid1.TextMatrix(14, 3) = Format(Val(Grid1.TextMatrix(9, 3)) + Val(Grid1.TextMatrix(10, 3)) - Val(Grid1.TextMatrix(11, 3)) - Val(Grid1.TextMatrix(12, 3)) - Val(Grid1.TextMatrix(13, 3)), "###0.00")
Grid1.TextMatrix(20, 2) = Format(Val(Grid1.TextMatrix(14, 2)) + Val(Grid1.TextMatrix(15, 2)) + Val(Grid1.TextMatrix(16, 2)) + Val(Grid1.TextMatrix(17, 2)) - Val(Grid1.TextMatrix(18, 2)) + Val(Grid1.TextMatrix(19, 2)), "###0.00")
Grid1.TextMatrix(20, 3) = Format(Val(Grid1.TextMatrix(14, 3)) + Val(Grid1.TextMatrix(15, 3)) + Val(Grid1.TextMatrix(16, 3)) + Val(Grid1.TextMatrix(17, 3)) - Val(Grid1.TextMatrix(18, 3)) + Val(Grid1.TextMatrix(19, 3)), "###0.00")
Grid1.TextMatrix(22, 2) = Format(Val(Grid1.TextMatrix(20, 2)) - Val(Grid1.TextMatrix(21, 2)), "###0.00")
Grid1.TextMatrix(22, 3) = Format(Val(Grid1.TextMatrix(20, 3)) - Val(Grid1.TextMatrix(21, 3)), "###0.00")
If Grid1.Col = 2 Then
'计算累计数
For i = 1 To Grid1.Rows
Grid1.Row = i
Grid1.Col = 2
Col2 = Grid1.Text
Grid1.Col = 3
Grid1.Text = Format(Val(Col2) + Val(Col3(i)), "###0.00")
Next i
Else
End If
Exit Sub
errorhandler:
Exit Sub
End Sub

Private Sub LoadLeiJi()
'读出数据
On Error Resume Next
Dim db As Database, EF As Recordset
Set db = OpenDatabase(Con, False, False, ConStr)
Set EF = db.OpenRecordset("shangleijishu", dbOpenTable)
Set EF = db.OpenRecordset("Select * From shangleijishu where  qybm='" & frmqy.qybm & "'" & "Order BY ID", dbOpenDynaset)
i = 1
Do While Not EF.EOF
Grid1.Col = 3
Grid1.Row = i
Col3(i) = EF.Fields("leijishu").Value
Grid1.Text = Col3(i)
EF.MoveNext
i = i + 1
Loop
EF.Close
End Sub

⌨️ 快捷键说明

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