sellbacktable.frm
来自「一个关于电脑管理汽车的软件」· FRM 代码 · 共 1,481 行 · 第 1/4 页
FRM
1,481 行
.lblGCount = TempCount
.lblGMoney = TempMoney
.lblGMoney2 = TempMoney2
End With
End If
End If
Case 2 '保存
If lblProvide = "" Then
MsgBox "购物单位不能为空", , VarInitData.SysPrompt
Exit Sub
End If
SaveToSellBill
VarOption = 0
If lstBillDocu.ListItems.Count > 0 And lstBillDocuIndex > 0 Then
If OrgRS.KeyCount > 0 Or OrgRS.DelKeyCount > 0 Then
TempSQL = "select * from sellbacktable2" & " Where billnum = " & Quote(Trim(lblBillNum.Caption))
Set TempRS = New MYSQL_RS
TempRS.OpenRs TempSQL, gCnn
With TempRS
If OrgRS.DelKeyCount > 0 Then
For j = 1 To OrgRS.DelKeyCount
.MoveFirst
.MovePrevious
TempFindIndex = .FindNext("AKey", CStr(OrgRS.DelKeyRSValue(j)))
If TempFindIndex > -1 Then
.Delete
.Update
End If
Next j
End If
i = 0
If OrgRS.KeyCount > 0 Then
.MoveFirst
.MovePrevious
For j = 1 To OrgRS.KeyCount
TempFindIndex = .FindNext("AKey", CStr(OrgRS.KeyRSValue(j)))
If TempFindIndex > -1 Then
i = i + 1
SaveToSellBillDocu TempRS, lstBillDocu, i
End If
Next j
End If
.CloseRecordset
.ReleaseMemory
Set TempRS = Nothing
End With
OrgRS.Clear
End If
TempSQL = "select * from sellbacktable2" '& " Where billnum = " & Quote(Trim(lblBillNum.Caption))
Set TempRS = New MYSQL_RS
TempRS.OpenRs TempSQL, gCnn
With TempRS
If .RecordCount > 0 Then
.MoveLast
.MoveNext
End If
i = i + 1
TempCount = lstBillDocu.ListItems.Count
If i <= TempCount Then
For j = i To TempCount
' .MoveNext
SaveToSellBillDocu TempRS, lstBillDocu, j
Next j
End If
.CloseRecordset
.ReleaseMemory
Set TempRS = Nothing
End With
End If
Frame2.Enabled = False
BillStateBS = 0
For i = 0 To 3
Command3(i).Visible = False
Next i
For i = 0 To 5
Command1(i).Visible = True
Next i
SSStock.TabEnabled(0) = True
SSStock.Tab = 0
Case 3
VarOption = 0
Frame2.Enabled = False
BillStateBS = 0
For i = 0 To 3
Command3(i).Visible = False
Next i
For i = 0 To 5
Command1(i).Visible = True
Next i
SSStock.TabEnabled(0) = True
SSStock.Tab = 0
OrgRS.Clear
VarInitData.LoadData lstBillDocu, VarInitData.DisplaySQLVal(18)
End Select
VarInitData.DealListView lstBillDocu, lstBillDocuIndex
End Sub
Private Sub Form_Activate()
VarInitData.DealListView lstAddress, lstAddressIndex
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim TempSQL As String
VarInitData.InitBSE BSE1
Frame2.Visible = False
Frame2.Enabled = False
lstBillDocu.Visible = False
lstAddress.Visible = True
For i = 0 To 3
Command3(i).Visible = False
Next i
VarInitData.LoadData lstAddress, VarInitData.DisplaySQLVal(17)
Set OrgRS = New ChangeHistory
cmbInvoiceType.AddItem ""
cmbInvoiceType.AddItem "普通发票"
cmbInvoiceType.AddItem "增值税票"
TempSQL = VarInitData.DisplayDynSQLVal(VarInitData.SureNameFrIndex(6))
VarInitData.LoadData CmbPayWay, TempSQL, 1
TempSQL = "Select name From workertable "
VarInitData.LoadData cmbPrincipal, TempSQL, 1
VarInitData.LoadData cmbCheckMan, TempSQL, 1
End Sub
Private Sub Form_Resize()
If Me.ScaleHeight > 0 And Me.ScaleWidth > 0 Then
frameInfo.left = Me.ScaleLeft
frameInfo.top = Me.ScaleTop
frameInfo.Width = Me.ScaleWidth
SSStock.top = frameInfo.top + frameInfo.Height
SSStock.left = Me.ScaleLeft + 70
SSStock.Width = Me.ScaleWidth - 140
SSStock.Height = Me.ScaleHeight - frameInfo.Height - 50 'Screen.Height - 2650
lstAddress.top = 450
lstAddress.left = 70
lstAddress.Width = SSStock.Width - 140
lstAddress.Height = SSStock.Height - 550
Frame2.left = 70
Frame2.top = 450
Frame2.Width = SSStock.Width - 140
lstBillDocu.top = Frame2.top + Frame2.Height
lstBillDocu.left = 70
lstBillDocu.Width = SSStock.Width - 140
lstBillDocu.Height = SSStock.Height - Frame2.Height - 550
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If BSE1.EngineStarted Then BSE1.EndSubClassing
End Sub
Private Sub lstAddress_DblClick()
If lstAddress.SelectedItem Is Nothing Then Exit Sub
' LoadRecord Val(lstAddress.SelectedItem.Text)
End Sub
Private Sub lstAddress_ItemClick(ByVal Item As MSComctlLib.ListItem)
'Dim templong As Long
'Stop
lstAddressIndex = Item.Index
'templong = Item.Text
End Sub
Private Sub lstBillDocu_DblClick()
If BillStateBS > 0 Then
If lstBillDocu.SelectedItem Is Nothing Then Exit Sub
ModifyBS = True
lstBillDocuIndex = lstBillDocu.SelectedItem.Index
AddRow4.Show 1
End If
End Sub
Private Sub lstBillDocu_ItemClick(ByVal Item As MSComctlLib.ListItem)
lstBillDocuIndex = Item.Index
End Sub
Private Sub Option1_Click(Index As Integer)
VarOption = Index + 3
End Sub
Private Sub SSStock_Click(PreviousTab As Integer)
Dim TempSQL As String
Dim TempStr As String
Dim TempRS As MYSQL_RS
Dim TempBillType As Integer
Dim i As Integer
If PreviousTab <> 0 Then
For i = 0 To 5
Command1(i).Visible = True
Next i
For i = 0 To 3
Command3(i).Visible = False
Next i
Frame2.Visible = False
lstBillDocu.Visible = False
lstAddress.Visible = True
VarInitData.DealListView lstAddress, lstAddressIndex
Else
Frame2.Visible = True
If BillStateBS > 0 Then
Frame2.Enabled = True
Else
Frame2.Enabled = False
End If
lstBillDocu.Visible = True
lstAddress.Visible = False
If BillStateBS <> 1 Then ClearFrame2
If lstAddress.ListItems.Count > 0 Then
TempStr = lstAddress.ListItems(lstAddressIndex).Text
Else
TempStr = ""
End If
If BillStateBS = 1 Then TempStr = ""
TempSQL = VarInitData.DisplaySQLVal(18) & " Where billnum = " & Quote(TempStr)
VarInitData.LoadData2 lstBillDocu, TempSQL, OrgRS
VarInitData.DealListView lstBillDocu, lstBillDocuIndex
If lstAddressIndex > 0 And lstAddress.ListItems.Count > 0 Then
If BillStateBS <> 1 Then
With lstAddress.ListItems(lstAddressIndex)
SellBackTable.lblBillNum = .Text
SellBackTable.lblProvide = .SubItems(1)
DTDate.Value = .SubItems(2)
SellBackTable.CmbPayWay = .SubItems(3)
SellBackTable.cmbPrincipal = .SubItems(4)
SellBackTable.cmbCheckMan = .SubItems(5)
SellBackTable.lblGCount = .SubItems(6)
SellBackTable.lblGMoney = .SubItems(7)
SellBackTable.lblGMoney2 = .SubItems(8)
SellBackTable.lblGItemCount = .SubItems(9)
SellBackTable.lblOperateMan = .SubItems(11)
'Set TempRS = New MYSQL_RS
'SQL = "Select * From sellbacktable Where billnum = " & Quote(Trim(.Text))
'TempRS.OpenRs SQL, gCnn
SellBackTable.cmbInvoiceType = .SubItems(12) 'TempRS.Fields("invoicetype").Value
SellBackTable.texInvoiceNo = .SubItems(13) 'TempRS.Fields("invoiceno").Value
Text1.Text = .SubItems(10)
TempBillType = Val(.SubItems(14)) 'TempRS.Fields("billtype").Value
If TempBillType = 3 Then
SellBackTable.Option1(0).Value = True
ElseIf TempBillType = 4 Then
SellBackTable.Option1(1).Value = True
End If
' TempRS.CloseRecordset
' Set TempRS = Nothing
End With
End If
End If
End If
End Sub
Private Sub ClearFrame2()
With SellBackTable
.lblBillNum = ""
.lblProvide = ""
.lblGCount = "0"
.lblGItemCount = "0"
.lblOperateMan = ""
.lblGMoney = "0"
.cmbCheckMan = ""
.cmbInvoiceType = ""
.texInvoiceNo = ""
.CmbPayWay = ""
.cmbPrincipal = ""
.DTDate = Date
.Option1(0).Value = False
.Option1(1).Value = False
VarOption = 0
End With
End Sub
Private Sub SaveToSellBill()
Dim TempRS As MYSQL_RS
Dim i As Integer
Dim TempSQL As String
Set TempRS = New MYSQL_RS
If BillStateBS = 2 Then
TempSQL = "Select * From sellbacktable Where billnum = " & Quote(Trim(lblBillNum))
ElseIf BillStateBS = 1 Then
TempSQL = "Select * From counttable where countname =" & Quote("销退货单号")
TempRS.OpenRs TempSQL, gCnn
TempRS.Fields("count").Value = CLng(TempRS.Fields("count").Value) + 1
lblBillNum = VarInitData.DealVarNo(CStr(TempRS.Fields("count")), 6, "XS")
TempRS.Update
TempRS.CloseRecordset
TempRS.ReleaseMemory
Set TempRS = Nothing
Set TempRS = New MYSQL_RS
TempSQL = "Select * From sellbacktable" 'Where AKey = " & Val(txtAKey)
End If
TempRS.OpenRs TempSQL, gCnn
If BillStateBS <> 2 Then
If TempRS.RecordCount > 0 Then
TempRS.MoveLast
TempRS.MoveNext
End If
End If
With TempRS
If .EOF Then .AddNew
.Fields("billnum") = lblBillNum.Caption
.Fields("buygoodsunit") = SellBackTable.lblProvide
.Fields("selldate") = SellBackTable.DTDate
.Fields("payway") = SellBackTable.CmbPayWay
.Fields("principal") = SellBackTable.cmbPrincipal
.Fields("sendgoodsman") = SellBackTable.cmbCheckMan
.Fields("gcount") = Val(SellBackTable.lblGCount)
.Fields("gsellmoney") = Val(SellBackTable.lblGMoney)
.Fields("grealsellmoney") = Val(SellBackTable.lblGMoney2)
.Fields("gitemcount") = Val(SellBackTable.lblGItemCount)
.Fields("operateman") = SellBackTable.lblOperateMan
.Fields("invoicetype") = SellBackTable.cmbInvoiceType
.Fields("invoiceno") = SellBackTable.texInvoiceNo
.Fields("billtype") = VarOption
.Fields("billfavour") = Text1
.Update
.CloseRecordset
.ReleaseMemory
End With
Set TempRS = Nothing
TempSQL = VarInitData.DisplaySQLVal(17)
VarInitData.LoadData lstAddress, TempSQL
End Sub
Private Sub SaveToSellBillDocu(VarRS As MYSQL_RS, lstBillDocu As ListView, ByVal i As Long)
With VarRS
If .EOF Then .AddNew
.Fields("billnum") = lblBillNum
.Fields("goodscoding") = lstBillDocu.ListItems(i).Text
.Fields("goodsname") = lstBillDocu.ListItems(i).SubItems(1)
.Fields("goodsstandard") = lstBillDocu.ListItems(i).SubItems(2)
.Fields("goodscount") = lstBillDocu.ListItems(i).SubItems(3)
.Fields("unit") = lstBillDocu.ListItems(i).SubItems(4)
.Fields("sellmoney") = lstBillDocu.ListItems(i).SubItems(5)
.Fields("realsellmoney") = lstBillDocu.ListItems(i).SubItems(6)
.Fields("goodspos") = lstBillDocu.ListItems(i).SubItems(7)
.Fields("sellprice") = lstBillDocu.ListItems(i).SubItems(8)
.Fields("realsellprice") = lstBillDocu.ListItems(i).SubItems(9)
.Fields("brand") = lstBillDocu.ListItems(i).SubItems(10)
.Fields("goodssort") = lstBillDocu.ListItems(i).SubItems(11)
.Fields("producehere") = lstBillDocu.ListItems(i).SubItems(12)
.Fields("replacecoding") = lstBillDocu.ListItems(i).SubItems(13)
' .Fields("goodsprice") = lstBillDocu.ListItems(i).SubItems(14)
.Update
End With
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?