Topic: Amount in words in Invoice

I'm really happy with this great piece of software and very much interested to use this, but I'm not getting one important feature for me. That is,  "amount in words". I found that, in the invoice the "Total invoice" I mean final amount of the invoice is only in number, but I need that in amount in words along with numbers.

Is there any way to get that? If so, then how can I get that? Please help me anyone.

Thanks in advance.

Re: Amount in words in Invoice

You can fix it in file includes/ui_view.inc about line 830 changing it to

    if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT 
                || $document == ST_CHEQUE || $document == ST_SALESINVOICE))

Janusz

Re: Amount in words in Invoice

WOW!!! Great reply indeed. Really grateful to you. Thanks.

Re: Amount in words in Invoice

Any reason why this has not made it to the HG repo?

The file is:
includes/ui/ui_view.inc and the line to be changed is line no. 793:

     if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE))

to

     if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE || $document == ST_SALESINVOICE))

Re: Amount in words in Invoice

This is because this change is applicable only in some countries, while in rest it is not. And can be implemented in country specific lang/XXXX/locale.inc file when needed.

Janusz

Re: Amount in words in Invoice

It would be nice to have a setting to be able to select in which documents we would like to have it.

Re: Amount in words in Invoice

itronics wrote:

This is because this change is applicable only in some countries, while in rest it is not. And can be implemented in country specific lang/XXXX/locale.inc file when needed.

Janusz

How do you do that for the default (English) language? It doesn't have a folder.

I tried creating one and adding its path to installed_languages.inc but I doesn't pick it up.

Re: Amount in words in Invoice

The default English language one is available at lang/new_language_template/locale.inc and will possibly be taken when no specific one a any chosen language is unavailable.

Re: Amount in words in Invoice

apmuthu wrote:

The default English language one is available at lang/new_language_template/locale.inc and will possibly be taken when no specific one a any chosen language is unavailable.

It does not work.

10 (edited by apmuthu 07/16/2016 02:31:48 pm)

Re: Amount in words in Invoice

Copy the locale file to say lang/en_US/locale.inc and edit the first method's name:

class hooks_xx_XX extends hooks {

to

class hooks_en_US extends hooks {

Now check it out by choosing the specific language en_US as US English in FA.

Re: Amount in words in Invoice

apmuthu wrote:

Copy the locale file to say lang/en_US/locale.inc and edit the first method's name:

class hooks_xx_XX extends hooks {

to

class hooks_en_US extends hooks {

Now check it out by choosing the specific language en_US as US English in FA.


Hi,

My question was how to have it without choosing the specific language en_US as US English in FA.
How can we have it while choosing the Default "English" language?

12 (edited by apmuthu 07/17/2016 03:38:03 am)

Re: Amount in words in Invoice

First, does the language specific option work?
Second, the default language is "C" which must exist in your lang/installed_languages.inc like:

<?php

/* How to make new entries here for non-packaged languages:

-- 'code' should match the name of the directory for the language under \lang
.-- 'name' is the name that will be displayed in the language selection list (in Users and Display Setup)
-- 'rtl' only needs to be set for right-to-left languages like Arabic and Hebrew
-- 'encoding' used in translation file
-- 'version' always set to '' for manually installed languages.
-- 'path' installation path related to FA root (e.g. 'lang/en_US').
*/


$installed_languages = array (
  0 => 
  array (
    'code' => 'C',
    'name' => 'English',
    'encoding' => 'iso-8859-1',
  ),
);

$dflt_lang = 'C';
?>

Now we need to study the code as to where these routines in the said file are called and how the defaults get assumed.

The file locale.inc is "included" in the
1. function install_hooks() in the file includes/hooks.inc
2. function set_language($code) in the file includes/lang/language.php

Re: Amount in words in Invoice

1. Yes, the language specific option works.

2. Why is the name "C" and not "default"?

I created folder "/lang/C" and added the file locale.inc in it.

class hooks_C extends hooks {

It works! Thanks.

14 (edited by apmuthu 07/17/2016 03:03:39 pm)

Re: Amount in words in Invoice

Thanks for the perseverance and testing.

Linux calls it "C" perhaps for "common" or just "C" as in C Language..... where it all started.

@joe: try to make this as part of the codebase or as comments in the generated lang/languages_installed.inc file.

Re: Amount in words in Invoice

apmuthu wrote:

Any reason why this has not made it to the HG repo?

The file is:
includes/ui/ui_view.inc and the line to be changed is line no. 793:

     if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE))

to

     if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE || $document == ST_SALESINVOICE))

amount in words does not show in the Sales Invoice, although it shows on the others. Do I need to change something else? I am running FA 2.4.3.

Thanks

Re: Amount in words in Invoice

I don't know about 2.4.3 but first of all check whether it shows when you set user languge and system default language to English 'C' .
If it works - something is wrong with your locale amount in words.

Re: Amount in words in Invoice

Thanks Stefan,

My language is English C both for the user and system and its also the default language. I am just wondering why its only Sales Invoice that does not show.. ? It shows for Remittance, Receipts and checks.

Re: Amount in words in Invoice

You quoted a reply...
What did you do? You tried with the mentioned file from the repo or you changed the code in the file of your system?

If you tried with the mentioned file, it's still not changed to add words to invoices.
You have to find it and change the mentioned code. When reply was made apmuthu mentioned line 793 but it obviously was quoted before some other changes which increased the lines.
As of today it is at line 829.

Re: Amount in words in Invoice

I actually edited the file includes/ui/ui_view.inc and this is a copy of the line at position 865 of the file:


    // Only usefor Remittance and Receipts as default
    if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE || $document == ST_SALESINVOICE))
        return "";
    if ($amount < 0 || $amount > 999999999999)
        return "";
    $dec = user_price_dec();

Re: Amount in words in Invoice

@rafat: FA now uses Sourceforge's Git and is mirrored on GitHub.

If the price hook exists for your locale, then it would automatically come. Only otherwise will the rest of the function price_in_words be executed when the default for the Invoices is needed to be overridden by my mod.

A more elegant mod version for Line 865 would be:

if (!in_array($document, array(ST_SUPPAYMENT, ST_CUSTPAYMENT, ST_CHEQUE, ST_SALESINVOICE))

The function price_in_words() that finally gets invoked if present is available as a skeleton in lang/new_language_template/locale.inc.

@joe: any reason why the Invoice did not default to the words like the others?

Re: Amount in words in Invoice

Yes, the reason for not including this info on Sales Invoices is that normally you don't like or need this info on Invoices.

Joe

Re: Amount in words in Invoice

What is the standard procedure to include it in the invoice? Must we edit it like here or in the repXXX file in any different way? Should it be some choice in the company setup as candidates for the sys_prefs table?

Re: Amount in words in Invoice

During the past 10 years this is the first time I hear that this info is needed on an Invoice.

I know that this info on Receipts and Remittances are needed.

Joe

Re: Amount in words in Invoice

@rafat if I remember well there was some session or cache issue with this filtering - delayed change.
If it's still not working and for you amount in words is important, you can simply comment the line and it will be active for all documents.

Re: Amount in words in Invoice

Stefan,

Which line to comment you are referencing to? Amount in words is important for me because one of my biggest customers insists that I do. BTW I am new to FA and accounting in general. I am running a small business and FA is perfect for me.

Thanks