📄 frmfphz.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FrmFPHZ
Caption = "发票汇总"
ClientHeight = 6405
ClientLeft = 3045
ClientTop = 2790
ClientWidth = 12540
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 6405
ScaleWidth = 12540
Begin VB.CommandButton Command9
Caption = "打印发票"
Height = 375
Left = 9360
TabIndex = 20
Top = 4920
Width = 1455
End
Begin VB.CommandButton Command8
Caption = "结 帐"
Height = 375
Left = 10920
TabIndex = 19
Top = 4320
Width = 1455
End
Begin VB.Frame Frame4
Caption = "结帐情况查询"
Height = 735
Left = 9240
TabIndex = 16
Top = 2640
Width = 3255
Begin VB.OptionButton Option3
Caption = "全部"
Height = 375
Left = 2280
TabIndex = 21
Top = 240
Width = 855
End
Begin VB.OptionButton Option2
Caption = "已结"
Height = 375
Left = 1200
TabIndex = 18
Top = 240
Width = 735
End
Begin VB.OptionButton Option1
Caption = "未结"
Height = 375
Left = 120
TabIndex = 17
Top = 240
Width = 735
End
End
Begin VB.CommandButton Command7
Caption = "删 除"
Height = 375
Left = 10920
TabIndex = 15
Top = 3720
Width = 1455
End
Begin VB.CommandButton Command6
Caption = "刷 新"
Height = 375
Left = 10920
TabIndex = 14
Top = 4920
Width = 1455
End
Begin VB.CommandButton Command5
Caption = "退 出"
Height = 375
Left = 10920
TabIndex = 13
Top = 5640
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "打印汇总"
Height = 375
Left = 9360
TabIndex = 12
Top = 4320
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "详细信息"
Height = 375
Left = 9360
TabIndex = 11
Top = 3720
Width = 1455
End
Begin VB.Frame Frame3
Caption = "根据销售日期查询"
Height = 1695
Left = 9240
TabIndex = 5
Top = 960
Width = 3255
Begin VB.CommandButton Command2
Caption = "查 询"
Height = 375
Left = 960
TabIndex = 10
Top = 1200
Width = 1215
End
Begin MSComCtl2.DTPicker DTP2
Height = 375
Left = 960
TabIndex = 9
Top = 720
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 25362433
CurrentDate = 38410
End
Begin MSComCtl2.DTPicker DTP1
Height = 375
Left = 960
TabIndex = 8
Top = 240
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 25362433
CurrentDate = 38410
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "到:"
Height = 180
Left = 240
TabIndex = 7
Top = 840
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "从:"
Height = 180
Left = 240
TabIndex = 6
Top = 360
Width = 360
End
End
Begin VB.Frame Frame2
Caption = "根据发票号码查询"
Height = 975
Left = 9240
TabIndex = 2
Top = 0
Width = 3255
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 375
Left = 2280
TabIndex = 4
Top = 360
Width = 855
End
Begin VB.TextBox TxtFPHM
Appearance = 0 'Flat
Height = 330
Left = 120
TabIndex = 3
Top = 360
Width = 2055
End
End
Begin VB.Frame Frame1
Caption = "发票汇总"
Height = 6375
Left = 0
TabIndex = 0
Top = 0
Width = 9135
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 6015
Left = 120
TabIndex = 1
Top = 240
Width = 8895
_ExtentX = 15690
_ExtentY = 10610
_Version = 393216
Cols = 9
FixedCols = 0
RowHeightMin = 315
SelectionMode = 1
FormatString = "发 票 号 码|^ 销 售 日 期 |^ 客 户 名 称 |^ 总 金 额 |^ 税 额 |^ 金 税 合 计 |^付款方式|^结帐否|^打印次数"
End
End
End
Attribute VB_Name = "FrmFPHZ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Rst, RstQD As ADODB.Recordset
Dim RstDel As ADODB.Recordset
Dim SQLTJ As String
Dim CmdFlag As Integer
Private Sub Command1_Click()
If TxtFPHM <> "" Then
SQLTJ = " where fphm='" & Trim(TxtFPHM) & "'"
CmdFlag = 1
Call ReSet
Call FillGrid
End If
End Sub
Private Sub Command2_Click()
If DTP1 > DTP2 Then
MsgBox "请正确选择日期,终止日期不能小于起始日期!", vbOKOnly + vbCritical, "提示"
Else
SQLTJ = " where xsrq>=#" & DTP1 & "# and xsrq<=#" & DTP2 & "#"
CmdFlag = 2
Call ReSet
Call FillGrid
End If
End Sub
Private Sub Command3_Click()
Set RstQD = New ADODB.Recordset
SQL = "select * from fpcx where xsd_zb.fphm='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
RstQD.Open SQL, db, 1, 3
If RstQD.EOF Then Exit Sub
FrmSELL_QD.LblFPHM.Caption = RstQD.Fields(0)
FrmSELL_QD.TxtSHR.Caption = RstQD.Fields(2)
FrmSELL_QD.lblxsrq.Caption = RstQD.Fields(1)
FrmSELL_QD.lblJE.Caption = Format(RstQD.Fields(3), "0.00")
FrmSELL_QD.lblSE.Caption = Format(RstQD.Fields(4), "0.00")
FrmSELL_QD.lblJSHJ.Caption = Format(RstQD.Fields(5), "0.00")
FrmSELL_QD.Grid.Clear
FrmSELL_QD.Grid.Rows = 1
FrmSELL_QD.Grid.FormatString = "序号|^ 商 品 名 称 |^ 货 号 |^ 规 格 |^ 单 位 |^ 数 量 |^ 单 价 |^ 金 额 |^ 税 率 |^ 税 额 |^ 金 税 合 计"
Do While Not RstQD.EOF
FrmSELL_QD.Grid.Rows = FrmSELL_QD.Grid.Rows + 1
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 0) = RstQD.Fields(16)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 1) = RstQD.Fields(6)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 2) = RstQD.Fields(7)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 3) = RstQD.Fields(8)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 4) = RstQD.Fields(9)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 5) = RstQD.Fields(10)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 6) = Format(RstQD.Fields(11), "0.00")
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 7) = Format(RstQD.Fields(12), "0.00")
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 8) = RstQD.Fields(13)
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 9) = Format(RstQD.Fields(14), "0.00")
FrmSELL_QD.Grid.TextMatrix(FrmSELL_QD.Grid.Rows - 1, 10) = Format(RstQD.Fields(15), "0.00")
SumSL = SumSL + RstQD.Fields(10)
RstQD.MoveNext
Loop
FrmSELL_QD.lblSL.Caption = SumSL
FrmSELL_QD.Show 1
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Command6_Click()
Call ReSet
Call FillGrid
End Sub
Private Sub Command7_Click()
Dim Rst1, Rst2, Rst3 As ADODB.Recordset
If MsgBox("你真的要删除该发票,此操作不可逆!", vbOKCancel + 48, "警告") = vbOK Then
'删除销售单总表
'---------------------------------------------------------------------------------------
Set RstDel = New Recordset
SQL = "delete * from xsd_zb where fphm='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
RstDel.Open SQL, db, 1, 3
'---------------------------------------------------------------------------------------
'删除销售单明细表,并更新库存动态表
'---------------------------------------------------------------------------------------
Set Rst1 = New Recordset
SQL = "select fphm,sl,spid from xsd_mx where fphm='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
Rst1.Open SQL, db, 1, 3
Do While Not Rst1.EOF
Set Rst2 = New Recordset
SQL = "update kcdtb set sl=sl+" & Rst1.Fields(1) & " where spid =" & Rst1.Fields(2)
Rst2.Open SQL, db, 1, 3
Rst1.MoveNext
Loop
Set Rst3 = New Recordset
SQL = "delete * from xsd_mx where fphm='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
Rst3.Open SQL, db, 1, 3
Rst1.Close
'---------------------------------------------------------------------------------------
End If
Call ReSet
Call FillGrid
End Sub
Private Sub Command8_Click()
If Grid.TextMatrix(Grid.RowSel, 7) = "是" Then
MsgBox "该笔货款已经结帐,请勿重复结帐!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
If MsgBox("请确认该笔货款已到帐!", vbOKCancel + vbInformation, "提示") = vbOK Then
Set Rst = New Recordset
SQL = "update xsd_zb set jzf=1 where fphm='" & Grid.TextMatrix(Grid.RowSel, 0) & "'"
Rst.Open SQL, db, 1, 3
End If
End If
Call ReSet
Call FillGrid
End Sub
Private Sub Form_Load()
Call ReSet
Call FillGrid
CmdFlag = 0
End Sub
Sub ReSet()
Grid.Clear
Grid.Rows = 1
Grid.FormatString = "发 票 号 码|^ 销 售 日 期 |^ 客 户 名 称 |^ 总 金 额 |^ 税 额 |^ 金 税 合 计 |^付款方式|^结帐否|^打印次数"
End Sub
Sub FillGrid()
Set Rst = New Recordset
SQL = "select * from XSD_ZB" & SQLTJ & " order by fphm"
Rst.Open SQL, db, 1, 3
If Rst.EOF Then
If CmdFlag = 1 Then
MsgBox "找不到此发票,请确认发票输入正确!", vbOKOnly + vbInformation, "提示"
ElseIf CmdFlag = 2 Then
MsgBox "在此日期段无发票!", vbOKOnly + vbInformation, "提示"
End If
SQLTJ = ""
Exit Sub
End If
Do While Not Rst.EOF
Grid.Rows = Grid.Rows + 1
Grid.TextMatrix(Grid.Rows - 1, 0) = Rst.Fields(0)
Grid.TextMatrix(Grid.Rows - 1, 1) = Rst.Fields(1)
Grid.TextMatrix(Grid.Rows - 1, 2) = Rst.Fields(2)
Grid.TextMatrix(Grid.Rows - 1, 3) = Rst.Fields(3)
Grid.TextMatrix(Grid.Rows - 1, 4) = Rst.Fields(4)
Grid.TextMatrix(Grid.Rows - 1, 5) = Rst.Fields(5)
Grid.TextMatrix(Grid.Rows - 1, 6) = Rst.Fields(7)
If Rst.Fields(8) = True Then
Grid.TextMatrix(Grid.Rows - 1, 7) = "是"
Else
Grid.TextMatrix(Grid.Rows - 1, 7) = "否"
End If
Grid.TextMatrix(Grid.Rows - 1, 8) = Rst.Fields(6)
Rst.MoveNext
Loop
SQLTJ = ""
CmdFlag = 0
End Sub
Private Sub Grid_DblClick()
Call Command3_Click
End Sub
Private Sub Grid_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command3_Click
End If
End Sub
Private Sub Option1_Click()
SQLTJ = " where JZF=0 "
Call ReSet
Call FillGrid
End Sub
Private Sub Option2_Click()
SQLTJ = " where JZF<>0 "
Call ReSet
Call FillGrid
End Sub
Private Sub Option3_Click()
Call Command6_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -