📄 frmcontractedit.frm
字号:
TabIndex = 32
Top = 2160
Width = 1695
_ExtentX = 2990
_ExtentY = 529
_Version = 393216
Format = 24903681
CurrentDate = 38690
End
Begin MSComCtl2.DTPicker DTValidation
Height = 300
Left = 5040
TabIndex = 33
Top = 1200
Width = 1695
_ExtentX = 2990
_ExtentY = 529
_Version = 393216
Format = 24903681
CurrentDate = 38690
End
Begin VB.Label lbl_Income
AutoSize = -1 'True
Caption = "lblIncome"
Height = 180
Left = 5040
TabIndex = 26
Top = 2640
Width = 810
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "收账总计"
Height = 180
Left = 4080
TabIndex = 25
Top = 2640
Width = 720
End
Begin VB.Label lbl_Cost
AutoSize = -1 'True
Caption = "lblCost"
Height = 180
Left = 1200
TabIndex = 24
Top = 2640
Width = 630
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "费用总计"
Height = 180
Left = 240
TabIndex = 23
Top = 2640
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "交货方式"
Height = 180
Left = 4080
TabIndex = 22
Top = 2184
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "负责人"
Height = 180
Left = 4080
TabIndex = 21
Top = 1728
Width = 540
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "有效期限"
Height = 180
Left = 4080
TabIndex = 20
Top = 1272
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "交货日期"
Height = 180
Left = 240
TabIndex = 19
Top = 2184
Width = 720
End
Begin VB.Label lblStatus
AutoSize = -1 'True
Caption = "lblStatus"
Height = 180
Left = 5040
TabIndex = 18
Top = 360
Width = 810
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "合同状态"
Height = 180
Left = 4080
TabIndex = 17
Top = 360
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "结算方式"
Height = 180
Left = 240
TabIndex = 16
Top = 1728
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "签定日期"
Height = 180
Left = 240
TabIndex = 15
Top = 1272
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "客户单位"
Height = 180
Left = 240
TabIndex = 14
Top = 816
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "合同编号"
Height = 180
Left = 240
TabIndex = 13
Top = 360
Width = 720
End
End
End
Attribute VB_Name = "FrmContractEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As String
Private Sub Refresh_Pro()
Adodc1.ConnectionString = conn
Adodc1.RecordSource = "SELECT ProId As 产品编号, UnitPrice As 产品单价, Quantity As 产品数量," _
+ "DeliveryDate As 交货日期, Memo As 备注信息" _
+ " FROM ConProduct WHERE ContractId='" + Trim(MyContract.ContractId) _
+ "' ORDER BY ProId"
Adodc1.Refresh
End Sub
Private Sub Cmd_Add_Click()
If MyContract.ContractId = "" Then
MsgBox "必须首先保存合同"
Exit Sub
End If
FrmConProductEdit.Modify = False
FrmConProductEdit.DTDate.Value = Now
FrmConProductEdit.Show 1
Refresh_Pro
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择删除的记录"
Exit Sub
End If
If MsgBox("是否删除当前的产品记录", vbYesNo, "请确认") = vbYes Then
Call MyConPro.Delete(MyContract.ContractId, Adodc1.Recordset.Fields(0))
End If
Refresh_Pro
End Sub
Private Sub Cmd_Modi_Click()
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择修改的记录"
Exit Sub
End If
With FrmConProductEdit
.OriId = Adodc1.Recordset.Fields(0)
.Modify = True
.txtUnitPrice = Adodc1.Recordset.Fields(1)
.txtQuantity = Adodc1.Recordset.Fields(2)
.DTDate.Value = Adodc1.Recordset.Fields(3)
.txtMemo = Adodc1.Recordset.Fields(4)
.Show 1
End With
Refresh_Pro
End Sub
Private Sub Cmd_Save_Click()
Dim TmpId As String
If Trim(txtId) = "" Then
MsgBox "请输入合同编号"
Exit Sub
End If
If Trim(txtClient) = "" Then
MsgBox "请输入客户单位"
Exit Sub
End If
TmpId = MakeStr(txtId)
'判断产品编号是否已经存在
If Modify = False Or OriId <> Trim(txtId) Then
If MyContract.In_DB(TmpId) = True Then
MsgBox "合同编号“" + Trim(txtId) + "”已经存在,请重新输入"
txtId.SetFocus
txtId.SelStart = 0
txtId.SelLength = Len(txtId)
Exit Sub
End If
End If
With MyContract
.ContractId = TmpId
.Client = MakeStr(txtClient)
'规范日期格式
.SignDate = Format(DTSignDate.Value, "yyyy-mm-dd")
.EmpName = MakeStr(txtEmpName)
.DeliveryWay = MakeStr(txtDeliveryWay)
.DeliveryDate = Format(DTDeliveryDate.Value, "yyyy-mm-dd")
.SettleWay = ComboSettle.ListIndex + 1
.Validation = Format(DTValidation.Value, "yyyy-mm-dd")
.Contents = MakeStr(txtContents)
.Additional = MakeStr(txtAdditional)
If Modify = False Then
.Status = 1
.Insert
Modify = True
OriId = .ContractId
Else
.Update (OriId)
End If
End With
MsgBox "合同保存完成"
End Sub
Private Sub Form_Load()
Refresh_Pro
End Sub
Private Sub txtClient_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtDeliveryWay_GotFocus()
EnterTAB (KeyAscii)
End Sub
Private Sub txtEmpName_GotFocus()
EnterTAB (KeyAscii)
End Sub
Private Sub txtId_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -