1 (edited by panchovilla 01/21/2017 05:39:47 pm)

Topic: Profit/Loss calculation

Hi.. I have a doubt on how the system calculates the profit/loss when closing the fiscal year. The benefit and profit is the sum of transactions of the balance accounts and not the income and costs accounts as it should be?

In the fiscal_years_db.inc file it is calculated with the following formula:


$sql = "SELECT SUM(amount) FROM ".TB_PREF."gl_trans INNER JOIN ".TB_PREF."chart_master ON account=account_code
        INNER JOIN ".TB_PREF."chart_types ON account_type=id INNER JOIN ".TB_PREF."chart_class ON class_id=cid
        WHERE ctype>=".CL_ASSETS." AND ctype <=".CL_EQUITY." AND tran_date <= '$to'";
    $result = db_query($sql, "The total balance could not be calculated");

It is the sum of the transactions from the classes Asset, Liabilities and Equities (Balance classes) and not Income, Cost and Expenses (Profit and Loss classes). I should sum the Profit and Loss classes transactions: CL_INCOME, CL_COGS and CL_EXPENSE.

Am I right?

Regards

Re: Profit/Loss calculation

Once the Profit/Loss has been calculated, it comes in as a single entry of Balance Sheet class that should match the rest of those there, with the difference matching cash on hand (debit).