1

(3 replies, posted in Report Bugs here)

Was able to solve the problem. Actually, for some reason, permission on attachments repository was changed. Add the +rw permission. Solved my problem.

Hello,
This is a very weird bug and still try to understand it. Hope someone can help.
I was working on company accounting adding journal entries and attaching PDF file for each invoice entered. Frontaccounting is online. Everything was working ok (in fact it is working since months). Was able to attach and see PDF invoices in Frontaccounting.
Suddenly, with no reason, PDF attachments stopped working with error message "Failed to load PDF document".
Release number is 2.3.22.
I first suspected a corrupted attached file or a browser issue. The problem is the same whether I am using Firefox or Chrome.
The weird thing is that the problem is the same on any other computer including the one that are using a local database and installation.
After investigation, it looks like the problem is located inside /admin/attachments.php
The piece of code
echo file_get_contents(company_path(). "/attachments/".$row['unique_name']);
point to a non existing file; $row['unique_name'] return unique_name found on 0_attachments table for the file but this file does not exists under company/0/attachments/ repository.
Backups files shows exactly the same thing.
How attached file are stored?

This is and must be the same item with same stock_id. Price can be influenced by supplier discount, exchange rate change,...

For illustration, let's imagine a company such as Walmart. Store A (New-York) purchase T-shirt ABC from china at price 10$. A month later, store B (Los Angeles) purchase the same T-Shirt at 6$ (discount).  A month later, T-shirt is back at 10$ from supplier. Since Los Angeles store still has a lot of these T-Shirt in stock and New-York is out of stock, New-York purchase from LA at 8$. So LA makes profit and reduces its stock and New-York make also more profit (as compared to purchasing from chinese supplier). These stores must really share the same stock_id. From a fiscal point of view as well as management and insurance point of view, you really need to know the exact acquisition cost for a specific location.

Hello,

I have tested your bug fix with latest rep301 (Inventory Valuation Report) with $use_costed_values=1. It seems to work at least partially.

Item Cost in Inventory Valuation Report should also be calculated according to "received into" location unless you don't specify a location in the report.

To be able to reproduce the problem, just create two locations: A and B

Create one PO for 10x item P (cost 10$) received at location A and another one for same 10x item P (cost 90$) at location B.

Average item cost is 50$ for both locations A and B according to current algorithm. Inventory Valuation Report should show 100$ at location A and 900$ at B. Right now both have stock 500$.

I guess also that if all items P at location A are transferred to location B, average item cost at location B should then drop from 90$ to 50$. However Stock Valuation for both A and B location should stay the same at 1000$ with or without a transfer (considering a 0$ shipping cost between A and B).