Skip to main content

alameen functions

alameen ERP 10 adds 15 functions to the expression editor of the advanced report designer. They format numbers and dates the way the program does everywhere else, write a number in words, and return facts about the current user and database. You find them under the Al-Ameen category of the editor. When you select a function, the editor shows its signature and its description.

You can use them anywhere the designer accepts an expression: the expression of a control, a calculated field, or the condition of a formatting rule. For the editor itself, see The expression editor.

What to know first​

  • The result is text. ToPrice, ToQuantity, ToExchangeRate, ToBalance, ToDate, ToDateTime and ToTime return text. Format a value for display only. Compute sums, differences and comparisons on the original number or date, and format the result last.
  • The arguments have a type. The number functions accept numeric values only. The date functions accept date values only, not text that looks like a date.
  • The functions follow the program settings. Change a setting and every template follows it. Only an administrator can change the decimal places, the thousand separator and the zero options. You do not set decimal places in the template. The settings are in Program Options, on the Numbers page.

The settings the functions follow​

Setting on the Numbers pageWhat it controlsFunctions
PricesThe decimal places of prices and amounts. Default 2.ToPrice, ToBalance
QuanititiesThe decimal places of quantities. Default 2.ToQuantity
RateThe decimal places of exchange rates. Default 5.ToExchangeRate
Use Thousand Separator and Thousand SeparatorWith the box ticked, numbers show the thousand separator you chose. With the box cleared, numbers have no thousand separator.ToPrice, ToQuantity, ToExchangeRate, ToBalance
Date Format (PC)The order and the zeros of the date. See the table below.ToDate, ToDateTime
Balance Display, with Debit and CreditHow a debit or credit balance is written. See ToBalance.ToBalance
Print Zero as Symbol and Zero substitutionThe text that replaces a zero balance.ToBalance only

The setting Date Format (PC) gives these formats:

Value of Date Format (PC)Format usedExample for 5 December 2026
1-5-2015 (default)day-month-year, no leading zeros5-12-2026
01-05-2015day-month-year, with leading zeros05-12-2026
2015-5-1year-month-day, no leading zeros2026-12-5
2015-05-01year-month-day, with leading zeros2026-12-05

ToTime does not follow the date format. It always writes hours, minutes and seconds with a 24-hour hour, followed by the AM or PM mark of the program language, such as 14:30:05 PM.

The functions​

The editor shows the description of each function in the language of the program. The English descriptions are quoted here.

Format numbers​

FunctionArgumentDescription in the editor
ToPrice(Value)A number.Formats the value with the number of decimal places specified in the price settings on the Numbers tab in the application options
ToQuantity(Value)A number.Formats the value with the number of decimal places specified in the quantity settings on the Numbers tab in the application options
ToExchangeRate(Value)A number.Formats the value with the number of decimal places specified in the exchange rate settings on the Numbers tab in the application options
ToBalance(Value)A number: the balance.Formats the value according to the balance display format on the Numbers tab in the application options

ToBalance works in this order:

  1. It rounds the balance to the number of decimal places of Prices. If the rounded value is zero, it returns the Zero substitution text when Print Zero as Symbol is selected, and the number 0.00 otherwise. If Zero substitution is empty, the zero balance prints blank.
  2. For any other value, it follows Balance Display:
Balance DisplayResult for a debit balance of 1250.5Result for a credit balance of -250
Default (Credit in Negative)1,250.50-250.00
Abbreviation (D / C)1,250.50 Dr250.00 Cr
Full Name (Debit/Credit)1,250.50 Debit250.00 Credit
Customized1,250.50 followed by the text in Debit250.00 followed by the text in Credit

The Debit and Credit boxes open only with Customized. If you leave both empty, the program saves Default (Credit in Negative).

A balance of zero or more is a debit balance. A negative balance is a credit balance, and the function writes its absolute value. The result puts the amount first, then a space, then the sign text. The abbreviations and full names follow the program language: Dr and Cr in English, and م and د in Arabic.

Format dates and times​

FunctionArgumentDescription in the editor
ToDate(Value)A date.Formats the value (date only) according to the date format on the Numbers tab in the application options
ToDateTime(Value)A date with a time.Formats the value (date and time) according to the date format on the Numbers tab in the application options
ToTime(Value)A date with a time.Formats the value (time only) according to the date format on the Numbers tab in the application options

The description of ToTime mentions the date format, but the function writes the time in the fixed form described above. ToDateTime writes the date by Date Format (PC), a space, and then the time in that fixed form.

Write a number in words​

FunctionArgumentsDescription in the editor
NumberToText(Value, CurrencyId)A number, then the ID of a currency.Converts the value to words according to the specified currency ID

The currency ID is the ID of a currency card, not its name. Documents give it to the template in the hidden report parameter CurrencyId, so the usual call is NumberToText([GrandTotal], [Parameters.CurrencyId]); insert the parameter from the list of the expression editor. Packing lists get no CurrencyId, and neither does a transfer printed from the transfers print window. For types whose window has no currency box, it holds the default currency. See Advanced printing data sources. The result depends on the program language:

  • In Arabic: the word «فقط», the number in words, the name of the currency, the fraction with the name of the currency part when there is a fraction, and the words «لا غير».
  • In English and the other languages: the number in words, the name of the currency, the fraction with the name of the currency part when there is a fraction, and the word for only (Only in English). In Turkish the word for only comes first. Outside Arabic, the program uses the Latin names of the currency and its part when the card has them.
  • If the ID does not match a currency card, the result is the text <Currency not found: …> with the ID.

The step-by-step task is in Show the amount in words.

Facts about the user and the database​

These functions take no argument. Write the parentheses, such as GetUserName().

FunctionReturnsDescription in the editor
IsAdmin()True or falseReturns a Boolean value, True or False, indicating whether the current user has administrator privileges
GetUserName()TextReturns the current user's name
GetLanguage()TextReturns the current application language (ar, en, ...)
GetServerName()TextReturns the server name
GetDatabaseName()TextReturns the current database name
GetDatabaseFullName()TextReturns the current database name, including the server name
GetDatabaseDescription()TextReturns the current database description

GetLanguage() returns the two-letter code of the program language, such as ar or en.

Examples​

The examples use these settings: Prices 2, Quanitities 2, Rate 5, a comma as the thousand separator, Date Format (PC) 1-5-2015, and Balance Display Abbreviation (D / C). Field names are those of the ready procedures. See Advanced printing data sources.

ExpressionWhereResult
ToPrice([GrandTotal])A label in the footer of an invoice, in the Bill table. The grand total is 1234.5.1,234.50
ToQuantity([Quantity])A cell of the invoice items, from the Bill Items table of the field list. The quantity is 12.12.00
ToExchangeRate(3.75)Any label.3.75000
ToDate([Date])The invoice date, from the Bill table. 5 December 2026.5-12-2026
ToDateTime([Date])A date with the time 14:30:05, such as the invoice date.5-12-2026 14:30:05 PM
ToBalance([VoucherMainAccPrevBalance])A voucher, for a main account whose previous balance is -250.250.00 Cr
ToBalance([VoucherMainAccPrevBalance])The same, with a previous balance of 1250.5.1,250.50 Dr
ToBalance([VoucherMainAccPrevBalance])The same, with a previous balance of 0, and Print Zero as Symbol selected with - in Zero substitution.-
GetUserName()A label in the page footer.The name of the user who prints
IsAdmin()The visibility expression of a control.The control shows only for administrators

This page applies to alameen ERP 10, version 10.1.79.764.