Search code examples
htmltwitter-bootstrapaccounting

Bootstrap Table: Excel Accounting Format


I am trying to replicate the Excel accounting format in a Bootstrap table, whereas the currency sign in aligned to the far left, and the digits to the far right.

I have tried:

<td>$ <span class="text-right">123456</span></td>

But it didn't work.

Any suggestions?


Solution

  • Below, please find the number formatting you’re looking for. The {{}} are blade notation for PHP statements.

    <td><span style="float:right">{{ ($i==1) ? '$' : '' }}{{number_format($e['price_sale'], 2, '.', ',')}}</span></td>