feat(UAE VAT 21): add fixed width to columns

This commit is contained in:
hasnain2808 2020-10-01 12:44:39 +05:30
parent 10a3a338b6
commit 8cc6f2b388
3 changed files with 53 additions and 36 deletions

View File

@ -1,21 +1,27 @@
{%
var report_columns = report.get_columns_for_print();
report_columns = report_columns.filter(col => !col.hidden);
if (report_columns.length > 8) {
frappe.throw(__("Too many columns. Export the report and print it using a spreadsheet application."));
}
%}
<style>
.print-format {
padding: 10mm;
font-size: 8.0pt !important;
font-family: Tahoma, sans-serif;
}
</style>
<h1 style="margin-top:0; text-align: center;">{%= __(report.report_name) %}</h1>
<h3 style="margin-top:0">{%= __("VAT on Sales and All Other Outputs") %}</h2>
<h3 style="margin-top:0; font-weight:500">{%= __("VAT on Sales and All Other Outputs") %}</h2>
<table class="table table-bordered">
<thead>
{% for (let i=0; i<report_columns.length; i++) { %}
<th >{%= report_columns[i].label %}</th>
<th style="width: 13">{%= report_columns[0].label %}</th>
<th style="width: {%= 100 - (report_columns.length - 1) * 13%}%">{%= report_columns[1].label %}</th>
{% for (let i=2; i<report_columns.length; i++) { %}
<th style="width: 13">{%= report_columns[i].label %}</th>
{% } %}
</thead>
@ -38,17 +44,20 @@
</tbody>
</table>
<h3 style="margin-top:0">{%= __("VAT on Expenses and All Other Inputs") %}</h2>
<h3 style="margin-top:0; font-weight:500">{%= __("VAT on Expenses and All Other Inputs") %}</h2>
<table class="table table-bordered">
<thead>
{% for (let i=0; i<report_columns.length; i++) { %}
<th >{%= report_columns[i].label %}</th>
<th style="width: 13">{%= report_columns[0].label %}</th>
<th style="width: {%= 100 - (report_columns.length - 1) * 13%}%">{%= report_columns[1].label %}</th>
{% for (let i=2; i<report_columns.length; i++) { %}
<th style="width: 13">{%= report_columns[i].label %}</th>
{% } %}
</thead>
<tbody>
{% for (let j=13; j<data.length; j++) { %}
{% for (let j=14; j<data.length; j++) { %}
{%
var row = data[j];
%}

View File

@ -18,7 +18,6 @@ frappe.query_reports["UAE VAT 21"] = {
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -3),
"width": "80"
},
{
"fieldname": "to_date",

View File

@ -17,27 +17,29 @@ def get_columns():
return [
{
"fieldname": "no",
"label": "No",
"label": _("No"),
"fieldtype": "Data",
"width": 50
},
{
"fieldname": "legend",
"label": "Legend",
"label": _("Legend"),
"fieldtype": "Data",
"width": 300
},
{
"fieldname": "amount",
"label": "Amount (AED)",
"label": _("Amount (AED)"),
"fieldtype": "Currency",
"width": 100
"width": 125,
"options": "currency"
},
{
"fieldname": "vat_amount",
"label": "VAT Amount (AED)",
"label": _("VAT Amount (AED)"),
"fieldtype": "Currency",
"width": 100
"width": 150,
"options": "currency"
}
]
@ -46,7 +48,7 @@ def get_data(filters = None):
data = []
data.append({
"no": '',
"legend": 'VAT on Sales and All Other Outputs',
"legend": _('VAT on Sales and All Other Outputs'),
"amount": '',
"vat_amount": ''
})
@ -64,14 +66,14 @@ def get_data(filters = None):
for d, emirate in enumerate(emirates, 97):
if emirate in amounts_by_emirate:
amounts_by_emirate[emirate]["no"] = f'1{chr(d)}'
amounts_by_emirate[emirate]["legend"] = f'Standard rated supplies in {emirate}'
amounts_by_emirate[emirate]["no"] = _(f'1{chr(d)}')
amounts_by_emirate[emirate]["legend"] = _(f'Standard rated supplies in {emirate}')
data.append(amounts_by_emirate[emirate])
else:
data.append(
{
"no": f'1{chr(d)}',
"legend": f'Standard rated supplies in {emirate}',
"no": _(f'1{chr(d)}'),
"legend": _(f'Standard rated supplies in {emirate}'),
"amount": 0,
"vat_amount": 0
}
@ -79,8 +81,8 @@ def get_data(filters = None):
data.append(
{
"no": '2',
"legend": 'Tax Refunds provided to Tourists under the Tax Refunds for Tourists Scheme',
"no": _('2'),
"legend": _('Tax Refunds provided to Tourists under the Tax Refunds for Tourists Scheme'),
"amount": (-1) * get_tourist_tax_return_total(filters),
"vat_amount": (-1) * get_tourist_tax_return_tax(filters)
}
@ -88,8 +90,8 @@ def get_data(filters = None):
data.append(
{
"no": '3',
"legend": 'Supplies subject to the reverse charge provision',
"no": _('3'),
"legend": _('Supplies subject to the reverse charge provision'),
"amount": get_reverse_charge_total(filters),
"vat_amount": get_reverse_charge_tax(filters)
}
@ -97,8 +99,8 @@ def get_data(filters = None):
data.append(
{
"no": '4',
"legend": 'Zero Rated',
"no": _('4'),
"legend": _('Zero Rated'),
"amount": get_zero_rated_total(filters),
"vat_amount": "-"
}
@ -106,16 +108,23 @@ def get_data(filters = None):
data.append(
{
"no": '5',
"legend": 'Exempt Supplies',
"no": _('5'),
"legend": _('Exempt Supplies'),
"amount": get_exempt_total(filters),
"vat_amount": "-"
}
)
data.append({
"no": '',
"legend": 'VAT on Expenses and All Other Inputs',
"no": _(''),
"legend": _(''),
"amount": '',
"vat_amount": ''
})
data.append({
"no": _(''),
"legend": _('VAT on Expenses and All Other Inputs'),
"amount": '',
"vat_amount": ''
})
@ -123,7 +132,7 @@ def get_data(filters = None):
data.append(
{
"no": '9',
"legend": 'Standard Rated Expenses',
"legend": _('Standard Rated Expenses'),
"amount": get_standard_rated_expenses_total(filters),
"vat_amount": get_standard_rated_expenses_tax(filters)
}
@ -131,8 +140,8 @@ def get_data(filters = None):
data.append(
{
"no": '10',
"legend": 'Supplies subject to the reverse charge provision',
"no": _('10'),
"legend": _('Supplies subject to the reverse charge provision'),
"amount": get_reverse_charge_recoverable_total(filters),
"vat_amount": get_reverse_charge_recoverable_tax(filters)
}