Create a vb.net Project and have a form that will inherit the Sales Form. To do so, open the designer code of the form and change the inheritance property:
The default inherited form is the Windows forms base.
Change it to ComtechSolutions.VisionCore.Sales.Forms.Order
Open the form in design mode
You can see now the form in the design mode.
This will allow you to add new controls. But as much as possible do not remove the existing controls so as not to break the internal business function.
In this stage, I am adding a text box that will display the vendor ID associated for that particular item.
Its code time
You can notice that the Item stock, Committed, allocated, etc. are updated every time the selected item changed. So we will implement showing the custom fields you have added in the same manner as the fields I have mentioned.
Let say the field strVendorID from tblICInventory is a custom field. What you need to do is to load the data every time the selected Item in the grid changes.
But first, you need to load a record.
1.To load a record, create a procedure (on the CustomSales form code view) that will load existing orders. Add the following piece of code:
Private Sub CustomSales_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MyBase.ShowOrder()
End Sub
2.Now, to have the same implementation to how the stock details per item are being loaded, you need to be able to handle the event that fires when a selected item in the item grid change. The following code does that:
Private Sub RefreshItem(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles gvwInventoryItems.FocusedRowChanged
Private Sub RefreshItem(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles gvwInventoryItems.FocusedRowChanged
Dim _Inventory As New ComtechSolutions.VisionCore.BrlCore.TableControl("tblICInventory", "strProductID", "strProductID")
Dim productID As String
productID = gvwInventoryItems.GetRowCellValue(gvwInventoryItems.FocusedRowHandle, "strProductID").ToString
_Inventory.Load(productID)
Me.txtItemVendor.Text = _Inventory.Table.Rows(0)("strVendorNumber").ToString
End Sub
3.You might have notice that in the above code, we have created an instance of an object called TableControl. This works like MasterDetailTableControl with basic functionalities like retrieving data. You just need to specify the parameters upon instantiation.
4.This can also be created on design time but I always advice to do this on code time.
When you run the application you have created, make sure there is a way to call:
ComtechSolutions.VisionCore.Security.LoginForm.Show()
1.The above piece of code initialize everything necessary for database connection.
Then have a way to instantiate and show the form you have customized. Though the following code:
Dim frm As New CustomSales
frm.Show()
Look at how the custom sales form looks like in action:
The above suggestion can let you load and display the custom fields you have created in the inventory table.