Salary Register PDF Error

In “Salary Register” report when i click on PDF

and generate it, the currency in which the pdf is generated is “EGP”, but the default currency for the company is “INR”, also the filter in report is in “INR”

below is the pdf in “EGP”

what should i do so that the currency of PDF is in “INR”
anyone who knows the issue

Which version @Rajat96318

@NCP
image

all 13

Wait i will check in v14

Hi @Rajat96318,

It’s worked properly in v14, and if have a bug in v13 then can’t be fixed because out of support.

@NCP
can you tell the file, where the code is changed for this PDF, so that i can change in code

I think, a common code for all but if have a salary_register.html file then check it.

The issue is resolved
below is the updated code in “salary_register.html” file

{%
	var report_columns = report.get_columns_for_print();
	var company_name = frappe.defaults.get_user_default("company") || "";
%}
<div style="margin-bottom: 7px;" class="text-center">
	{%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")].header %}
</div>
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h5 class="text-center">{{ __("From") }} {%= filters.from_date %} {{ __("to") }} {%= filters.to_date %}</h5>
<hr>
<table class="table table-bordered">
	<thead>
		<tr>
			{% for(var i=1, l=report_columns.length; i<l; i++) { %}
				<th class="text-right">{%= report_columns[i].label %}</th>
			{% } %}
		</tr>
	</thead>
	<tbody>
		{% for(var j=0, k=data.length; j<k; j++) { %}
			{%
				var row = data[j];
			%}
			<tr>
				{% for(var i=1, l=report_columns.length; i<l; i++) { %}
					<td class="text-right">
						{% var fieldname = report_columns[i].fieldname; %}
						{% if (report_columns[i].fieldtype=='Currency' && !isNaN(row[fieldname])) { %}
							{%
								// Check if company name is "XYZ Company"
								if (company_name == "XYZ Company") {
									// Hardcoded to "INR" if the condition is met
									%}
									{%= format_currency(row[fieldname], "INR") %}
								{%
								} else {
									// Use default currency formatting if condition is not met
									%}
									{%= format_currency(row[fieldname]) %}
								{%
								}
							%}
						{% } else { %}
							{% if (!is_null(row[fieldname])) { %}
								{%= row[fieldname] %}
							{% } %}
						{% } %}
					</td>
				{% } %}
			</tr>
		{% } %}
	</tbody>
</table>
<p class="text-right text-muted">{{ __("Printed On") }} {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>

I knew that the issue would be in the html file itself :wink:

1 Like