Topic: Print Invoice Bug

Hello,
it seems there is a bug when trying to Generate a print invoice report after applying Currency Filter.

the invoice works fine when using the default currency, but when trying to print using any of the defined currencies other than the default one the system would show a white pdf report.
i am talking about report number 107.

the bug can be produced on the demo version of FA on Frontaccounting @http://demo.frontaccounting.eu

Regards.

Re: Print Invoice Bug

Hello,

I cannot reproduce this bug on the demo client neither on my environment.

Be aware that the latest invoice is presented first in both select boxes. This is because that you often will print the latest invoices.

If you use a currency filter you should be sure it will be included in the selections (from-to).

/Joe

Re: Print Invoice Bug

@Joe
Thanks for your reply but please try the following

in Customer Reports select print invoices,
then in From select SI 305 abbas and in To select SI 305 abbas

now you can print and the report would generate and the Value is 3,000.00 USD

now try to change the currency filter , lets say try to select EUR - Euro

Trying to print now would generate a white PDF report.

Re: Print Invoice Bug

This is because the report engine is started before the range selector is done. In this case nothing will be printed to the report. So you will get a blank page. It is some kind of a catch 22 situation and we can't do anything about it.

/Joe

5 (edited by Alaa 12/14/2017 03:12:51 pm)

Re: Print Invoice Bug

so the currency selector isn't of use in report 107??
i mean if we cant use it why is it there??

an easy fix to the problem would be by adding the ability save the report in excel format so we can manually add the prices in the desired currency.

Right now this report is missing the Destination selector where we can output the report in excel format, would you please consider adding it?

Re: Print Invoice Bug

The currency selector works fine if you have a range of invoices and there are invoices with that currency.

The documents are not optional for the excel destination due to the complexity.

Joe

Re: Print Invoice Bug

is there any workaround to print invoices in a non default customer's currency??
like a new report based on 107 but with the desired currency hard-coded into it .. would it work??

Re: Print Invoice Bug

Actually, if the currency is not available, the report can be programmed to skip it. PARAM_2 is the Currency and the records should be skipped if it is to be filtered out in line 104.

Re: Print Invoice Bug

Try to use the attached rep107 and provide feedback.
This method has the ability make the report quicker on currency filter doing it in the sql itself.

@joe: see if it is fit to be committed into the core.

Post's attachments

rep107.php1 10.7 kb, 4 downloads since 2017-12-15 

You don't have the permssions to download the attachments of this post.

Re: Print Invoice Bug

@apmuthu
it seems to be working, the only problem i see here is if someone wants to print only one invoice. the default currency w'll be used no matter what currency has been selected.

but i think its much better than getting a white pdf file. so maybe committing this is a good idea.

Re: Print Invoice Bug

Well, if you feel this is a bug, then we will have to rewrite almost all the documents. I don't understand why, because you use no resources if you do not print the white page. We have had this behaviour from the very beginning of FA.

BTW. the Customer filter also gives a blank page if the customer is not there.

Please tell me if we should rewrite.

/Joe

Re: Print Invoice Bug

no Joe, i don't think you should rewrite all the documents.. the systems just works and what i wanted was something different from the included file by apmuthu.
Just ignore this issue for now, maybe we could find a better way to print the customer's invoice in a different currency other than the default one.

Kind Regards.

Re: Print Invoice Bug

Even if just 1 invoice is chosen and no currency filter is in place - all currencies will be allowed - there is no change in the code / sql for this choice of no currency.

@joe: should the file be committed?

Re: Print Invoice Bug

No, if we change this file, we will have to change most of the documents and some underlying db routines regarding currency and customer choices.

We will put this on hold to a later time.

Joe

Re: Print Invoice Bug

There is no major change to this file. Just a currency filter in the where statement and an extra table join for it and that too only when the currency is chosen.

Re: Print Invoice Bug

Yes, but you need a customer filter as well. The algorithms are the same.

And we have similar routines in all documents where there are currency filters as well as customer filter.

So we put it on hold for a while.

This is not a big deal. FA has operated this way since the very beginning.

Joe

Re: Print Invoice Bug

The customer filter remains so even in my code but does that determine the currency as well? Anyone using the filters, be it customer and / or currency will know what to expect of the results of the output subset. The changes in the code here will not affect any other report as it is localised only.

Yes, it is not a big deal. We can leave it as is and the code here can be used at will by those who need it - maybe I will put it in my FA24Mods.....

Re: Print Invoice Bug

This version of the Invoice Report script - rep107.php - stands committed in my FA24Mods repo.

19 (edited by stefan 12/16/2017 05:48:59 pm)

Re: Print Invoice Bug

@Alaa, if I really understand your need, your biggest problem is the exchange rate on the date of invoice (if it's not stored for some other invoice).
An easy work arround would be if you change the function of the "Comments:" param in your changed report and manually input the exchange rate there. Of course some code changes are needed too.
Than you can make it work relatively well (it will not folow the rate changes of the selected period, if there are some). In fact the manual input can be used only for blank dates.
It will not be stored, just used to print or e-mail what you need.
I guess it is an issue of headquartes with other currency???

Re: Print Invoice Bug

@stefan
yes.. thats such a great idea and would work perfectly.

Re: Print Invoice Bug

Better still, populate the exchange rate for the currency desired into the exchange rates table for every day in the year.

Re: Print Invoice Bug

This would fully resolve it, mine is work arround. In fact only invoicing dates are needed. It is already there for non default currencies...

Re: Print Invoice Bug

Is there a weblink / service / CSV available for middle rates for each day - archives of exchange rates - so that when a date range for a currency pair is requested, it can provide rates to populate the FA exchange rates table directly for that entire period. Also for rare significant rate changes, can the last populated rate not be taken instead?

Re: Print Invoice Bug

I think using the latest exchange rate in the exchange_rates.php page is great.