📄 frmcosalesitemedit.frm
字号:
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3720
TabIndex = 11
Top = 480
Width = 1695
End
End
Begin MSComCtl2.DTPicker DTConsignmentDate
Height = 375
Left = 6000
TabIndex = 2
Top = 3600
Width = 2655
_ExtentX = 4683
_ExtentY = 661
_Version = 393216
Format = 69533697
CurrentDate = 38204
End
Begin VB.TextBox TxtCOItemID
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 0
Top = 360
Width = 2895
End
Begin VB.Image Image4
Height = 300
Left = 5160
Picture = "FrmCOSalesItemEdit.frx":0CCA
Top = 5160
Width = 300
End
Begin VB.Label LblCancel
BackStyle = 0 'Transparent
Caption = "取 消"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5760
MouseIcon = "FrmCOSalesItemEdit.frx":10E6
MousePointer = 99 'Custom
TabIndex = 5
Top = 5160
Width = 855
End
Begin VB.Image Image3
Height = 300
Left = 2760
Picture = "FrmCOSalesItemEdit.frx":13F0
Top = 5160
Width = 300
End
Begin VB.Label LblOK
BackStyle = 0 'Transparent
Caption = "确 定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3360
MouseIcon = "FrmCOSalesItemEdit.frx":180C
MousePointer = 99 'Custom
TabIndex = 4
Top = 5160
Width = 735
End
Begin VB.Label Label5
Caption = "完成"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2760
TabIndex = 13
Top = 4320
Width = 1095
End
Begin VB.Label Label3
Caption = "订货量"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 12
Top = 3600
Width = 1095
End
Begin VB.Label Label1
Caption = "交货期"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4920
TabIndex = 7
Top = 3600
Width = 1095
End
Begin VB.Label Label4
Caption = "CO项目ID"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2040
TabIndex = 6
Top = 360
Width = 1095
End
End
Attribute VB_Name = "FrmCOSalesItemEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriCOID As String
Public OriCODate As String
Public OriCustomerID As String
Public OriDeliverID As String
Public OriCOItemID As String
Public OriSalesItemID As String
Public Modify As Boolean
Private Sub DataGrid1_Click()
If Adodc1.Recordset.RecordCount <> 0 Then
TxtSalesItemID.Text = Adodc1.Recordset.Fields(0)
End If
End Sub
Private Sub Form_Load()
'填充"完成"List单
CmbIsComplete.List(0) = "NO 未完成"
CmbIsComplete.List(1) = "YES 已完成"
Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
Adodc1.RecordSource = "select * from SalesItem,Item where SalesItem.Item=Item.Item and SalesItem.CustomerID='" + Trim(OriCustomerID) + "'"
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub LblCancel_Click()
Unload Me
End Sub
Private Sub LblOK_Click()
'判断要编辑信息是否完整
If Check = False Then
Exit Sub
End If
With MyCO
.COID = OriCOID
.CODate = OriCODate
.DeliverID = OriDeliverID
.COItemID = TxtCOItemID.Text
.SalesItemID = TxtSalesItemID.Text
.COQty = TxtCOQty.Text
.ConsignmentDate = DTConsignmentDate.Value
.IsComplete = CmbIsComplete.Text
'判断操作是添加还是修改
If Modify = False Then '判断为添加操作
'判断销售员ID是否已经存在
If .In_DBCOItemID(TxtCOItemID.Text) = True Then
MsgBox "CO项目ID重复,请重新设置"
TxtCOItemID.SetFocus
TxtCOItemID.SelStart = 0
TxtCOItemID.SelLength = Len(TxtCOItemID)
Exit Sub
Else
.Insert '添加
MsgBox "添加成功"
FrmCOEdit.IsFirst = False
End If
Else '判断为修改操作
.Update (OriCOItemID)
MsgBox "修改成功"
End If
End With
Unload Me
End Sub
Private Function Check() As Boolean
If Trim(TxtCOItemID) = "" Then
MsgBox "请输入CO项目ID"
TxtCOItemID.SetFocus
Check = False
Exit Function
End If
If Trim(TxtSalesItemID) = "" Then
MsgBox "请选择销售商品"
Check = False
Exit Function
End If
If Trim(TxtCOQty) = "" Then
MsgBox "请输入订货量"
TxtCOQty.SetFocus
Check = False
Exit Function
End If
If DTConsignmentDate.Value < FrmCOEdit.DTCODate Then
MsgBox "交货期不应先于订货期,请重新选择"
DTConsignmentDate.SetFocus
Check = False
Exit Function
End If
If Trim(CmbIsComplete) = "" Then
MsgBox "请选择该订单是否完成"
CmbIsComplete.SetFocus
Check = False
Exit Function
End If
Check = True
End Function
Private Sub TxtCOQty_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -