The previous commit moved Main type of activity data to master_data/ but left
the original fixture file in place — Frappe's sync_fixtures reads every .json
in app/fixtures/ regardless of the hooks.py fixtures list, so the file was
still being imported on every migrate (3499 DELETE+INSERTs). Delete it.
Also adds a bulk-insert fast path (db_insert chunks of 500) to sync_master_data
for the large first-run case on fresh sites, so the new sync is faster than
the legacy fixture import even when populating an empty table.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fixture import does DELETE+INSERT for every row on every migrate (force=True
in frappe's import_doc), so 3499 rows of Main type of activity added minutes
to each migrate. Replace with a hash-diff sync that fast-paths via stored
file hash and otherwise applies only the delta (insert new, update changed,
smart-delete removed with disabled-fallback).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces "Azerbaijan" with "Azərbaycan" in app description, README, and
the descriptions of the Tax Period Closing Settings fields. Country
master Link values (e.g. country_of_origin: Azerbaijan in item fixtures)
are kept as-is to preserve references.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bookkeeper clarified the contribution net-of-exemption columns should be
computed from Əsas əmək haqqı minus the exemption amount, not from
gross_pay. With no exemption the column equals the existing (ƏH) column.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For each social contribution (DSMF, İcbari tibbi sığorta, İşsizlikdən
sığorta — işçi and şirkət, everything except Gəlir vergisi) add a column
per month that recomputes the amount on gross_pay minus that
contribution's "cəlb olunmayan gəlir" amount, using the Salary Component
formula. Sits next to the original column. 18 new columns total.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bookkeeper review confirmed the gəlir vergisi numbers are correct;
drop the tax_debug payload and the browser-console breakdown.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the console.group/console.table layout with one structured
text block per request: shows source fields (gross_pay, custom_vergi_amount),
formula, per-slip breakdown with bracket explanation, and per-month sum
arithmetic. Easy to select-all and forward to the bookkeeper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Server returns a tax_debug payload (per-slip, per (employee, month), and
monthly totals) and the client logs it via console.group + console.table
when payroll data is loaded. Temporary aid for the bookkeeper review —
will be removed once formulas are signed off.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Apply gəlir vergisi brackets to (gross_pay − custom_vergi_amount), not raw
gross. Slips marked azadolma drop to 0 contribution, matching how the
formula editor fills the tax-base column. Affects bölmə 3 hissə 1 and
əlavə 1 hissə 1 vergi məbləği.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per-employee quarterly income tax: brackets applied to each month's
gross pay, then summed for the quarter. Reuses the same per-month
gross helper as bölmə 3.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Apply AZ progressive tax brackets (3%/10%/14%) per employee per month
on gross pay, then sum for monthly and quarterly tax amounts in
bölmə_3 hissə 1. Formula Editor stays responsible for the tax base
columns; this fills vergiməbləği* independently.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Group salary slips by tax-free indicator over the quarter and populate
vergi_, mdss_, issizlik, its child tables on il/rüb change. Convert the
göstəricilər field in those four child doctypes from Select to a Link
to Tax Free Indicator so values match what payroll already stores.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Duplicates the 7 deduction columns twice per month: once with the formula
evaluated at base=ƏH amount (LE=0), and once at base=0/LE=MK amount with
the formula(0,0) baseline subtracted. The sum of (ƏH-part + MK-part) for
each row equals the slip's actual deduction — serves as a built-in sanity
check. Baseline subtraction keeps Gəlir vergisi correct across the
threshold (200 AZN) without special-casing it.
Formulas are read from Salary Component at runtime via _safe_eval — no
hardcoded rates, so the report stays correct when tax law changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bring back salary_slip_id, start_date, end_date and the four tax-free
Göstərici Link fields that were dropped in the numeric-only pass, each
split into per-month columns so the formula editor can pick a specific
month's value.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add visible year/quarter selectors that sync hidden from_date/to_date
filters so the formula editor (which injects from_date via $AyIlSpecial)
keeps working without knowing about the quarter UI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace from/to date filters with year + quarter selectors and aggregate
one row per employee with numeric columns split per month (ay_1_, ay_2_,
ay_3_) so the formula editor can pick a specific month instead of
dividing the quarter total by 3.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Event and checks referenced a non-existent hesabatdövrü field, so
selecting year + quarter never triggered populate_declaration_tables.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Row 4 sums Məzuniyyət Kompensasiyası per month from Salary Detail.
Row 1 Gəlirlər, cəmi now sums rows 2 + 4.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- bolme2_hisse2 row 2: sum of Əsas əmək haqqı per month from Salary Detail
- bolme2_hisse2 row 1: auto-sum of rows 2-5
- hissə_1 gəlirlərcəmi: switched from gross_pay to Əsas əmək haqqı
- New Monthly Present Report (Present + Half Day attendance)
- bolme2_hisse1 row 2: unique employees with Present/Half Day per month
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New report counts days present (Present + Half Day) per employee.
bolme2_hisse1 row 2 counts unique employees who showed up per month.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prevents migration failure when jey_erp custom fields are not yet
synced (Unknown column 'accounting_method' error).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Count employees per month using date_of_joining + relieving_date logic.
Safety net: status=Left without relieving_date excluded from count.
Updates existing pre-created rows by matching göstəricilər field.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Refactored payroll data fetch into shared fetch_payroll_data() used by
both hissə_1 and hissə_2. hissə_2 shows employees with məzuniyyət
kompensasiyası, with il from date_of_joining year.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fetch absence data (employee name, FIN, SSN, reason, days absent) from
Attendance records and fill hissə_3 alongside hissə_1 on year/quarter change.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reverted child table to original 7 fields (soyadadataadı, fin, gəlirlərcəmi,
vergiməbləği, and 3 insurance fields). Server method now maps report data
to these fields, fetches FIN from Employee doctype, and leaves vergiməbləği
unfilled. Removed unnecessary 23 extra fields.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
frappe.db.get_value rejects Unicode fieldnames (mdssüzrə etc.) even with
backticks. Replace with a whitelisted Python method that uses frappe.get_doc.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add .catch() to frappe.db.get_value call so the form opens without
errors when Company has no mdssüzrə or related fields populated.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Redesign Single Declaration-Elave1_Hisse1 child table with all report columns
(26 fields), add server-side aggregation per employee with insurance formula
(işçi + şirkət) × 3, and client-side triggers on il/hesabatdövrü fields.
Also fix backtick escaping for Unicode field names in frappe.db.get_value.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>