26 (edited by MorkvonOrk 01/31/2010 10:58:49 am)

Re: No exchange rate

There is a little bug in the function get_exchange_rate_from_home_currency in the includes/banking.inc module. Version 2.2.4.

If you are working with only one currency you get an error-message : "Cannot retrieve exchange rate for currency as of 31/01/2010"...

Code should be :

function get_exchange_rate_from_home_currency($currency_code, $date_)
{
    if ($currency_code == get_company_currency() Or $currency_code == Null) {
        return 1.0000;
        } else {
        $date = date2sql($date_);
        $sql = "SELECT rate_buy, max(date_) as date_ FROM ".TB_PREF."exchange_rates WHERE curr_code = '$currency_code'
                AND date_ <= '$date' GROUP BY rate_buy ORDER BY date_ Desc LIMIT 1";
        $result = db_query($sql, "could not query exchange rates");

        if (db_num_rows($result) == 0)
        {
        // no stored exchange rate, just return 1
            display_error(
                sprintf(_("Cannot retrieve exchange rate for currency %s as of %s. Please add exchange rate manually on Exchange Rates page."),
                 $currency_code, $date_));
            return 1.000;
        }

        $myrow = db_fetch_row($result);
        return $myrow[0];
    }
}

Re: No exchange rate

Passing null as currency shoulbe considered as a bug. Where and when you see the error message?
Janusz

Re: No exchange rate

OK. I got the message (red message at top of form) when entering direct invoices and when entering bank deposits and then choose "client". Transactions that touch the client-accounts.

Initially I thought the problem would be solved by adding the else-clause after the initial if. But seems my systems generates empty currency-codes. I have only one currency EUR and thus no exchange table...

Re: No exchange rate

Well, I don't know where the problem can be as I cannot reproduce it. Seems the first displayed customer in customers list has empty currency set in debtors_master? Is this message displayed for every selected customer? Do you have this problem when 'Search customers list' option is on or off?

Janusz

30 (edited by doknet 02/01/2010 03:49:07 am)

Re: No exchange rate

Thanks for answering, it works perfect. It is very good this application
I hope to learn to use it and collaborate.


In company I have uncheck search customer list.

As a comment if it serves some purpose. Before changing the code as MorkvonOrk said, I clone the application site with the same soft base (linux, php, mysql) The first application site although he had added another currency (dollar) still did not work The second worked fine. (there is some cache or something in the application?).

I reiterate now everything works fine.

Many thanks

Re: No exchange rate

Javascript files are compressed and cached in company/x/js_cache directory, but this should be cleaned and restored on every login. Nice it works now for you, but still we do not know the exact source of problems.
Janusz

Re: No exchange rate

Here again the story, which I did, and gave me the error before making the change suggested by MorkvonOrk


I' Get up a new company
Create/Update Companies ->  Database Script ->  es_ES-iso-220.sql ( Chart of Accounts 2.2  espanish)

In new database, whith prefix 1_

Step to step

Create Fiscal Year create 2010
Delete all other fiscal Year. Previus  Company Setup ---> Fiscal Year: Select 2010

Banking and General Ledger -> Currencies
Create currency Pesos $ ARS 
Unchek ---> Automatic exchange rate update

Company Setup ---> Home Currency:  --> selec Pesos

In Currencies
Delete all other currencys 

Company Setup ---> Fiscal Year: Select 2010
Iventary
Create Items
Sales Price ---> Currency: Pesos (this one)

SALES
Add and Manage Customers --->  Create Client
Customer's Currency: Pesos
Sales Areas : Create Argentina

And

Direct Invoice -->
Get error
Cannot retrieve exchange rate for currency as of 01/29/2010. Please add exchange rate manually on Exchange Rates page.
What's wrong?

Transactions -> Exchange Rates

There is only one coin ( Currencie)
And the menssage

The selected currency is the company currency.
The company currency is the base currency so exchange rates cannot be set for it.

I created the new dollar coin but continued to error same I have a single currency

,
Upload  the database en http://www.ta21.com.ar/front224.sql.zip

If someone can check if there is any inconsistency
Since already thank you very much

I clone the application site with the same soft base in other server, (linux, php, mysql same) The first application site although he had added another currency (dollar) still did not work The second worked fine.


Sorry for my English

Re: No exchange rate

Hello everybody that have had this db error message.
I have found the reason for this message  "Cannot retrieve exchange rate for currency as of 31/01/2010".
It occurred when doing cash sales (that includes a payment).
There is a missing Cash Bank Account for the Default Sales Pos.
Please create one or check that you have the correct Cash Bank Account for your Sales Pos. Then it works.

This is a very rare error message. It may happen in the foreign COAs if no bank accounts are defined but a sales pos is defined with a non existing cash account. These COAs should have had an initial 'no cash' defined.
I will see if we can get a better error message.

/Joe

34 (edited by tom 02/03/2010 11:54:30 am)

Re: No exchange rate

I had that error like that.

I went to: "Banking and General Ledger" -> "Bank Accounts" and had NO selected for the "Dflt" for all accounts

thanks
-------------------------------------
Well I still get it.

"Cannot retrieve exchange rate for currency as of 02/03/2010. Please add exchange rate manually on Exchange Rates page."

From Customer Payment page.

I do have search customer list and the default customer is NULL, maybe the first one should come up by default?

tom

Re: No exchange rate

Yes, tom. We will have to test for null values in currency_code. I will fix this in /includes/banking.inc

/Joe

Re: No exchange rate

CVS Main updated with /includes/banking.inc

/Joe

Re: No exchange rate

That fixed it

Thanks!

Re: No exchange rate

You can manually add an exchange rate and everything will be OK.
Just once and for all!

Re: No exchange rate

I found a solution. There is a problem with the branch record for the client. When the sales order entry page appears there is no branch available in the drop down list even though a branch was entered into the system. After I added a second branch for the client, then it shows up in the drop down list and the exchange rate errors go away. Then I deleted the first branch record and there were no more problems. Thus, there was some problem with the first branch record that kept it from loading that triggered the exchange rate message.

Re: No exchange rate

can it possible to get Exchange rates automatically for every year data. Even the past years currnecy conversion value too.


Thanks in advance.

Subscription service based on FA
HRM CRM POS batch Themes

Re: No exchange rate

The exchange rates table is where you would need to manually put in such data but how would that be useful since you will not be entering any transactions for that period?