Warning: strpos() [function.strpos]: needle is not a string or an integer in /home/beardedd/public_html/home/comments.php on line 34
hOme.beardedDonkey - HOWTO Add Receipt Links in the Expense View for ExpenseManager
HOWTO Add Receipt Links in the Expense View for ExpenseManager 
This post details how to add direct links for records that have a receipt value in Expense Manager expense view.


Note: You will need access to the http server that your Expense Manager software is on to make these changes.

1. Log in to your http server and open the following file in a text editor: <http root>/<expenseManager root>/application/modules/expenses/views/index.php
2. From line 8 to line 10 you will find lines that are 'echo'ing the values from the database records. The field names from the expenses table in the database correlates to the data names in this file. You access the value of a field for each record by using: $value->fieldName
3. Change the field name as required. To access the receipt value, use: $value->upload_receipt
4. To add a link to each record that has receipt data, use the following code inside <?php ... ?> brackets:

if (!empty($value->upload_receipt)) { echo "<a href=\"".base_url().'assets/images/'.$value->upload_receipt."\" target=\"_blank\">[R]</a>"; }

This example will put a hyperlink label: [R] wherever you put it in the table output. When the receipt link is clicked, it will be opened in a new tab in the browser.
5. Example: to add the receipt link after the description, change the $value->description line from:

<td><?php echo $value->description; ?></td>

to:

<td><?php echo $value->description; if (!empty($value->upload_receipt)) { echo "<a href=\"".base_url().'assets/images/'.$value->upload_receipt."\" target=\"_blank\">[R]</a>"; } ?></td>

6. Save file and refresh page to see changes.

Additional Examples

- Add receipt link to Amount column, right align Amounts values and display Amount values with 2 decimal places:

<td align="right"><?php echo number_format((float)$value->amount, 2, '.', ''); if (!empty($value->upload_receipt)) { echo " <a href=\"".base_url().'assets/images/'.$value->upload_receipt."\" target=\"_blank\">[R]</a>"; } ?></td>

Evernote: HOWTO Add Receipt Links in the Expense View for ExpenseManager

Comments 
Comments are not available for this entry.