📄 frminvoiceae.frm
字号:
End
Begin VB.Label Labels
BackStyle = 0 'Transparent
Caption = "Boxes"
Height = 240
Index = 11
Left = 4575
TabIndex = 44
Top = 0
Width = 540
End
Begin VB.Label Labels
BackStyle = 0 'Transparent
Caption = "Cases"
Height = 240
Index = 10
Left = 3975
TabIndex = 43
Top = 0
Width = 540
End
Begin VB.Label Labels
BackStyle = 0 'Transparent
Caption = "Sales Price(Each)"
Height = 240
Index = 9
Left = 2700
TabIndex = 42
Top = 0
Width = 1290
End
Begin VB.Label Labels
BackStyle = 0 'Transparent
Caption = "Product Code"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000011D&
Height = 240
Index = 8
Left = 0
TabIndex = 41
Top = 0
Width = 1515
End
End
Begin VB.CommandButton btnRemove
Height = 275
Left = 300
Picture = "frmInvoiceAE.frx":0407
Style = 1 'Graphical
TabIndex = 26
ToolTipText = "Remove"
Top = 3975
Visible = 0 'False
Width = 275
End
Begin VB.CommandButton cmdSave
Caption = "Save"
Default = -1 'True
Height = 315
Left = 8175
TabIndex = 34
Top = 7875
Width = 1335
End
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 315
Left = 9615
TabIndex = 35
Top = 7875
Width = 1335
End
Begin VB.CommandButton cmdUsrHistory
Caption = "Modification History"
Height = 315
Left = 225
TabIndex = 33
Top = 7875
Width = 1755
End
Begin VB.TextBox txtBal
BackColor = &H00E6FFFF&
ForeColor = &H00000000&
Height = 285
Left = 9450
Locked = -1 'True
TabIndex = 32
Text = "0.00"
Top = 7275
Width = 1500
End
Begin VB.TextBox txtEntry
ForeColor = &H00000000&
Height = 285
Index = 0
Left = 1425
TabIndex = 0
TabStop = 0 'False
Top = 150
Width = 2115
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid
Height = 2190
Left = 225
TabIndex = 25
Top = 3825
Width = 10755
_ExtentX = 18971
_ExtentY = 3863
_Version = 393216
Rows = 0
FixedRows = 0
FixedCols = 0
RowHeightMin = 275
ForeColorFixed = -2147483640
BackColorSel = 1091552
ForeColorSel = 16777215
BackColorBkg = -2147483643
GridColor = -2147483633
GridColorFixed = -2147483633
GridColorUnpopulated= -2147483633
AllowBigSelection= 0 'False
FocusRect = 0
SelectionMode = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 2
_Band(0).GridLinesBand= 1
_Band(0).TextStyleBand= 0
_Band(0).TextStyleHeader= 0
End
Begin MSComCtl2.DTPicker dtpDate
Height = 285
Left = 1425
TabIndex = 2
Top = 525
Width = 2505
_ExtentX = 4419
_ExtentY = 503
_Version = 393216
CustomFormat = "MMM-dd-yyyy"
Format = 20512771
CurrentDate = 38207
End
Begin VB.TextBox txtDate
Height = 285
Left = 1425
Locked = -1 'True
TabIndex = 3
Top = 525
Visible = 0 'False
Width = 2460
End
Begin MSDataListLib.DataCombo dcSalesman
Height = 315
Left = 7875
TabIndex = 5
Top = 450
Width = 3105
_ExtentX = 5477
_ExtentY = 556
_Version = 393216
Style = 2
BackColor = -2147483643
ForeColor = -2147483640
Text = ""
End
Begin VB.TextBox txtNCus
Height = 210
Left = 6450
TabIndex = 59
TabStop = 0 'False
Top = 5325
Visible = 0 'False
Width = 75
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "Less"
ForeColor = &H0000011D&
Height = 240
Left = 7350
TabIndex = 67
Top = 6075
Width = 2040
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "Discount"
ForeColor = &H0000011D&
Height = 240
Left = 7350
TabIndex = 62
Top = 6375
Width = 2040
End
Begin VB.Label Labels
Alignment = 1 'Right Justify
Caption = "Remarks"
Height = 240
Index = 4
Left = -150
TabIndex = 60
Top = 6075
Width = 990
End
Begin VB.Label Labels
Alignment = 1 'Right Justify
Caption = "Van"
Height = 240
Index = 13
Left = 6600
TabIndex = 58
Top = 75
Width = 1215
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "Total Amount"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000011D&
Height = 240
Left = 7350
TabIndex = 57
Top = 6675
Width = 2040
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "Amount Paid"
ForeColor = &H0000011D&
Height = 240
Left = 7350
TabIndex = 56
Top = 6975
Width = 2040
End
Begin VB.Label Labels
Alignment = 1 'Right Justify
Caption = "Salesman"
Height = 240
Index = 18
Left = 6600
TabIndex = 48
Top = 450
Width = 1215
End
Begin VB.Line Line2
BorderColor = &H80000014&
Index = 1
X1 = 225
X2 = 10950
Y1 = 2850
Y2 = 2850
End
Begin VB.Line Line1
BorderColor = &H80000010&
BorderWidth = 2
Index = 1
X1 = 225
X2 = 10950
Y1 = 2850
Y2 = 2850
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Caption = "Sold Products"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000014&
Height = 210
Left = 300
TabIndex = 39
Top = 3525
Width = 4365
End
Begin VB.Label Label9
Alignment = 1 'Right Justify
Caption = "Balance"
ForeColor = &H0000011D&
Height = 240
Left = 7350
TabIndex = 38
Top = 7275
Width = 2040
End
Begin VB.Line Line2
BorderColor = &H80000014&
Index = 0
X1 = 225
X2 = 10950
Y1 = 900
Y2 = 900
End
Begin VB.Line Line1
BorderColor = &H80000010&
BorderWidth = 2
Index = 0
X1 = 225
X2 = 10950
Y1 = 900
Y2 = 900
End
Begin VB.Label Labels
Alignment = 1 'Right Justify
Caption = " Date"
Height = 240
Index = 1
Left = 150
TabIndex = 37
Top = 525
Width = 1215
End
Begin VB.Label Labels
Alignment = 1 'Right Justify
Caption = "Invoice No"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 0
Left = 450
TabIndex = 36
Top = 150
Width = 915
End
Begin VB.Shape Shape3
BackColor = &H80000010&
BackStyle = 1 'Opaque
BorderColor = &H80000010&
Height = 240
Left = 225
Top = 3525
Width = 10740
End
End
Attribute VB_Name = "frmInvoiceAE"
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
Public LLFK As Long 'Last Loading FK
Public LLVFK As Long 'Last Loading Van FK
Public LLDate As String
Public CloseMe As Boolean
Public ForCusAcc As Boolean
Dim PCase As Long 'Pieces per case
Dim PBox As Long 'Pieces per box
Dim old_pieces As Long 'Old pieces value
Dim old_boxes As Long 'Old boxes value
Dim old_cases As Long 'Old cases value
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
Private Sub btnSold_Click()
If nsdProduct.Text = "" Then nsdProduct.SetFocus: Exit Sub
If toNumber(txtSP.Text) <= 0 Then
MsgBox "Please enter a valid sales price.", vbExclamation
txtSP.SetFocus
Exit Sub
End If
Dim CurrRow As Integer
CurrRow = getFlexPos(Grid, 11, nsdProduct.BoundText)
'Add to grid
With Grid
If CurrRow < 0 Then
'Perform if the record is not exist
If .Rows = 2 And .TextMatrix(1, 11) = "" Then
.TextMatrix(1, 1) = nsdProduct.Text
.TextMatrix(1, 2) = nsdProduct.getSelValueAt(2)
.TextMatrix(1, 3) = txtSP.Text 'Unit price
.TextMatrix(1, 4) = txtEntry(2).Text
.TextMatrix(1, 5) = txtEntry(3).Text
.TextMatrix(1, 6) = txtEntry(4).Text
.TextMatrix(1, 7) = txtTQty.Text
.TextMatrix(1, 8) = toNumber(cbDisc.Text)
.TextMatrix(1, 9) = txtAmount.Text
.TextMatrix(1, 10) = changeYNValue(ckFree.Value)
.TextMatrix(1, 11) = nsdProduct.BoundText
.TextMatrix(1, 12) = toNumber(toNumber(cbDisc.Text) / 100) * toNumber(toNumber(txtTQty.Text) * toNumber(txtSP.Text))
.TextMatrix(1, 13) = txtSP.Tag 'Unit cost
Else
ADD_NEW_HERE:
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 1) = nsdProduct.Text
.TextMatrix(.Rows - 1, 2) = nsdProduct.getSelValueAt(2)
.TextMatrix(.Rows - 1, 3) = txtSP.Text 'Unit price
.TextMatrix(.Rows - 1, 4) = txtEntry(2).Text
.TextMatrix(.Rows - 1, 5) = txtEntry(3).Text
.TextMatrix(.Rows - 1, 6) = txtEntry(4).Text
.TextMatrix(.Rows - 1, 7) = txtTQty.Text
.TextMatrix(.Rows - 1, 8) = toNumber(cbDisc.Text)
.TextMatrix(.Rows - 1, 9) = txtAmount.Text
.TextMatrix(.Rows - 1, 10) = changeYNValue(ckFree.Value)
.TextMatrix(.Rows - 1, 11) = nsdProduct.BoundText
.TextMatrix(.Rows - 1, 12) = toNumber(toNumber(cbDisc.Text) / 100) * toNumber(toNumber(txtTQty.Text) * toNumber(txtSP.Text))
.TextMatrix(.Rows - 1, 13) = txtSP.Tag 'Unit cost
.Row = .Rows - 1
End If
'Increase the record count
cIRowCount = cIRowCount + 1
Else
'If free option is not equal or discount is not equal or sales price is not equal then add new sold item
If .TextMatrix(CurrRow, 10) <> changeYNValue(ckFree.Value) Or toNumber(.TextMatrix(CurrRow, 8)) <> toNumber(cbDisc.Text) Or toNumber(.TextMatrix(CurrRow, 3)) <> toNumber(txtSP.Text) Then
GoTo ADD_NEW_HERE
End If
If MsgBox("Invoice payment already exist.Do you want to replace it?", vbQuestion + vbYesNo) = vbYes Then
.Row = CurrRow
'Restore back the invoice amount and discount
cIAmount = cIAmount - toNumber(Grid.TextMatrix(.RowSel, 9))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -