以下是引用片段:
Private Sub Form_Load() '设置表格标题和样式 Dim arrName() arrName = Array("商品代码", "商品名称", "商品类别", "商品规格", "计量单位", "单价(元)", "数量", "金额(元)") Dim arrColwidth() arrColwidth = Array(0, 2000, 1500, 1000, 1000, 1000, 1500, 1500) ddd.Cols = 8 ddd.Rows = 2 Dim i As Long For i = 0 To ddd.Cols - 1 ddd.ColWidth(i) = arrColwidth(i) ddd.TextMatrix(0, i) = arrName(i) ddd.TextMatrix(1, i) = "" Next ddd.Rows = 50 Me.DTPicker1.Value = Format(Date, "yyyy-mm-dd") End Sub
Private Sub Form_Resize() '设置窗体边框和标题 Call FormFace(Me, TopPicture, KKShape) Call TopCaption(Me.TopPicture, Label2.Caption) End Sub
Private Sub TopPicture_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) '准备窗体移动标志 intOldX = X intOldy = Y boolMouseFlag = True End Sub
Private Sub TopPicture_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '存储窗提议动前的left,top Dim intLeft, intTop As Integer intLeft = Me.Left intTop = Me.Top If Me.WindowState = 2 Then Exit Sub If boolMouseFlag = True Then Me.Left = intLeft + (X - intOldX) Me.Top = intTop + (Y - intOldy) End If End Sub
Private Sub TopPicture_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) '还原当前的窗体移动标志 boolMouseFlag = False End Sub
Private Sub UserControl11_Click() '关闭窗体 Unload Me End Sub
Private Sub UserControl12_Click() '校验信息的正确性 '存储结账信息 If Val(Me.Text7.Text) <= 0 Then MsgBox "当前没有任何的消费商品!" Exit Sub End If Call addData Call frmCgdj.UpdateList Unload Me End Sub
Private Sub UserControl13_Click() '设置frmSpXZ的窗体标志 Set frmObj = Me frmSpXZ.Tag = "选择商品" frmSpXZ.Show 1 End Sub
Private Sub addData() '存储菜单主信息 '存储商品信息 '1 Call Exec_SqL("delete from cgdj where cgid='" & Me.Text2.Text & "'") Call Exec_SqL("delete from cgmx where cgid='" & Me.Text2.Text & "'") Call Exec_SqL("insert into cgdj (cgid,khmc,cgrq,zsl,zje,jlr,bz) " _ & " values('" & Me.Text2.Text & "','" & Trim(Me.Text3.Text) & "'," _ & "'" & Me.DTPicker1.Value & "'," & Val(Me.Text7.Text) & ", " _ & " " & Val(Me.Text6.Text) & ",'" & strRyName & "','" & Me.Text1.Text & "')") Dim i As Long '2 For i = 1 To ddd.Rows - 1 If ddd.TextMatrix(i, 0) <> "" Then Call Exec_SqL("insert into cgmx (cgid,spid,sl,je) values('" & Me.Text2.Text & "'," _ & " '" & Trim(ddd.TextMatrix(i, 0)) & "'," & Val(ddd.TextMatrix(i, ddd.Cols - 2)) & "," & Val(ddd.TextMatrix(i, ddd.Cols - 1)) & ")") Dim strresult As String strresult = UpdateKcmm(Trim(ddd.TextMatrix(i, 0)), "+", Val(ddd.TextMatrix(i, ddd.Cols - 2)), Val(ddd.TextMatrix(i, ddd.Cols - 1)), "") If strresult <> "OK" Then MsgBox strresult Exit Sub End If End If Next End Sub
|