Lasso Soft Inc. > Home

[FormatAccounting]

LinkFormatAccounting
AuthorJustin Dennis
CategoryString
Version7.x
LicensePublic Domain
Posted13 Oct 2006
Updated13 Oct 2006
More by this author...

Description

This tag easily displays any decimal in an accounting format similar to that used by Microsoft Excel. Negative numbers are enclosed in parenthesis and positive numbers are padded left and right with space equal to the space taken up by parenthesis. It's designed to be used with a font such as Verdana or other fixed-width font so that decimal points line up correctly when positive and negative numbers are displayed in a column.

Sample Usage

[Var: 'myDecimal' = decimal('-1234.56')]
[FormatAccounting: $myDecimal]

-> (1,234.56)

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

setformat(-groupchar=',', -precision='2');
	if(#new_amount < 0);
		return('(' + string_removeleading(#new_amount, -pattern='-') + ')');
	else;
		return('(' + string(#new_amount) + ')');
	/if;
/define_tag;

?>

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft