frm_modify_internet.frm

来自「很好一套库存管理」· FRM 代码 · 共 626 行 · 第 1/2 页

FRM
626
字号
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column09 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column10 
            ColumnWidth     =   1739.906
         EndProperty
         BeginProperty Column11 
            ColumnWidth     =   1739.906
         EndProperty
      EndProperty
   End
   Begin LVbuttons.LaVolpeButton LaVolpeButton2 
      Height          =   375
      Left            =   3360
      TabIndex        =   3
      Top             =   3240
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      BTYPE           =   3
      TX              =   "&Delete"
      ENAB            =   -1  'True
      BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      COLTYPE         =   2
      BCOL            =   14215660
      FCOL            =   0
      FCOLO           =   0
      EMBOSSM         =   12632256
      EMBOSSS         =   16777215
      MPTR            =   0
      MICON           =   "FRM_MODIFY_INTERNET.frx":0E5E
      ALIGN           =   1
      IMGLST          =   "(None)"
      IMGICON         =   "(None)"
      ICONAlign       =   0
      ORIENT          =   0
      STYLE           =   1
      IconSize        =   2
      SHOWF           =   -1  'True
      BSTYLE          =   0
   End
   Begin VB.Image Image1 
      Height          =   1035
      Left            =   6000
      Picture         =   "FRM_MODIFY_INTERNET.frx":0E7A
      Stretch         =   -1  'True
      Top             =   0
      Width           =   885
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Invoice Number"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   120
      TabIndex        =   5
      Top             =   840
      Width           =   1815
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Customer Name"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   4
      Top             =   360
      Width           =   1815
   End
End
Attribute VB_Name = "FRM_MODIFY_INTERNET"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cust_names As New ADODB.Recordset
Dim rs_data As New ADODB.Recordset
Dim in_rs As New ADODB.Recordset

Private Sub Combo1_Click(Index As Integer)
If Index = 0 Then
    in_rs.Open "select Invoice_no from Sales_master where Party_name='" & Combo1(0).Text & "' and Item_type='Internet Connection'", db, adOpenKeyset, adLockOptimistic
    Combo1(1).Clear
    While in_rs.EOF <> True
        Combo1(1).AddItem in_rs.Fields(0).Value
        in_rs.MoveNext
    Wend
    in_rs.Close
    Set DataGrid1.DataSource = Nothing
ElseIf Index = 1 Then
    If rs_data.State = adStateOpen Then
        rs_data.Close
    End If
    rs_data.CursorLocation = adUseClient
    rs_data.Open "select * from Sales_master where Party_name='" & Combo1(0).Text & "' and Invoice_no='" & Combo1(1).Text & "'", db, adOpenKeyset, adLockOptimistic
    Set DataGrid1.DataSource = rs_data
End If
End Sub

Private Sub Combo1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If Len(Combo1(Index).Text) > 0 Then
        SendKeys "{TAB}"
    End If
End If
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 27 Then
    Unload Me
End If
End Sub

Private Sub Form_Load()
    KeyPreview = True
    Me.Left = 0
    Me.Top = 0
    
    cust_names.Open "select Party_name from Sales_master where Item_type='Internet Connection'", db, adOpenKeyset, adLockOptimistic
    If cust_names.RecordCount = 0 Then
        Unload Me
        MsgBox "No Record Found ...", vbInformation, "No Record Found ..."
        Exit Sub
    End If
    
    Combo1(0).Clear
    While cust_names.EOF <> True
        Combo1(0).AddItem cust_names.Fields(0).Value
        cust_names.MoveNext
    Wend
    
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
cust_names.Close
rs_data.Close
in_rs.Close
Exit Sub
End Sub

Private Sub LaVolpeButton1_Click()
If Len(Combo1(1).Text) = 0 Then
    MsgBox "Select Invoice Number ...", vbInformation, "Invoice Number Not Selected ..."
    Exit Sub
End If

