Custom float field in Quote Lines does not permit decimals  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Custom float field in Quote Lines does not permit decimals  Topic is solved

Postby Atronics » Thu Nov 29, 2018 9:18 am

I have installed some custom fields into Quote Lines as type = Float. However, they do not allow a decimal input. How do I set the decimal places of these fields?
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Custom float field in Quote Lines does not permit decima

Postby Mike.Sheen » Thu Nov 29, 2018 10:47 am

There's a couple of ways to do it, but for quotes and sales orders the method which is in my opinion the easiest and most flexible is to add a handler for the LineCustomSettingValuesDisplayed event of the form and format the cells in there.

This means your plugin will need to add to the Forms tab the quote entry form. You'll also need the following code:

Code: Select all
public class FormPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaFormPlugin
{
   public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      JiwaFinancials.Jiwa.JiwaSalesUI.SalesQuote.SalesQuoteEntryForm quoteForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesQuote.SalesQuoteEntryForm)JiwaForm;
      quoteForm.LineCustomSettingValuesDisplayed += delegate(JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField customField, int Row, ref JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject) { QuoteForm_LineCustomSettingValuesDisplayed(customField, Row, GridObject, quoteForm, Plugin); };                  
    }
   
   private void QuoteForm_LineCustomSettingValuesDisplayed(JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField customField, int Row, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaSalesUI.SalesQuote.SalesQuoteEntryForm quoteForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin plugin)
   {
      JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuoteLine salesQuoteLine = quoteForm.SalesQuote.SalesQuoteLines[GridObject.get_GridText("Key", Row).ToString()];
      
      quoteForm.grdLines.GridDecimalPlaces(String.Format("{0}.{1}", plugin.Name, "Field1"), Row, salesQuoteLine.QuantityDecimalPlaces);
      quoteForm.grdLines.GridDecimalPlaces(String.Format("{0}.{1}", plugin.Name, "Field2"), Row, quoteForm.SalesQuote.SystemSettings.MoneyDecimalPlaces);
      quoteForm.grdLines.GridDecimalPlaces(String.Format("{0}.{1}", plugin.Name, "Field3"), Row, 2);      
   }
}


A sample plugin is attached.
Attachments
Plugin Quote Line Decimals.xml
(35.57 KiB) Downloaded 80 times
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Custom float field in Quote Lines does not permit decima

Postby Atronics » Thu Nov 29, 2018 11:15 am

A perfect and elegant solution.

Thanks
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 10 guests