📄 form10.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 1
Left = 840
TabIndex = 26
Top = 3630
Width = 1695
End
Begin VB.Label Label14
BackColor = &H00FFFFC0&
BackStyle = 0 'Transparent
Caption = "Total KGs"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 1
Left = 840
TabIndex = 25
Top = 3210
Width = 1455
End
Begin VB.Label Label15
BackColor = &H00FFFFC0&
BackStyle = 0 'Transparent
Caption = "No Of Bags"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 1
Left = 840
TabIndex = 24
Top = 2790
Width = 1455
End
Begin VB.Label Label17
BackColor = &H00FFFFC0&
BackStyle = 0 'Transparent
Caption = "Contract No"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 1
Left = 5160
TabIndex = 23
Top = 1530
Width = 1695
End
Begin VB.Label Label18
BackColor = &H00FFFFC0&
BackStyle = 0 'Transparent
Caption = "Invoice Key"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 1
Left = 840
TabIndex = 22
Top = 1110
Width = 1695
End
Begin VB.Label Label4
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = " Product Name"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 2
Left = 5160
TabIndex = 21
Top = 2370
Width = 1815
End
Begin VB.Label Label23
BackStyle = 0 'Transparent
Caption = "Product Code"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 840
TabIndex = 20
Top = 2370
Width = 1575
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public callingform As Object
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim rs7 As New ADODB.Recordset
Dim rs8 As New ADODB.Recordset
Dim rs9 As New ADODB.Recordset
Dim rs10 As New ADODB.Recordset
Dim rs11 As New ADODB.Recordset
Private Sub ad12_KeyPress(Index As Integer, KeyAscii As Integer)
If Not (KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 32 Or KeyAscii = 46 Or KeyAscii >= 48 And KeyAscii <= 57) Then
KeyAscii = 0
' MsgBox "Please Enter integer Value"
End If
'If KeyAscii = 13 Then
'supphno.SetFocus
'37.344
'End If
'sdate.value
End Sub
Private Sub bagw_KeyPress(Index As Integer, KeyAscii As Integer)
If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Or KeyAscii = 46) Then
KeyAscii = 0
End If
End Sub
Private Sub bagw_KeyUp(Index As Integer, KeyCode As Integer, Shift As Integer)
totalkg(1).Text = Val(noofbags(1).Text) * Val(bagw(1).Text)
'totalm(1).Text = (totalkg(1).Text) / 37.324
'////////////////////////////////////////////////
'amount(1).Text = Val(totalm(1).Text) * Val(mrate(1).Text)
namount(1).Text = Val(amount(1).Text) + Val(lbexp(1).Text) + Val(pexp(1).Text) + Val(oexp(2).Text) + Val(ttax(2).Text)
'(2).Text = Val(namount(1).Text)
End Sub
Private Sub clear_Click()
noofbags(1).Text = ""
bagw(1).Text = ""
totalm(1).Text = ""
mrate(1).Text = ""
lbexp(1).Text = ""
pexp(1).Text = ""
oexp(2).Text = ""
tax(0).Text = ""
ttax(2).Text = ""
nam(0).Text = ""
'////////////////////////////
'cusid(1).Text = ""
'Text8(2).Text = ""
'Text6(1).Text = ""
'Text4(1).Text = ""
'Text5(1).Text = ""
'Text1(1).Text = ""
'ad12(2).Text = ""
'/////////////////////////////////////
csid(2).Text = ""
scode(1).Text = ""
namount(1).Text = ""
totalkg(1).Text = ""
lb(2).Text = ""
amount(1).Text = ""
oexp(0).Text = ""
item(2).Text = ""
invoiceno.Text = ""
Command8(4).SetFocus
'////////////////////////////////
If rs5.State = adStateOpen Then rs5.Close
rs5.Open "Purchase_Receive_Order_Table", cnn, adOpenStatic, adLockReadOnly, adCmdTable
If rs5.RecordCount = 0 Then
pno(2).Text = 1
Else
rs5.MoveLast
pno(2).Text = rs5.Fields(0) + 1
End If
'sdate(1).Text = date
'Text7(1).Text = Date
'//////////////////////////////////
End Sub
Private Sub cmdclose_Click()
Unload Me
End Sub
Private Sub cmdopen_Click()
Set Form1.callingform = Me
Form1.Show vbModal
End Sub
Private Sub cmdsave_Click()
If invoiceno.Text = "" Then
MsgBox "Please Enter the Invoice No"
invoiceno.SetFocus
Exit Sub
End If
If csid(2).Text = "" Then
MsgBox "Please Enter the Contract No"
Command8(4).SetFocus
Exit Sub
End If
If scode(1).Text = "" Then
MsgBox "Please Enter the Supplier Code"
scode(1).SetFocus
Exit Sub
End If
If noofbags(1).Text = "" Then
MsgBox "Please Enter the No Of Bags"
noofbags(1).SetFocus
Exit Sub
End If
If bagw(1).Text = "" Then
MsgBox "Please Enter the Weight/Bag"
bagw(1).SetFocus
Exit Sub
End If
If mrate(1).Text = "" Then
MsgBox "Please Enter the Rate/Mound"
mrate(1).SetFocus
Exit Sub
End If
'///////////////////////////////////
If rs.State = adStateOpen Then rs.Close
rs.Open " select P_Given_Order from Purchase_Receive_Order_Table where P_Given_Order='" & Val(csid(2).Text) & "'", cnn, adOpenStatic, adLockReadOnly
0 If rs.RecordCount > 0 Then
MsgBox " This contract invoice is already issued"
clear_Click
Exit Sub
Else
'/////////////////////////////////////////
If MsgBox("Are you sure to save this record ?", vbconfirmation + vbYesNo, "Shahbaz Oil Mill Pvt(Ltd)") = vbYes Then
'************************
If rs4.State = adStateOpen Then rs4.Close
rs4.Open " select Valid_Date from Purchase_Given_Order_Table where P_Given_Order='" & Val(csid(2).Text) & "'", cnn, adOpenStatic, adLockReadOnly
If sdate.Value > rs4.Fields("Valid_Date").Value Then
If MsgBox("Contract Date has been Expired. Are You Save this Record?", vbconfirmation + vbYesNo, "Shahbaz Oil Mill Pvt(Ltd)") = vbNo Then
Exit Sub
'Else
End If
End If
'*************************
If rs.State = adStateOpen Then rs.Close
rs.Open "Purchase_Receive_Order_Table", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
rs.AddNew
rs.Fields("P_Receive_Order") = pno(2).Text
rs.Fields("P_Receive_Date") = sdate.Value
rs.Fields("P_Given_Order") = csid(2).Text
rs.Fields("Sup_Code") = scode(1).Text
rs.Fields("Invoice_No") = invoiceno.Text
rs.Fields("Net_Amount") = namount(1).Text
'/////////////////////////////////////
rs.Update
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "Purchase_Receive_Order_Detail_Table", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
rs1.AddNew
rs1.Fields("P_Receive_Order") = pno(2).Text
rs1.Fields("Product_Code") = oexp(0).Text
rs1.Fields("Product_Name") = Trim(item(2).Text)
rs1.Fields("Total_Bags") = noofbags(1).Text
rs1.Fields("W/Bag") = bagw(1).Text
rs1.Fields("Total_Mounds") = totalm(1).Text
rs1.Fields("Rate/Mound") = mrate(1).Text
rs1.Fields("Labour_Exp") = Val(lbexp(1).Text)
rs1.Fields("Packing_Exp") = Val(pexp(1).Text)
rs1.Fields("Other_Exp") = Val(oexp(2).Text)
rs1.Fields("Sales_Tax") = Val(ttax(2).Text)
rs1.Update
'///////////////////////////////////////////
clear_Click
rs.MoveLast
pno(2).Text = rs.Fields(0) + 1
'End If
End If
End If
End Sub
Private Sub Command1_Click()
Grid1.Visible = True
Grid1.Rows = 2
Grid1.TextMatrix(0, 0) = "Order No"
Grid1.TextMatrix(0, 1) = "Order Date"
Grid1.TextMatrix(0, 2) = "Supplier Code"
Grid1.TextMatrix(0, 3) = "Product Code"
Grid1.TextMatrix(0, 4) = "Product Name"
Grid1.TextMatrix(0, 5) = "Total Qty(Mn)"
Grid1.TextMatrix(0, 6) = "Rate/Mn"
Grid1.TextMatrix(0, 7) = "Total Amount"
'If cnn.State = adStateOpen Then cnn.Close
'cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "Purchase_Given_Order_Table", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount > 0 Then
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("P_Given_Order")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("Order_Date")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("Sup_Code")
If rs.State = adStateOpen Then rs.Close
rs.Open "select * from Purchase_Given_Order_Detail_Table where P_Given_Order= '" & rs1.Fields("P_Given_Order") & "'", cnn, adOpenStatic, adLockReadOnly
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs.Fields("Product_Code")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs.Fields("Product_Name")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs.Fields("Total_Mounds")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs.Fields("Rate/Mn")
Grid1.TextMatrix(Grid1.Rows - 1, 7) = Val(rs.Fields("Rate/Mn")) * Val(rs.Fields("Total_Mounds"))
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -