Jump to content

Need to Store the exchange value and show in Invoice Page


Vs Nu

Recommended Posts

Hello,

My Default currency was USD But as i was paying GST (From India) i need to update the currency in INR Format in GST portal.

I had searched the community and got some luck about doing the exchange and displaying in the Invoice Page (View invoice page)  but when ever the exchange rate updates it was also getting update on the view invoice page

but i need it like the currency rate of that day should be stored for paid invoices and which should be change (for unpaid invoices only)

 

I had used the hook below : 

<?php

use Illuminate\Database\Capsule\Manager as Capsule;
function hook_currency_exchange_rates($vars) 
{
   $exchangerate = Capsule::table('tblcurrencies')
               ->where('code', 'INR')
               ->get();

   return array("exchangerate" => $exchangerate[0]->rate);
}
add_hook("ClientAreaPage", 1, "hook_currency_exchange_rates");
?>

 

in viewinvoice.tpl file i had used this

 

Quote
<tr>
<td class="background-gray" colspan="9" align="right"><strong>Total Amount In Rupees (₹) :</strong></td>
<td class="background-gray" align="left"><strong>₹{if $clientsdetails.currency eq "2"} {(($total->toNumeric())* $exchangerate)|string_format:"%.2f"} INR</strong>{/if}
</td>
</tr>

 

Please can someone help me to store the value and display it on paid invoice

Looking for your Support @brian!

Edited by Vs Nu
Link to comment
Share on other sites

I suggest:

  • create a new db table  invoice_notes , with just to fields: invoiced and exchangerate
  • in your hook, add a record to the table, inserting the required data
  • and recover the data from the table when needed

You can enrich the table with further notes and info to be displayed in the invoice (I use a similar way to add notes about VAT management)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated