refactor: drop auto-fill for bölmə 2 hissə 2 in single declaration

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ali 2026-04-23 12:36:35 +00:00
parent 46977b3427
commit 16329bb5e5
2 changed files with 0 additions and 64 deletions

View File

@ -91,7 +91,6 @@ function reload_hisse_1_data(frm) {
populate_child_table(frm, 'hissə_2', r.message.hisse_2_data || []);
populate_child_table(frm, 'hissə_3', r.message.hisse_3_data || []);
update_existing_rows(frm, 'bolme2_hisse1', r.message.bolme2_hisse1_data || {});
update_existing_rows(frm, 'bolme2_hisse2', r.message.bolme2_hisse2_data || {});
frm.dirty();
frm.refresh_fields();

View File

@ -69,7 +69,6 @@ def populate_declaration_tables(company, year, quarter):
hisse_2_data = build_hisse_2(payroll)
hisse_3_data = get_absence_data(company, from_date, to_date)
bolme2_hisse1_data = get_bolme2_hisse1_data(company, year, quarter)
bolme2_hisse2_data = get_bolme2_hisse2_data(company, year, quarter)
return {
"success": True,
@ -77,7 +76,6 @@ def populate_declaration_tables(company, year, quarter):
"hisse_2_data": hisse_2_data,
"hisse_3_data": hisse_3_data,
"bolme2_hisse1_data": bolme2_hisse1_data,
"bolme2_hisse2_data": bolme2_hisse2_data,
}
except Exception as e:
@ -263,67 +261,6 @@ def get_bolme2_hisse1_data(company, year, quarter):
}
def get_bolme2_hisse2_data(company, year, quarter):
"""Build data for bolme2_hisse2: monthly gross pay totals."""
quarter_num = int(quarter[0])
months = [(quarter_num - 1) * 3 + i for i in range(1, 4)]
monthly_emek = []
monthly_kompensasiya = []
for month in months:
last_day = calendar.monthrange(year, month)[1]
month_start = f"{year}-{month:02d}-01"
month_end = f"{year}-{month:02d}-{last_day:02d}"
params = {"company": company, "month_start": month_start, "month_end": month_end}
emek = frappe.db.sql("""
SELECT IFNULL(SUM(sd.amount * ss.exchange_rate), 0)
FROM `tabSalary Slip` ss
JOIN `tabSalary Detail` sd ON sd.parent = ss.name AND sd.parentfield = 'earnings'
WHERE ss.docstatus = 1
AND ss.company = %(company)s
AND ss.start_date >= %(month_start)s
AND ss.end_date <= %(month_end)s
AND sd.salary_component = 'Əsas əmək haqqı'
""", params)[0][0]
monthly_emek.append(flt(emek))
komp = frappe.db.sql("""
SELECT IFNULL(SUM(sd.amount * ss.exchange_rate), 0)
FROM `tabSalary Slip` ss
JOIN `tabSalary Detail` sd ON sd.parent = ss.name AND sd.parentfield = 'earnings'
WHERE ss.docstatus = 1
AND ss.company = %(company)s
AND ss.start_date >= %(month_start)s
AND ss.end_date <= %(month_end)s
AND sd.salary_component = 'Məzuniyyət Kompensasiyası'
""", params)[0][0]
monthly_kompensasiya.append(flt(komp))
def build_row(monthly):
total = round(sum(monthly), 2) if monthly else 0
return {
"1ciay": monthly[0] if len(monthly) > 0 else 0,
"2ciay": monthly[1] if len(monthly) > 1 else 0,
"3cüay": monthly[2] if len(monthly) > 2 else 0,
"rübüzrəortasay": total,
}
row2 = build_row(monthly_emek)
row4 = build_row(monthly_kompensasiya)
# Row 1 = sum of rows 2-5
monthly_total = [monthly_emek[i] + monthly_kompensasiya[i] for i in range(3)]
row1 = build_row(monthly_total)
return {
"Gəlirlər, cəmi": row1,
"Hesablanmış əmək haqqı və digər gəlirlər": row2,
"İstifadə edilməmiş əmək məzuniyyətinə görə hesablanmış kompensasiya məbləği": row4,
}
def get_absence_data(company, from_date, to_date):
"""Fetch absence data from Monthly Absence Report for hissə_3."""
from taxes_az.taxes_az.report.monthly_absence_report.monthly_absence_report import get_data