How do I Increase decimal places in Inventory custom field  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

How do I Increase decimal places in Inventory custom field

Postby indikad » Fri Dec 04, 2015 10:22 pm

Trying to Increase the custom field decimal places in a inventory custom field of float type to 4 from the default 2 but my code below does not work

any help ?

Code: Select all
Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      If TypeOf JiwaForm Is JiwaInventoryUI.InventoryMaintenanceForm  Then
         Dim oInvetForm As JiwaInventoryUI.InventoryMaintenanceForm= DirectCast(JiwaForm, JiwaInventoryUI.InventoryMaintenanceForm )
         ' Store a reference to this sales order form in the business logic
         Dim formReference As New JiwaApplication.BusinessLogic.GenericObjectItem
         formReference.RecID = "InventoryForm"
         formReference.Object = oInvetForm         
         oInvetForm.Inventory.GenericObjectCollection.Add(formReference)                     
         AddHandler oInvetForm.Inventory.ReadEnd , AddressOf InventoryReadEnd
         'AddHandler oInvetForm.Inventory.CreateEnd , AddressOf InventoryCreateEnd      
      End If
    End Sub
   Private Sub InventoryReadEnd( ByVal sender As Object ,ByVal  e As System.EventArgs  )      
      Dim oInvent  As JiwaInventory.Inventory   = DirectCast(sender, JiwaInventory.Inventory )
      Dim oInventForm As JiwaInventoryUI.InventoryMaintenanceForm  = DirectCast( oInvent.GenericObjectCollection("InventoryForm").Object, JiwaInventoryUI.InventoryMaintenanceForm )
      'oInventForm.grdCustomFields.GridDecimalPlaces("Sample float", -1, 4, -1)
      oInventForm.CustomFieldsGrid.GridDecimalPlaces ("Sample float", -1, 4, -1)      
   End Sub


indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: How do I Increase decimal places in Inventory custom fie  Topic is solved

Postby Mike.Sheen » Sat Dec 05, 2015 10:06 am

You should use the FormatCell method in the CustomFieldPlugin class instead... here's an excerpt from a tile calculator plugin I wrote which sets the decimal places on an inventory custom field named "TileSize":

Code: Select all
Public Class CustomFieldPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaCustomFieldPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub FormatCell(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.FormatCell
      If TypeOf FormObject Is JiwaInventoryUI.InventoryMaintenanceForm Then
         If CustomField.PluginCustomField.Name = "TileSize" Then
            ' Set decimal places to 6
            If GridObject.ActiveSheet.Cells(Row, Col).CellType Is Nothing Then
               GridObject.ActiveSheet.Cells(Row, Col).CellType = New FarPoint.Win.Spread.CellType.NumberCellType
            End If
            DirectCast(GridObject.ActiveSheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.NumberCellType).DecimalPlaces = 6
              End If
      End If
    End Sub

    Public Sub ReadData(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.ReadData
    End Sub

    Public Sub ButtonClicked(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.ButtonClicked
    End Sub

Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: How do I Increase decimal places in Inventory custom fie

Postby indikad » Mon Dec 07, 2015 10:51 am

Thanks This works -
noting that the code needed to be in the Custom field plugin itself. ( it did not work when I used a separate plugin )

All good.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests