Question
How to set up the Comma separator for money fields in printables
23:39 Jan 12, 2017
If you print from Orders section, the resulting money value is as follows without a comma [,] and we need such a comma in order to send money amounts to the customers. It should be $16,200.00 instead of the current $16200.00
How can we change the money format in the printable?
File attachments
Like
2 comments
00:15 Jan 13, 2017
You can change the output value with the macros.
Please check the following manual on how to add the macros and use it in printable forms.
- Go to the configuration and create a new Source Code schema.
2. Insert the following code and publish the schema.
namespace Terrasoft.Configuration
{
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using Terrasoft.Common;
using Terrasoft.Core;
using Terrasoft.Core.DB;
using Terrasoft.Core.Entities;
using Terrasoft.Core.Packages;
using Terrasoft.Core.Factories;
using System.Globalization;
[ExpressionConverterAttribute("Money")]
public class GbDateTimeNoSecondsConveter : IExpressionConverter
{
public string Evaluate(object value, string arguments = "") {
string result = ConvertValue(value);
return result;
}
static string ConvertValue(object value)
{
string result = string.Empty;
if (value != null)
{
result = value.ToString();
double number;
if (Double.TryParse(result, out number))
{
result = number.ToString("N", new CultureInfo("en-US"));
}
}
return result;
}
}
}
3. Go to the ms word designer and add the [#Money#] macros to the fields that you need to change.
4. Save the printable form.
Show all comments