Adding modifications to the xlsx report

This commit is contained in:
Mazen Abdo 2025-11-06 08:49:17 +02:00
parent 4e449a3772
commit 64774e612b
1 changed files with 23 additions and 36 deletions

View File

@ -37,8 +37,7 @@ class PayrollBankAlbiladReportXlsx(models.AbstractModel):
})
format2 = workbook.add_format({
'font_size': 11, 'bottom': True, 'right': True, 'left': True, 'top': True,
'align': 'center', 'bold': True, 'valign': 'vcenter',
'bg_color': 'blue', 'font_color': 'white'
'align': 'center', 'bold': True, 'valign': 'vcenter'
})
format3 = workbook.add_format({
'font_size': 14, 'bottom': True, 'right': True, 'left': True, 'top': True,
@ -55,19 +54,7 @@ class PayrollBankAlbiladReportXlsx(models.AbstractModel):
sheet.set_column('B:B', 5)
sheet.set_column('C:L', 20)
# Add payroll header with date range and blue background
if report_type == 'salary':
sheet.merge_range('E3:H3', 'مسير البنك للرواتب' + ' ' + str(date_from) + ' - ' + str(date_to), format2)
elif report_type == 'allowance':
sheet.merge_range('E3:H3', 'مسير البنك للحوافز' + ' ' + str(date_from) + ' - ' + str(date_to), format2)
elif report_type == 'overtime':
sheet.merge_range('E3:H3', 'مسير البنك للعمل الإضافي' + ' ' + str(date_from) + ' - ' + str(date_to), format2)
elif report_type == 'training':
sheet.merge_range('E3:H3', 'مسير البنك للتدريب' + ' ' + str(date_from) + ' - ' + str(date_to), format2)
elif report_type == 'mission':
sheet.merge_range('E3:H3', 'مسير البنك لمهام العمل' + ' ' + str(date_from) + ' - ' + str(date_to), format2)
row = 4
row = 2
if no_details:
# With details section
@ -163,30 +150,30 @@ class PayrollBankAlbiladReportXlsx(models.AbstractModel):
row = self._write_training_data(sheet, row, date_from, date_to, entry_type, employees, salary, salary_ids, bank, branch, company_id, format1)
else:
# No details section
row = 4
row = 3
# English headers row
sheet.write(3, 2, 'Total Amount', format2)
sheet.write(3, 3, 'Beneficiary Account IBAN', format2)
sheet.write(3, 4, 'Beneficiary Name', format2)
sheet.write(3, 5, 'Beneficiary Bank CODE', format2)
sheet.write(3, 6, 'Payment Description', format2)
sheet.write(3, 7, 'Basic Salary', format2)
sheet.write(3, 8, 'Housing Allowance', format2)
sheet.write(3, 9, 'Other Earnings', format2)
sheet.write(3, 10, 'Deductions', format2)
sheet.write(3, 11, 'Beneficiary National/IqamaID', format2)
sheet.write(2, 2, 'Total Amount', format2)
sheet.write(2, 3, 'Beneficiary Account IBAN', format2)
sheet.write(2, 4, 'Beneficiary Name', format2)
sheet.write(2, 5, 'Beneficiary Bank CODE', format2)
sheet.write(2, 6, 'Payment Description', format2)
sheet.write(2, 7, 'Basic Salary', format2)
sheet.write(2, 8, 'Housing Allowance', format2)
sheet.write(2, 9, 'Other Earnings', format2)
sheet.write(2, 10, 'Deductions', format2)
sheet.write(2, 11, 'Beneficiary National/IqamaID', format2)
# Arabic headers row
sheet.write(4, 2, 'المبلغ الاجمالي', format2)
sheet.write(4, 3, 'رقم الايبان', format2)
sheet.write(4, 4, 'اسم المستفيد', format2)
sheet.write(4, 5, 'بنك المستفيد', format2)
sheet.write(4, 6, 'تفاصيل التحويل', format2)
sheet.write(4, 7, 'الراتب الاساسي', format2)
sheet.write(4, 8, 'بدل السكن', format2)
sheet.write(4, 9, 'البدلات الاخرى', format2)
sheet.write(4, 10, 'الخصم', format2)
sheet.write(4, 11, 'رقم الهوية', format2)
sheet.write(3, 2, 'المبلغ الاجمالي', format2)
sheet.write(3, 3, 'رقم الايبان', format2)
sheet.write(3, 4, 'اسم المستفيد', format2)
sheet.write(3, 5, 'بنك المستفيد', format2)
sheet.write(3, 6, 'تفاصيل التحويل', format2)
sheet.write(3, 7, 'الراتب الاساسي', format2)
sheet.write(3, 8, 'بدل السكن', format2)
sheet.write(3, 9, 'البدلات الاخرى', format2)
sheet.write(3, 10, 'الخصم', format2)
sheet.write(3, 11, 'رقم الهوية', format2)
if report_type == 'salary':
for bank in banks: