admin@anvationlabs.com wrote:

Agree. It's a similar issue. Looks like the solution you suggested is not implemented yet.

I have found another workaround though. Let both the taxes fall in the same group and same type. That means when creating a PO both taxes will apply. Just add a note in the memo that only one will be used on invoicing.
When the items are received and invoiced, the tax amounts are editable - so make the one which is not applicable 0. That way there are no duplicate items or vendors and the taxes also reflect the right amount.

That works only when you have one item, or when all the items will be charged the same VAT.

This is a similar problem that I have posted about in the other link.
https://frontaccounting.com/punbb/viewtopic.php?id=6067

And the solution IMHO is to simply create a additional column that would allow you to select the proper VAT/CST code for that entry.
I reason that when an item is brought from the database table, the tax code is retrieved as well, so if the tax code is modified while the entry is captured then the rest of the process can continue as usual.

Carmelo

joe wrote:

If you want to report a 0 tax sales/purchases amount, then you should create a 0% tax type and include that into a group.

There are more explanation in the wiki regarding this.

Joe

Thanks Joe,
However, when one uses the Supplier Invoice to capture an Invoice, the results won't be correct. Let's say I order 10 items and one is required as capital expense. These items pay VAT. So when I use the Supplier Invoice and enter 9 Items under COGS and one of the items under Capital Expense. Now, I have to enter the two transactions for the different VAT. 9 items under the category of VAT for resale and one item for VAT Capital Expense.

The Supplier Invoice does not support this and the results would be incorrect.

What I am suggesting is that on each item entry a column that would allow the user to change the VAT category is added in order to allow for such requirements.

Thank you
Carmelo

apmuthu wrote:

Check out the equivalent report in FA 2.4 and see if it does what you want.

Whatever means you use, the taxman can still assume cheating on all such tax-less invoices. Choose a country where there is no tax (atleast for overseas transactions) and do business from there! Better no audit than bad audit (corrupt government audits!)

What is the status of 2.4? Is it still in Beta?

With regards to cheating by choosing a country with no tax, I don't think it ethical, good business or worth the risk to cheat. Ideally the application supports the proper way to enter transactions.

I did try the Quick Entry as you suggested earlier, at the end of the exercise I was still unsure that the results were correct. You see as a taxable person within the EU, I am responsible to report purchases from other EU countries, even though no tax is paid to the supplier. There are mechanisms within the EU to check reporting and with the aid of computers, checks are done much more easy.

Carmelo

Apmuthu, thanks for your effort in solving this.
The solutions you provide may solve the amounts problem but should a TAX man inspection follow, it would be difficult to explain the transactions and may be viewed as tax cheating.

Ideally, transactions are entered correctly from the beginning. I don't know how much work is required to add the VAT/TAX column as I suggested in my original post. It seems that for the Direct Invoice changing the TAX rate pointer is not that difficult. Unfortunately I am not confident enough to do it myself. The Supplier Invoice might require more changes to have that included as well.

Carmelo

apmuthu wrote:

Assume everything bought is for resale at first. When you want to use it for Office purposes, then make an issue to Office Use and credit back the VAT in a Quick entry (if it is a common occurrence) for such issues or in a Journal Voucher (if it is once in a blue moon).

Thanks apmuthu, however, that does not solve the problem as correcting through Journal Entries will not show proper results in the TAX report.

Hi,
Certain countries require separation of VAT spent for Items to be resold; Office services and Capital Expense.

An example:
A company purchases 10 mobile phones, 9 for resale and one for office use.
Currently one has to create two different items, one with the VAT for resale and another item for the same mobile phone but with the VAT selected for Office Use.

Within the "Direct Purchase Invoice Entry", is it possible to have another column, right after the Price Before Tax that would contain a drop-down with all the possible VAT entries? When an Item is selected the VAT type shown would be the default for that item.

The same for the Supplier Invoice. Currently VAT entries will have to be entered separately with the problem that Items that are 0% VAT are not included in the VAT reports. So, would it be possible to have the VAT column right after the Amount column?

I don't think that the above would require any changes in the database as currently VAT/TAX data is stored already on a per item basis.

TIA
Carmelo

The way I do it is to enter the discount on another line and enter a negative amount.

See examples here:
http://cleversolutions.eu/img/Invoice-discount.png
http://cleversolutions.eu/img/Invoice-d … -print.png

Thanks apmuthu,
The link the you provided for ECB only provides the rate for the current day.
Therefore it is impossible for FA to extract a rate for a different day using that URL.

My original observation was (and still is) that the GET button on the Exchange Rate screen is misleading.
It should be disabled if the date in the "Date to Use From" is not the current date.

What do you think?

Carmelo

Thanks Apmuthu for sending in the snapshot.
I checked that against what I had and it looked the same, but just in case I installed the snapshot on another domain, with the same results.

I don't think there is a way around it as ECB do not offer ROE for other days in the same way as they offer for the current date.

apmuthu wrote:

For records and settlements, even if there are no transactions/invoices, every day's exchange rate may be got.

Apmuthu, it is not working for me. I am running FA 2.3.24. And as I reported in my post, past requests for ROE give an error.

Any suggestions?

Thanks RandomName for your insight.
However, things are not always as simple as you make them to be.
For example my Supplier bills me in US$ and I have 30 days credit, still I want to know what the value of the bill in EUR is and that is only done if I get the rate of exchange.
After payment, the story is different of course, as then we would have the real rate of exchange.

Hi,
Started working with foreign exchange transactions. Everytime I create an invoice (past dated), FA reports that it cannot get the exchange rate and instructs to enter the amount manually. After checking the ECB it transpired that ECB only provide the day's exchange rates in the xml format required.

However, on the Exchange Rates screen, one is given the choice to choose a date and "Get" the exchange.
This is incorrect as the "Get" button only gets today's rate of exchange. That little button requires an explanation and warning that only today's exchange is extracted from the provider.

It is noted that when an invoice is created with today's date, the Rate of Exchange is automatically extracted. Therefore we can do without the "Get" button altogether unless we want to get the day's rate without issuing invoices.

What are your views?

Carmelo

While apmuthu's solution works fine, it leaves a large gap between the Price and the Total.

I made the following changes to remove the Discount column:

Edit the file reporting/includes/doctext.inc from (line 28):

    // default item column headers
    $this->headers = array(_("Item Code"), _("Item Description"), _("Quantity"),
        _("Unit"), _("Price"), _("Discount %"), _("Total"));

to:

    // default item column headers
    $this->headers = array(_("Item Code"), _("Item Description"), "", _("Quantity"),
         _("Unit"), _("Price"), _("Total"));

Then in reporting/rep107.php change the following from (line 58):

    $cols = array(4, 60, 225, 300, 325, 385, 450, 515);

    // $headers in doctext.inc
    $aligns = array('left',    'left',    'right', 'left', 'right', 'right', 'right');

to:

    $cols = array(4, 60, 225, 300, 365, 385, 450, 515);

    // $headers in doctext.inc
    $aligns = array('left',    'left',    'right', 'right', 'right', 'right', 'right');

and from (line 119):

                $oldrow = $rep->row;
                $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2);
                $newrow = $rep->row;
                $rep->row = $oldrow;
                if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0)
                {
                    $rep->TextCol(2, 3,    $DisplayQty, -2);
                    $rep->TextCol(3, 4,    $myrow2['units'], -2);
                    $rep->TextCol(4, 5,    $DisplayPrice, -2);
                    $rep->TextCol(5, 6,    $DisplayDiscount, -2);
                    $rep->TextCol(6, 7,    $DisplayNet, -2);
                }    
                $rep->row = $newrow;

to:

                    $oldrow = $rep->row;
                    $rep->TextColLines(1, 3, $myrow2['StockDescription'], -2);
                    $newrow = $rep->row;
                    $rep->row = $oldrow;
                    if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0)
                    {
                        $rep->TextCol(3, 4,    $DisplayQty, -2);
                        $rep->TextCol(4, 5,    $myrow2['units'], -2);
                        $rep->TextCol(5, 6,    $DisplayPrice, -2);
                        //$rep->TextCol(5, 6,    $DisplayDiscount, -2);
                        $rep->TextCol(6, 7,    $DisplayNet, -2);
                    }    
                    $rep->row = $newrow;

With these modifications you will get more space for the item description as well.

Hope this helps.
Carmelo

15

(22 replies, posted in Reporting)

Hi apmuthu, that was the reason of my hesitation to share publicly the mod smile
Although there is a check for legal characters and one has to know the filename in order to be able to download it.
But obviously, I have to work more on that issue and will be updating the file to include more security.

carmelo

16

(22 replies, posted in Reporting)

Here is what I did:

I created a file in fa/reporting called xlssend.php containing the following code:

<?php
$filename = htmlspecialchars($_GET['fn']);
$unique = htmlspecialchars($_GET['un']);
    header("Content-type: application/vnd.ms-excel");
    header("Content-Disposition: attachment; filename='$filename'" );
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
    header("Pragma: public");
    echo file_get_contents($unique);
?>

Then I modified the file FA/reporting/prn_redirect.php as follows:

if (isset($_GET['xls']))
{   
    $filename = $_GET['filename'];
    $unique_name = preg_replace('/[^0-9a-z.]/i', '', $_GET['unique']);
    $path =  company_path(). '/pdf_files/';
//      header("Content-type: application/vnd.ms-excel");
//    header("Content-Disposition: attachment; filename='$filename'" );
//    header("Expires: 0");
//    header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
//    header("Pragma: public");
//     echo file_get_contents($path.$unique_name);

    header("Location: xlssend.php?fn=$filename&un=$path$unique_name"); /* Redirect browser */ 
    exit();
}
elseif (isset($_GET['xml']))

That's it.
Hope this will be useful for others.

Carmelo

17

(22 replies, posted in Reporting)

Thanks Joe.
My fix is simply moving out that part of the file that downloads the .xls file.
According to my research there is something that is generating the spaces and for some reason they remain in the buffer.

Moving it out was the only way to get rid of them.

Carmelo

18

(22 replies, posted in Reporting)

P R O B L E M   S O L V E D

I created another file that handles just the download of the excel file and passed the necessary parameters to it.

Now file downloads as it should and opens into Excel without a hitch.

I can share the code with anyone who is having similar problems.

Carmelo

19

(22 replies, posted in Reporting)

apmuthu wrote:

Replace the line with:

$abc = "Content-Disposition: attachment; filename='$filename'";
header($abc);

Same results sad

I have done more tests as follows:

I inserted an echo 'Testing'; right after
If (isset(G_GET['xls']))
{

and tried again a report.
Now the file contains 4 spaces and Testing.
Then I added the following commands after the echo line and or before the first header line:

flush();
ob_clean();
ob_end_clean();

For all of the above, only the four spaces are prepended to the file.

I believe that somehow, these four spaces are being sent to the browser from a different part of the code and the flush or the ob_clean is not clearing these spaces from the buffers.

I come to this conclusion because the spaces were added even before the word 'Testing' sent before the filename was created.

20

(22 replies, posted in Reporting)

Tried the quotes. Exactly the same results.

sad

21

(22 replies, posted in Reporting)

apmuthu wrote:

This is a browser encoding issue. Try to set the browser encoding to Western and then to Unicode and see the difference. Also what platforms and browsers have you tried? What about a browser in Linux? The major ones - IE 8, FF24+, Chrome (I haven't tesed it), etc should have their own quirks for encoding settings. Also see if there are any line endings that may be dos instead of unix style in the scripts.

Also try to upload a good xls file to the server and download it back to see if there are any differences.

Thanks apmuthu. I know that the file generated by FA on the Ubuntu server is good as when I downloaded it to my PC using Filezilla the file opened in Excel.
Also, when I created the few lines of php code in a separate file to download the file generated by FA through my browser, the file opened in Excel.
Then when I changed the code in FA to use the readfile function (like in the php file I created) the spaces appeared again.

For this reason I don't think that it is a browser problem or an encoding problem. I do think, though, that FA is setting something internally and is causing the 4 spaces to be prepended to the file.

Carmelo

22

(22 replies, posted in Reporting)

Here's an update ....

So I created the following file on the server:

<?php
    header('Content-type: application/vnd.ms-excel');
    header('Content-Disposition: attachment; filename="test.xls"');
    readfile('pdf_files/test.xls');
?>

called the file and it works. It sends the file and opens in Excel

So I changed prn_redirect.php to be like the above and the spaces where still being added at the beginning of the file.
This means that there is some setting within FA that is causing this.

I did a lot of research online trying to find what is causing this problem, but I cannot find a solution.
Any assistance would be greatly appreciated.

TIA
Carmelo

23

(22 replies, posted in Reporting)

I'm still trying to find a solution for this problem.
I started again check what is actually written in the files at various stages.
If I pick the file as written in /company/x/pdf_files and transfer it via ftp or sftp to my local PC, the file opens in Excel straightaway.
However, if I use the file that is downloaded through FA, then I find the dreaded 4 spaces at the beginning of the file. No other changes occur, just these 4 spaces.

Any idea what could be adding these spaces? I don't think it is a locale problem as there are no changes in the rest of the file.

TIA
Carmelo

24

(22 replies, posted in Reporting)

Thanks apmuthu for your help.
I converted all the tables and data but the problem remained.

I don't understand why the extra four spaces at the beginning of the xls file.
Do you think these are generated from the database? The first characters tell the Excel program that it is an excel sheet. At this point the database is not playing any part yet.

Which php file is responsible for writing the file?

TIA
Carmelo

25

(22 replies, posted in Reporting)

apmuthu wrote:

Which version of FA are you using. What are your client and server platforms and versions of php/mysql used? What collation is your database on? You might be getting utf-8 and latin1 mixed up.

FA version: 2.3.22
Server: Ubuntu 14.4LTS
MySQL: 5.5.40
PHP: 5.5.9-1
Client: Firefox, Chrome and IE

Collation ... hmmm I have some tables utf8 and some latin1. I wonder how did this happen.

Is there an easy way to convert everything to utf8?

TIA
Carmelo