rs_data.Requery



    Dim update_awa_pur_stock As New ADODB.Recordset
    update_awa_pur_stock.Open "select * from AVAILABLE_PURCHASED_STOCK where Item_type='Internet Connection' and Item_name='" & rs_data.Fields(5).Value & "' and Invoice_no='" & rs_data.Fields(8).Value & "'", db, adOpenKeyset, adLockOptimistic

    

        If update_awa_pur_stock.RecordCount > 0 Then
            update_awa_pur_stock.Fields(5).Value = update_awa_pur_stock.Fields(5).Value + VAL(rs_data.Fields(6).Value)
            update_awa_pur_stock.Fields(7).Value = update_awa_pur_stock.Fields(5).Value * update_awa_pur_stock.Fields(6).Value
            update_awa_pur_stock.Update
        Else
            update_awa_pur_stock.AddNew
            update_awa_pur_stock.Fields(0).Value = rs_data.Fields(8).Value
            update_awa_pur_stock.Fields(1).Value = rs_data.Fields(9).Value
            update_awa_pur_stock.Fields(2).Value = rs_data.Fields(10).Value
            update_awa_pur_stock.Fields(3).Value = "Internet Connection"
            update_awa_pur_stock.Fields(4).Value = rs_data.Fields(5).Value
            update_awa_pur_stock.Fields(5).Value = rs_data.Fields(6).Value
            update_awa_pur_stock.Fields(6).Value = rs_data.Fields(11).Value
            update_awa_pur_stock.Fields(7).Value = update_awa_pur_stock.Fields(5).Value * update_awa_pur_stock.Fields(6).Value
            update_awa_pur_stock.Update
        End If
    update_awa_pur_stock.Close

rs_data.Requery

            Dim update_item_master As New ADODB.Recordset
            update_item_master.Open "select * from Item_master where Item_name='" & rs_data.Fields(5).Value & "' and Itemtype='Internet Connection'", db, adOpenKeyset, adLockOptimistic
            update_item_master.Fields(3).Value = update_item_master.Fields(3).Value + rs_data.Fields(6).Value
            update_item_master.Update

rs_data.Requery

Dim username As String
Dim rdate As String
Dim edate As String
Dim bpr As String
Dim seno As String

Dim rs_get_old_data As New ADODB.Recordset
rs_get_old_data.Open "select * from INTERNET_CONNECTIONS where sales_invoice_no='" & Combo1(1).Text & "'", db, adOpenKeyset, adLockOptimistic
username = rs_get_old_data.Fields(2).Value
rdate = rs_get_old_data.Fields(3).Value
edate = rs_get_old_data.Fields(4).Value
bpr = rs_get_old_data.Fields(5).Value
seno = rs_get_old_data.Fields(8).Value
rs_get_old_data.Close

DoEvents

db.Execute "delete from INTERNET_CONNECTIONS where sales_invoice_no='" & Combo1(1).Text & "'"
db.Execute "delete from AMT_UNPAID_REMIND where INVOICE_NO='" & Combo1(1).Text & "' and PARTY_NAME='" & Combo1(0).Text & "'"
db.Execute "delete from Sales_master where Invoice_no='" & Combo1(1).Text & "' and Party_name='" & Combo1(0).Text & "' and Item_type='Internet Connection'"
db.Execute "delete from DATE_PROFIT where INVOICE_NUMBER='" & Combo1(1).Text & "'"
db.Execute "delete from EXPENSE where INVOICE_NO='" & Combo1(1).Text & "'"

FRM_UPDATE_INTERNET.Text1(0).Text = rs_data.Fields(1).Value
FRM_UPDATE_INTERNET.Combo1.Text = Combo1(0).Text
FRM_UPDATE_INTERNET.Text1(0).Enabled = False
FRM_UPDATE_INTERNET.Combo1.Enabled = False
FRM_UPDATE_INTERNET.LaVolpeButton1.Enabled = False
FRM_UPDATE_INTERNET.LaVolpeButton2.Enabled = False
FRM_UPDATE_INTERNET.Combo2.Text = rs_data.Fields(5).Value
FRM_UPDATE_INTERNET.Combo3.Text = rs_data.Fields(9).Value
FRM_UPDATE_INTERNET.Text1(1).Text = rs_data.Fields(11).Value

FRM_UPDATE_INTERNET.inno = Combo1(1).Text
FRM_UPDATE_INTERNET.Text1(4).Text = seno
FRM_UPDATE_INTERNET.Text1(2).Text = username
FRM_UPDATE_INTERNET.Text1(3).Text = bpr
FRM_UPDATE_INTERNET.DTPicker1(0).Value = Format(rdate, "dd-MMM-yyyy")
FRM_UPDATE_INTERNET.DTPicker1(1).Value = Format(edate, "dd-MMM-yyyy")
FRM_UPDATE_INTERNET.Show
Unload Me
End Sub

Private Sub LaVolpeButton2_Click()

If Len(Combo1(1).Text) = 0 Then
    MsgBox "Select Invoice Number ...", vbInformation, "Invoice Number Not Selected ..."
    Exit Sub
End If
Dim x As Integer
x = MsgBox("Are you sure you want to delete this Sales Entry ...", vbQuestion Or vbYesNo, "Want to Delete this entry ...")
If x <> 6 Then
    Exit Sub
End If

rs_data.Requery



    Dim update_awa_pur_stock As New ADODB.Recordset
    update_awa_pur_stock.Open "select * from AVAILABLE_PURCHASED_STOCK where Item_type='Internet Connection' and Item_name='" & rs_data.Fields(5).Value & "' and Invoice_no='" & rs_data.Fields(8).Value & "'", db, adOpenKeyset, adLockOptimistic

    

        If update_awa_pur_stock.RecordCount > 0 Then
            update_awa_pur_stock.Fields(5).Value = update_awa_pur_stock.Fields(5).Value + VAL(rs_data.Fields(6).Value)
            update_awa_pur_stock.Fields(7).Value = update_awa_pur_stock.Fields(5).Value * update_awa_pur_stock.Fields(6).Value
            update_awa_pur_stock.Update
        Else
            update_awa_pur_stock.AddNew
            update_awa_pur_stock.Fields(0).Value = rs_data.Fields(8).Value
            update_awa_pur_stock.Fields(1).Value = rs_data.Fields(9).Value
            update_awa_pur_stock.Fields(2).Value = rs_data.Fields(10).Value
            update_awa_pur_stock.Fields(3).Value = "Internet Connection"
            update_awa_pur_stock.Fields(4).Value = rs_data.Fields(5).Value
            update_awa_pur_stock.Fields(5).Value = rs_data.Fields(6).Value
            update_awa_pur_stock.Fields(6).Value = rs_data.Fields(11).Value
            update_awa_pur_stock.Fields(7).Value = update_awa_pur_stock.Fields(5).Value * update_awa_pur_stock.Fields(6).Value
            update_awa_pur_stock.Update
        End If
    update_awa_pur_stock.Close

rs_data.Requery

            Dim update_item_master As New ADODB.Recordset
            update_item_master.Open "select * from Item_master where Item_name='" & rs_data.Fields(5).Value & "' and Itemtype='Internet Connection'", db, adOpenKeyset, adLockOptimistic
            update_item_master.Fields(3).Value = update_item_master.Fields(3).Value + rs_data.Fields(6).Value
            update_item_master.Update

rs_data.Requery



db.Execute "delete from INTERNET_CONNECTIONS where sales_invoice_no='" & Combo1(1).Text & "'"
db.Execute "delete from AMT_UNPAID_REMIND where INVOICE_NO='" & Combo1(1).Text & "' and PARTY_NAME='" & Combo1(0).Text & "'"
db.Execute "delete from Sales_master where Invoice_no='" & Combo1(1).Text & "' and Party_name='" & Combo1(0).Text & "' and Item_type='Internet Connection'"
db.Execute "delete from DATE_PROFIT where INVOICE_NUMBER='" & Combo1(1).Text & "'"
db.Execute "delete from EXPENSE where INVOICE_NO='" & Combo1(1).Text & "'"

End Sub

⌨️ 快捷键说明

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