📄 frmforwardersreceiveae.frm
字号:
Width = 4905
End
Begin VB.Label Labels
Alignment = 1 'Right Justify
Caption = "Shipping Company"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 270
TabIndex = 44
Top = 1980
Width = 1560
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
Caption = "PO No."
Height = 225
Left = 540
TabIndex = 43
Top = 690
Width = 1245
End
Begin VB.Line Line1
BorderColor = &H80000010&
BorderWidth = 2
Index = 0
X1 = 210
X2 = 12690
Y1 = 1470
Y2 = 1470
End
Begin VB.Line Line2
BorderColor = &H80000014&
Index = 0
X1 = 210
X2 = 12690
Y1 = 1440
Y2 = 1440
End
Begin VB.Label Label12
Alignment = 1 'Right Justify
Caption = "Date"
Height = 225
Left = 5370
TabIndex = 42
Top = 1980
Width = 825
End
Begin VB.Label Label18
Alignment = 1 'Right Justify
Caption = "Supplier"
Height = 225
Left = 540
TabIndex = 41
Top = 1050
Width = 1245
End
Begin VB.Line Line1
BorderColor = &H80000010&
BorderWidth = 2
Index = 1
X1 = 210
X2 = 12750
Y1 = 2730
Y2 = 2730
End
Begin VB.Line Line2
BorderColor = &H80000014&
Index = 1
X1 = 210
X2 = 12720
Y1 = 2700
Y2 = 2700
End
Begin VB.Label lblStatus
Alignment = 1 'Right Justify
Caption = "Status"
Height = 255
Left = 8640
TabIndex = 40
Top = 660
Width = 1305
End
Begin VB.Shape Shape4
BorderColor = &H80000006&
BorderWidth = 2
Height = 8625
Left = 60
Top = 60
Width = 12795
End
Begin VB.Shape Shape1
Height = 7995
Left = 150
Top = 600
Width = 12615
End
Begin VB.Shape Shape2
FillColor = &H00C0C0C0&
FillStyle = 0 'Solid
Height = 435
Left = 150
Top = 120
Width = 12615
End
Begin VB.Shape Shape3
BackColor = &H80000010&
BackStyle = 1 'Opaque
BorderColor = &H80000010&
Height = 240
Left = 210
Top = 2820
Width = 12495
End
Begin VB.Menu mnu_Tasks
Caption = "Purchase Receive Tasks"
Visible = 0 'False
Begin VB.Menu mnu_History
Caption = "Modification History"
End
Begin VB.Menu mnu_Return
Caption = "Return Items"
End
Begin VB.Menu mnu_Vat
Caption = "Show VAT && Taxbase"
End
End
End
Attribute VB_Name = "frmForwardersReceiveAE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public State As FormState 'Variable used to determine on how the form used
Public PK As Long 'Variable used to get what record is going to edit (PO)
Public ForwarderReceivePK As Long 'Variable used to get what record is going to edit (Invoice)
Public CloseMe As Boolean
Public ForCusAcc As Boolean
Dim cIGross As Currency 'Gross Amount
Dim cIAmount As Currency 'Current Invoice Amount
Dim cDAmount As Currency 'Current Invoice Discount Amount
Dim cIRowCount As Integer
Dim HaveAction As Boolean 'Variable used to detect if the user perform some action
Dim RS As New Recordset 'Main recordset for Invoice
Dim intQtyOld As Integer 'Allowed value for receive qty
Dim cLocalTrucking As Currency
Dim cSidewalkHandling As Currency
Dim intVendorID As Integer
Dim blnSave As Boolean
Private Sub btnUpdate_Click()
Dim CurrRow As Integer
Dim curDiscPerc As Currency
Dim curExtDiscPerc As Currency
Dim intQty As Integer
If cboClass.Text = "" Or nsdLocal.Text = "" Then
MsgBox "Class & Local Forwarder Fields needs input", vbInformation
Exit Sub
End If
CurrRow = getFlexPos(Grid, 13, txtStock.Tag)
'Add to grid
With Grid
.Row = CurrRow
'Restore back the invoice amount and discount
cIGross = cIGross - toNumber(Grid.TextMatrix(.RowSel, 6))
txtGross(2).Text = Format$(cIGross, "#,##0.00")
cIAmount = cIAmount - toNumber(Grid.TextMatrix(.RowSel, 10))
txtNet.Text = Format$(cIAmount, "#,##0.00")
'Compute discount
curDiscPerc = .TextMatrix(1, 6) * .TextMatrix(1, 7) / 100
curExtDiscPerc = .TextMatrix(1, 6) * .TextMatrix(1, 8) / 100
cDAmount = cDAmount - (curDiscPerc + curExtDiscPerc + txtExtDiscAmt.Text)
txtDesc.Text = Format$(cDAmount, "#,##0.00")
.TextMatrix(CurrRow, 3) = txtQty.Text
.TextMatrix(CurrRow, 4) = dcUnit.Text
.TextMatrix(CurrRow, 5) = toMoney(txtPrice.Text)
.TextMatrix(CurrRow, 6) = toMoney(txtGross(1).Text)
.TextMatrix(CurrRow, 7) = toMoney(txtDiscPercent.Text)
.TextMatrix(CurrRow, 8) = toNumber(txtExtDiscPerc.Text)
.TextMatrix(CurrRow, 9) = toMoney(txtExtDiscAmt.Text)
.TextMatrix(CurrRow, 10) = toMoney(toNumber(txtNetAmount.Text))
.TextMatrix(CurrRow, 12) = dcWarehouse.Text
'Add the amount to current load amount
cIGross = cIGross + toNumber(txtGross(1).Text)
txtGross(2).Text = Format$(cIGross, "#,##0.00")
'Compute discount
curDiscPerc = txtGross(1).Text * txtDiscPercent.Text / 100
curExtDiscPerc = txtGross(1).Text * txtExtDiscPerc.Text / 100
cDAmount = curDiscPerc + curExtDiscPerc + txtExtDiscAmt.Text
cIAmount = cIAmount + toNumber(txtNetAmount.Text)
txtDesc.Text = Format$(cDAmount, "#,##0.00")
txtNet.Text = Format$(cIAmount, "#,##0.00")
txtTaxBase.Text = toMoney(txtNet.Text / 1.12)
txtVat.Text = toMoney(txtNet.Text - txtTaxBase.Text)
'Save to Forwarder Details
Dim RSForwarderDetails As New Recordset
RSForwarderDetails.CursorLocation = adUseClient
RSForwarderDetails.Open "SELECT * From Forwarders_Detail Where ForwarderID = " & PK, CN, adOpenStatic, adLockOptimistic
'add qty received in Purchase Order Details
RSForwarderDetails.Find "[StockID] = " & txtStock.Tag, , adSearchForward, 1
If txtQty > intQtyOld Then
intQty = txtQty.Text - intQtyOld
RSForwarderDetails!QtyReceived = toNumber(RSForwarderDetails!QtyReceived) + intQty
Else
intQty = intQtyOld - txtQty
RSForwarderDetails!QtyReceived = toNumber(RSForwarderDetails!QtyReceived) - intQty
End If
RSForwarderDetails.Update
'-----------------
'Highlight the current row's column
.ColSel = 10
'Display a remove button
Grid_Click
'Reset the entry fields
ResetEntry
End With
End Sub
Private Sub btnRemove_Click()
Dim curDiscPerc As Currency
Dim curExtDiscPerc As Currency
'Remove selected load product
With Grid
'Update grooss to current purchase amount
cIGross = cIGross - toNumber(Grid.TextMatrix(.RowSel, 6))
txtGross(2).Text = Format$(cIGross, "#,##0.00")
'Update amount to current invoice amount
cIAmount = cIAmount - toNumber(Grid.TextMatrix(.RowSel, 10))
txtNet.Text = Format$(cIAmount, "#,##0.00")
'Update discount to current invoice disc
curDiscPerc = .TextMatrix(.RowSel, 6) * .TextMatrix(.RowSel, 7) / 100
curExtDiscPerc = .TextMatrix(.RowSel, 6) * .TextMatrix(.RowSel, 8) / 100
cDAmount = cDAmount - (curDiscPerc + curExtDiscPerc + txtExtDiscAmt.Text)
txtDesc.Text = Format$(cDAmount, "#,##0.00")
txtTaxBase.Text = toMoney(txtNet.Text / 1.12)
txtVat.Text = toMoney(txtNet.Text - txtTaxBase.Text)
'Update the record count
cIRowCount = cIRowCount - 1
Dim RSDetails As New Recordset
RSDetails.CursorLocation = adUseClient
RSDetails.Open "SELECT * FROM qry_Forwarders_Detail WHERE ForwarderID=" & PK & " AND StockID = " & .TextMatrix(.RowSel, 13), CN, adOpenStatic, adLockOptimistic
If RSDetails.RecordCount > 0 Then
'restore back qty that was previously added in DisplayForAdding procedure
RSDetails!QtyReceived = toNumber(RSDetails!QtyReceived) - .TextMatrix(.RowSel, 3)
RSDetails.Update
'-----------------
End If
If .Rows = 2 Then Grid.Rows = Grid.Rows + 1
.RemoveItem (.RowSel)
End With
btnRemove.Visible = False
Grid_Click
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next
If blnSave = False Then CN.RollbackTrans
Unload Me
End Sub
Private Sub mnu_Return_Click()
Dim RSPOReturn As New Recordset
RSPOReturn.CursorLocation = adUseClient
RSPOReturn.Open "SELECT POReturnID FROM Purchase_Order_Return WHERE RefNo=" & ForwarderReceivePK, CN, adOpenStatic, adLockOptimistic
With frmPOReturnAE
If RSPOReturn.RecordCount > 0 Then 'if record exist then edit record
Dim blnStatus As Boolean
blnStatus = getValueAt("SELECT POReturnID,Status FROM Purchase_Order_Return WHERE POReturnID=" & RSPOReturn!POReturnID, "Status")
If blnStatus Then 'true
.State = adStateViewMode
Else
.State = adStateEditMode
End If
.PK = RSPOReturn!POReturnID
Else
.State = adStateAddMode
.ReceivePK = ForwarderReceivePK
End If
.show vbModal
End With
End Sub
Private Sub cmdSave_Click()
'Verify the entries
If cIRowCount < 1 Then
MsgBox "Please enter item to return before saving this record.", vbExclamation
Exit Sub
End If
If MsgBox("This save the record. Do you want to proceed?", vbQuestion + vbYesNo) = vbNo Then Exit Sub
'Connection for Purchase_Order_Receive
Dim RSReceive As New Recordset
RSReceive.CursorLocation = adUseClient
RSReceive.Open "SELECT * FROM Forwarders_Receive WHERE ForwarderReceiveID=" & ForwarderReceivePK, CN, adOpenStatic, adLockOptimistic
Screen.MousePointer = vbHourglass
Dim c As Integer
On Error GoTo err
DeleteItems
'Save the record
With RSReceive
If State = adStateAddMode Then
.AddNew
ForwarderReceivePK = getIndex("Forwarders_Receive")
![ForwarderReceiveID] = ForwarderReceivePK
![ForwarderID] = PK
![DateAdded] = Now
![AddedByFK] = CurrUser.USER_PK
End If
![ShippingCompanyID] = IIf(nsdShippingCo.BoundText = "", nsdShippingCo.Tag, nsdShippingCo.BoundText)
![ShippingGuideNo] = txtShippingGuideNo.Text
' ![Ship] = txtShip.Text
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -