📄 inter_net_connections.frm
字号:
Dim dtsource As New ADODB.Recordset
Dim INV As String
Private Sub Combo1_Click()
If Len(Combo1.Text) = 0 Then
LaVolpeButton2.Enabled = False
Else
LaVolpeButton2.Enabled = True
Dim R As New ADODB.Recordset
R.Open "select cutomer_id from Customer_master where cutomer_name='" & Combo1.Text & "'", db, adOpenDynamic, adLockOptimistic
Text1(0).Text = R.Fields(0).Value
R.Close
End If
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 46 Then
LaVolpeButton2.Enabled = False
Text1(0).Text = Clear
End If
If KeyCode = 13 Then
If Len(Combo1.Text) > 0 Then
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys "{TAB}"
End If
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub Combo2_Click()
Text1(1).Text = Clear
Text1(2).Text = Clear
Text1(3).Text = Clear
DTPicker1(0).Value = Date
DTPicker1(1).Value = Date
Dim pf As New ADODB.Recordset
pf.Open "SELECT DISTINCT Party_name FROM AVAILABLE_PURCHASED_STOCK WHERE Item_type='Internet Connection' AND Item_name='" & Combo2.Text & "'", db, adOpenDynamic, adLockOptimistic
Combo3.Clear
While pf.EOF <> True
Combo3.AddItem pf.Fields(0).Value
pf.MoveNext
Wend
pf.Close
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 46 Then
Combo2.Text = Clear
Combo3.Text = Clear
Text1(1).Text = Clear
Text1(2).Enabled = False
DTPicker1(0).Value = Format(Date, "dd-MM-yyyy")
DTPicker1(1).Value = Format(Date, "dd-MM-yyyy")
DTPicker1(0).Enabled = False
DTPicker1(1).Enabled = False
Text1(3).Enabled = False
End If
If KeyCode = 13 Then
If Len(Combo2.Text) > 0 Then
SendKeys "{TAB}"
End If
End If
End Sub
Private Sub Combo3_Click()
Dim price As New ADODB.Recordset
price.Open "SELECT price_per_unit,Invoice_no from SYS_QRY_INTERNET_SALE where Item_name='" & Combo2.Text & "' and Party_name='" & Combo3.Text & "'", db, adOpenDynamic, adLockOptimistic
Text1(1).Text = price.Fields(0).Value
INV = price.Fields(1).Value
price.Close
Set DataGrid1.DataSource = Nothing
dtsource.Close
dtsource.Open "SELECT * from SYS_QRY_INTERNET_SALE where Item_name='" & Combo2.Text & "' and Party_name='" & Combo3.Text & "'", db, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = dtsource
End Sub
Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Len(Combo3.Text) > 0 Then
SendKeys "{TAB}"
SendKeys "{TAB}"
End If
End If
End Sub
Private Sub DataGrid1_Click()
Text1(1).Text = dtsource.Fields(6).Value
INV = dtsource.Fields(0).Value
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 27 Then
Dim x As Integer
x = MsgBox("Are you sure you want to Exit Internet Connection Data entry form ?", vbQuestion Or vbYesNo, "Want to Exit ?")
If x = 6 Then
Unload Me
End If
End If
End Sub
Private Sub Form_Load()
KeyPreview = True
Me.Left = 0
Me.Top = 0
dtsource.CursorLocation = adUseClient
dtsource.Open "SELECT * from SYS_QRY_INTERNET_SALE where Item_name='" & Combo2.Text & "' and Party_name='" & Combo3.Text & "'", db, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = dtsource
DTPicker1(0).Value = Date
DTPicker1(1).Value = Date
Status = False
FNAME = Clear
Call REFRESH_NAMES
LaVolpeButton2.Enabled = False
RS_PR.Open "SELECT DISTINCT Item_name FROM AVAILABLE_PURCHASED_STOCK WHERE Item_type='Internet Connection' and Qty >0", db, adOpenDynamic, adLockOptimistic
While RS_PR.EOF <> True
Combo2.AddItem RS_PR.Fields(0).Value
RS_PR.MoveNext
Wend
RS_PR.Close
Text1(2).Enabled = False
DTPicker1(0).Enabled = False
DTPicker1(1).Enabled = False
Text1(3).Enabled = False
End Sub
Public Sub REFRESH_NAMES()
Combo1.Clear
cust_names.Open "SELECT cutomer_name FROM Customer_master", db, adOpenDynamic, adLockOptimistic
While cust_names.EOF <> True
Combo1.AddItem cust_names.Fields(0).Value
cust_names.MoveNext
Wend
cust_names.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
dtsource.Close
If Status = True Then
R.Open "SELECT * FROM Customer_master WHERE cutomer_name='" & Combo1.Text & "' AND cutomer_id='" & Text1(0).Text & "'", db, adOpenDynamic, adLockOptimistic
R.Delete
R.Close
End If
End Sub
Private Sub LaVolpeButton1_Click()
Status = True
FNAME = "INTERNET"
LaVolpeButton1.Enabled = False
LaVolpeButton2.Enabled = False
Combo1.Enabled = False
frm_cust_details.Show
End Sub
Private Sub LaVolpeButton2_Click()
CrystalReport1.DataFiles(0) = App.Path & "\Master_Database.MDB"
CrystalReport1.ReportFileName = App.Path & "\Report\rpt_Verify_cutomer_detail.rpt"
CrystalReport1.SelectionFormula = "{Customer_master.cutomer_name} = '" & Combo1.Text & "'"
CrystalReport1.username = "Admin"
CrystalReport1.Password = "1010101010" & Chr(10) & "1010101010"
CrystalReport1.Action = 1
CrystalReport1.PageZoom (100)
End Sub
Private Sub LaVolpeButton3_Click()
If DTPicker1(1).Value = Format(Date, "dd-MM-yyyy") Then
MsgBox "You can not set expiry date as todays date...", vbCritical, "Invalid Expiry Date..."
Exit Sub
End If
If DTPicker1(0).Value < DTPicker1(1).Value Then
If VAL(Text1(3).Text) > 0 Then
If Len(Text1(0).Text) > 0 Then
If Len(Text1(1).Text) > 0 Then
Dim rs_p As New ADODB.Recordset
rs_p.Open "SELECT * FROM DATE_PROFIT", db, adOpenDynamic, adLockOptimistic
rs_p.AddNew
rs_p.Fields(0).Value = Date
rs_p.Fields(1).Value = VAL(Text1(3).Text) - VAL(Text1(1).Text)
Dim inno As String
inno = "WITHOUT BILL_" & Combo1.Text & Now
rs_p.Fields(2).Value = inno
rs_p.Update
rs_p.Close
Dim rs_update As New ADODB.Recordset
rs_update.Open "select * from INTERNET_CONNECTIONS", db, adOpenDynamic, adLockOptimistic
rs_update.AddNew
rs_update.Fields(0).Value = Text1(0).Text
rs_update.Fields(1).Value = Combo2.Text
rs_update.Fields(2).Value = Text1(2).Text
rs_update.Fields(3).Value = Format(DTPicker1(0).Value, "mm-dd-yyyy")
rs_update.Fields(4).Value = Format(DTPicker1(1).Value, "mm-dd-yyyy")
rs_update.Fields(5).Value = Text1(3).Text
rs_update.Fields(6).Value = Month(DTPicker1(1).Value)
rs_update.Fields(7).Value = Year(DTPicker1(1).Value)
If Len(Text1(4).Text) > 0 Then
rs_update.Fields(8).Value = Text1(4).Text
End If
rs_update.Fields(9).Value = True
''''
rs_update.Fields(10).Value = dtsource.Fields(0).Value
rs_update.Fields(11).Value = dtsource.Fields(3).Value
rs_update.Fields(12).Value = dtsource.Fields(6).Value
rs_update.Fields(13).Value = dtsource.Fields(4).Value
rs_update.Fields(14).Value = inno
'On Error GoTo a1:
rs_update.Update
Status = False
Dim up_stock As New ADODB.Recordset
up_stock.Open "SELECT Qty FROM AVAILABLE_PURCHASED_STOCK WHERE Party_name='" & Combo3.Text & "' AND Item_type='Internet Connection' AND Item_name='" & Combo2.Text & "' AND Invoice_no='" & INV & "'", db, adOpenDynamic, adLockOptimistic
up_stock.Fields(0).Value = up_stock.Fields(0).Value - 1
up_stock.Update
If up_stock.Fields(0).Value = 0 Then
up_stock.Delete
End If
up_stock.Close
Dim SALES_UPDATE As New ADODB.Recordset
SALES_UPDATE.Open "select * from Sales_master", db, adOpenDynamic, adLockOptimistic
SALES_UPDATE.AddNew
SALES_UPDATE.Fields(0).Value = inno
SALES_UPDATE.Fields(1).Value = Text1(0).Text
SALES_UPDATE.Fields(2).Value = Combo1.Text
SALES_UPDATE.Fields(3).Value = Format(DTPicker1(0).Value, "mm-dd-yyyy")
SALES_UPDATE.Fields(4).Value = "Internet Connection"
SALES_UPDATE.Fields(5).Value = Combo2.Text
SALES_UPDATE.Fields(6).Value = 1
SALES_UPDATE.Fields(7).Value = Text1(3).Text
SALES_UPDATE.Fields(8).Value = dtsource.Fields(0).Value
SALES_UPDATE.Fields(9).Value = dtsource.Fields(3).Value
SALES_UPDATE.Fields(10).Value = dtsource.Fields(4).Value
SALES_UPDATE.Fields(11).Value = dtsource.Fields(6).Value
SALES_UPDATE.Update
SALES_UPDATE.Close
Dim up_date_item_master As New ADODB.Recordset
up_date_item_master.Open "select * from Item_master where Item_name='" & Combo2.Text & "' and Itemtype='Internet Connection'", db, adOpenKeyset, adLockOptimistic
up_date_item_master.Fields(3).Value = up_date_item_master.Fields(3).Value - 1
up_date_item_master.Update
FRM_AMT_PAID_NOT_PAID.Label3(5).Caption = "Sales"
FRM_AMT_PAID_NOT_PAID.Label3(2).Caption = inno
FRM_AMT_PAID_NOT_PAID.Label3(0).Caption = Combo1.Text
FRM_AMT_PAID_NOT_PAID.Label2(2).Caption = Text1(3).Text
Me.Visible = False
FRM_AMT_PAID_NOT_PAID.dt = Format(DTPicker1(0).Value, "dd-MMM-yyyy")
FRM_AMT_PAID_NOT_PAID.Show vbModal
' Dim f As New FileSystemObject
' f.CopyFile App.Path & "\Master_Database.mdb", App.Path & "\data\" & cur_company_name & "\Master_Database.mdb", True
Unload Me
Exit Sub
A1:
MsgBox "Duplicate Entry Found ...", vbCritical, "Check your data ..."
Exit Sub
Else
MsgBox "Enter Proper Data ...", vbCritical, "Insufficient Data ..."
Exit Sub
End If
Else
MsgBox "Select Customer Name ...", vbCritical, "Name Not Found ..."
Exit Sub
End If
Else
MsgBox "Billing Price can not be Zero Value", vbCritical, "Enter Proper Data ..."
Exit Sub
End If
Else
MsgBox "Registered Date Must be less than Expire Date ...", vbCritical, "Enter Proper Data ..."
Exit Sub
End If
End Sub
Private Sub Text1_Change(Index As Integer)
If Index = 1 Then
If Len(Text1(1).Text) > 0 Then
Text1(2).Enabled = True
DTPicker1(0).Enabled = True
DTPicker1(1).Enabled = True
Text1(3).Enabled = True
End If
End If
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Len(Text1(Index).Text) > 0 Then
SendKeys "{TAB}"
End If
End If
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If Index = 3 Then
If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then
ElseIf KeyAscii = 8 Then
ElseIf KeyAscii = 46 Then
If InStr(1, Text1(3).Text, ".", vbTextCompare) > 0 Then
KeyAscii = 0
End If
Else
KeyAscii = 0
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -