sendbackgoods.frm

来自「一个关于电脑管理汽车的软件」· FRM 代码 · 共 1,378 行 · 第 1/4 页

FRM
1,378
字号
     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
          SaveToStockBillDocu TempRS, lstBillDocu, i
         End If
       Next j
      End If
      .CloseRecordset
      .ReleaseMemory
      Set TempRS = Nothing
     End With
     OrgRS.Clear
    End If
     TempSQL = "select * from sendbackgoods2" '& " 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
       SaveToStockBillDocu 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 6
    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 6
    Command1(i).Visible = True
   Next i
   SSStock.TabEnabled(0) = True
   SSStock.Tab = 0
   OrgRS.Clear
   VarInitData.LoadData lstBillDocu, VarInitData.DisplaySQLVal(12)
 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
    Set OrgRS = New ChangeHistory
   ' OrgRs.KeyCount = 0
    VarInitData.LoadData lstAddress, VarInitData.DisplaySQLVal(11)
    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
   AddRow2.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 6
   Command1(i).Visible = True
  Next i
  For i = 0 To 2
   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(12) & " Where billnum = " & Quote(TempStr)
  VarInitData.LoadData2 lstBillDocu, TempSQL, OrgRS
  VarInitData.DealListView lstBillDocu, lstBillDocuIndex
 ' If BillStateBS = 2 Then OrgRs.InitItem lstBillDocu.ListItems.Count
  If lstAddressIndex > 0 And lstAddress.ListItems.Count > 0 Then
   If BillStateBS <> 1 Then
    SendBackGoods.lblBillNum = lstAddress.ListItems(lstAddressIndex).Text

    With lstAddress.ListItems(lstAddressIndex)
      SendBackGoods.lblProvide = .SubItems(1)
      DTDate.Value = .SubItems(2)
      SendBackGoods.CmbPayWay = .SubItems(3)
      SendBackGoods.cmbPrincipal = .SubItems(4)
      SendBackGoods.cmbCheckMan = .SubItems(5)
      SendBackGoods.lblGCount = .SubItems(6)
      SendBackGoods.lblGMoney = .SubItems(7)
      SendBackGoods.lblGItemCount = .SubItems(8)
      SendBackGoods.lblOperateMan = .SubItems(9)
      'Set TempRS = New MYSQL_RS
      'SQL = "Select * From sendbackgoods Where billnum = " & Quote(Trim(.Text))
      'TempRS.OpenRs SQL, gCnn
      SendBackGoods.cmbInvoiceType = .SubItems(10) 'TempRS.Fields("invoicetype").Value
      SendBackGoods.texInvoiceNo = .SubItems(11) 'TempRS.Fields("invoiceno").Value
      TempBillType = Val(.SubItems(12)) 'TempRS.Fields("billtype").Value
      If TempBillType = 3 Then
       SendBackGoods.Option1(0).Value = True
      ElseIf TempBillType = 4 Then
       SendBackGoods.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 SendBackGoods
  .lblBillNum = ""
  .lblProvide = ""
  .lblGCount = "0"
  .lblGItemCount = "0"
  .lblOperateMan = ""
  .lblGMoney = "0"
  .cmbCheckMan = ""
  .cmbInvoiceType = ""
  .texInvoiceNo = ""
  .CmbPayWay = ""
  .cmbPrincipal = ""
  .DTDate = Date
  .Option1(0).Value = False
  .Option1(1).Value = False
 End With
End Sub

Private Sub SaveToStockBill()
 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 sendbackgoods 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, "JHT")
     TempRS.Update
     TempRS.CloseRecordset
     TempRS.ReleaseMemory
     Set TempRS = Nothing
     
     Set TempRS = New MYSQL_RS
     TempSQL = "Select * From sendbackgoods" '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("provide") = SendBackGoods.lblProvide
     .Fields("stockdate") = SendBackGoods.DTDate
     .Fields("payway") = SendBackGoods.CmbPayWay
     .Fields("principal") = SendBackGoods.cmbPrincipal
     .Fields("checkman") = SendBackGoods.cmbCheckMan
     .Fields("gcount") = Val(SendBackGoods.lblGCount)
     .Fields("gmoney") = Val(SendBackGoods.lblGMoney)
     .Fields("gitemcount") = Val(SendBackGoods.lblGItemCount)
     .Fields("operateman") = SendBackGoods.lblOperateMan
     .Fields("invoicetype") = SendBackGoods.cmbInvoiceType
     .Fields("invoiceno") = SendBackGoods.texInvoiceNo
     .Fields("billtype") = VarOption
          
     .Update
    End With
    Set TempRS = Nothing
    TempSQL = VarInitData.DisplaySQLVal(11)
    VarInitData.LoadData lstAddress, TempSQL
End Sub
Private Sub SaveToStockBillDocu(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("goodsprice") = lstBillDocu.ListItems(i).SubItems(5)
   .Fields("money") = lstBillDocu.ListItems(i).SubItems(6)
   .Fields("goodspos") = lstBillDocu.ListItems(i).SubItems(7)
   .Fields("sellprice") = lstBillDocu.ListItems(i).SubItems(8)
   .Fields("changeprice") = 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("orgprice") = lstBillDocu.ListItems(i).SubItems(14)
  ' .Fields("replacecoding") = ""
   .Update
  End With
  
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?