Added Truncated Description to Expense listing #203

This commit is contained in:
johnnyq 2021-11-18 17:56:02 -05:00
parent 604d2a7417
commit 3ca92cd252
2 changed files with 3 additions and 1 deletions

View File

@ -147,6 +147,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=expense_date&o=<?php echo $disp; ?>">Date</a></th>
<th class="text-right"><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=expense_amount&o=<?php echo $disp; ?>">Amount</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Vendor</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=expense_description&o=<?php echo $disp; ?>">Description</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=category_name&o=<?php echo $disp; ?>">Category</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=account_name&o=<?php echo $disp; ?>">Account</a></th>
<th class="text-center">Action</th>
@ -182,6 +183,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $receipt_attached; ?> <a class="text-dark" href="#" data-toggle="modal" data-target="#editExpenseModal<?php echo $expense_id; ?>"><?php echo $expense_date; ?></a></td>
<td class="text-right">$<?php echo number_format($expense_amount,2); ?></td>
<td><?php echo $vendor_name; ?></td>
<td><?php echo truncate($expense_description,50); ?></td>
<td><?php echo $category_name; ?></td>
<td><?php echo $account_name; ?></td>
<td>

View File

@ -173,7 +173,7 @@ function get_device(){
}
}
function truncate($text, $chars = 25) {
function truncate($text, $chars) {
if (strlen($text) <= $chars) {
return $text;
}