Question: exception when added some code in profit function

exception when added some code in profit function

Hi, I need to add some information in the profit windows (like the cash amount...); so, I added the code in the **profit()** function in **controllers\admin\Reports.php** : ```php publi

DH

Dominique HUGO

Asked
Hi,
I need to add some information in the profit windows (like the cash amount...); so, I added the code in the **profit()** function in **controllers\admin\Reports.php** :

```php
public function profit($date = null, $warehouse_id = null, $re = null)
{
if (!$this->Owner) {
$this->session->set_flashdata('error', lang('access_denied'));
$this->sma->md();
}
if (!$date) {
$date = date('Y-m-d');
}
$this->data['costing'] = $this->reports_model->getCosting($date, $warehouse_id);
$this->data['discount'] = $this->reports_model->getOrderDiscount($date, $warehouse_id);
$this->data['expenses'] = $this->reports_model->getExpenses($date, $warehouse_id);
$this->data['returns'] = $this->reports_model->getReturns($date, $warehouse_id);
$this->data['warehouses'] = $this->site->getAllWarehouses();
$this->data['swh'] = $warehouse_id;
$this->data['date'] = $date;

// DH ADDED :
$start_date = $date;
$end_date = $date;
$this->data['total_received_cash'] = $this->reports_model->getTotalReceivedCashAmount($start_date, $end_date);
```

but I get an exception error in the new line added **getTotalReceivedCashAmount**, I don't know why as this function is in the Reports_model.php like the others .....


can you help please,

thanks in advance,

Domi.
  • MS

    Mian Saleem

    Answered
    Hello,

    > Please be informed that we don't offer support for modification or modified versions. You are allowed to do it at your own risk as per license.

    What is the exception error message? Did you added the `getTotalReceivedCashAmount` method in Reports_model.php? The line break shouldn't break `->` You can google the error message.

    Thank you
  • DH

    Dominique HUGO

    Answered
    the problem was that I had forgotten to use **$this->db->escape()** for the date -- sorry for this.

    Domi.
  • Login to Reply