Commit Graph

389 Commits

Author SHA1 Message Date
Ali cecb6c255c fix(single-declaration): exclude income-tax-exempt amount before bracket
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>
2026-05-05 18:16:12 +00:00
Ali caedd576b1 feat(single-declaration): fill vergi məbləği in əlavə 1 hissə 1
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>
2026-05-05 17:14:37 +00:00
Ali 2e15e9dae4 feat(single-declaration): compute bölmə 3 income tax from payroll
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>
2026-05-05 16:39:26 +00:00
Ali 3b54639022 push from mvp 2026-05-05 16:17:53 +00:00
Ali 72b256b17f push from mvp 2026-05-05 16:07:52 +00:00
Ali 4ba9ea385f feat(single-declaration): auto-fill elave4 deduction tables from payroll
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>
2026-05-04 12:40:28 +00:00
Ali 02973690aa feat(employee-payroll-register): add ƏH and MK base deduction columns
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>
2026-05-01 12:45:03 +00:00
Ali 24c8205193 push from mvp 2026-04-28 09:14:07 +00:00
Ali 16329bb5e5 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>
2026-04-23 12:36:35 +00:00
Ali 46977b3427 feat: restore slip id, dates and tax-free indicators per month in payroll register
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>
2026-04-23 10:57:23 +00:00
Ali ec95dda8c2 fix: keep from_date/to_date as source of truth in payroll register
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>
2026-04-23 10:22:23 +00:00
Ali f609d8064d feat: restructure employee payroll register for quarterly per-month breakdown
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>
2026-04-23 10:13:41 +00:00
Ali 5c007ef408 fix: bind reload handler to rüb field in single declaration
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>
2026-04-23 08:29:34 +00:00
Ali c42e7518b9 fix: set precision 2 on Float fields in single declaration bolme4 tables
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 10:46:14 +00:00
Ali 8c4ade656a push from mvp 2026-04-17 10:28:24 +00:00
Ali 4ddfec12db feat: add Tax Free indicator columns alongside amounts in payroll register
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 10:03:49 +00:00
Ali 95a1126139 feat: add Tax Free amount columns to employee payroll register
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 12:25:47 +00:00
Ali d8539ecdc1 feat: add Gəlir vergisi deduction to employee payroll register
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:33:58 +00:00
Ali 92d7ac6875 fix: bolme2_hisse2 last column is sum of 3 months, not average
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:21:11 +04:00
Ali 19d1a66b87 feat: add bolme2_hisse2 row 4 (məzuniyyət kompensasiyası) and auto-sum row 1
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>
2026-04-03 21:44:20 +04:00
Ali 7b9cb7130a feat: add bolme2_hisse2 (monthly əmək haqqı), Monthly Present Report
- 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>
2026-04-03 19:48:07 +04:00
Ali 6ed4c94213 feat: add Monthly Present Report and bolme2_hisse1 row 2 (actual headcount)
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>
2026-04-03 16:29:36 +04:00
Ali 86b219a31e fix: round bolme2_hisse1 quarterly average to nearest integer
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:10:43 +04:00
Ali ed92176ce4 fix: guard accounting_method queries with has_column check
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>
2026-04-02 23:10:04 +04:00
Ali 2b0426de0b feat: auto-populate bolme2_hisse1 row 1 (employee count per month)
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>
2026-04-02 19:50:19 +04:00
Ceyhun 6afb8ca3d3 add cash method 2026-04-02 15:41:26 +00:00
Ali e86e8c841b push from mvp 2026-04-02 11:40:04 +00:00
Ali 8a6ed93e40 push from mvp 2026-04-02 11:39:49 +00:00
Ali 572564fd0d feat: auto-populate hissə_2 with compensation data from payroll
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>
2026-04-01 15:02:56 +04:00
Ali cf3f1f46de fix: restore SSN column in Monthly Absence Report
SSN stays in the report but is not populated into hissə_3.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:33:04 +04:00
Ali ea66dfcb19 fix: remove SSN field from Monthly Absence Report and hissə_3 population
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:32:19 +04:00
Ali 4c94f766f9 fix: use passport_number for FIN in Monthly Absence Report
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:15:23 +04:00
Ali 4a7a09ba18 feat: auto-populate hissə_3 from Monthly Absence Report
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>
2026-03-31 16:40:10 +04:00
Ali 3cbe277152 fix: remove ×3 multiplier from insurance formulas
Report already returns quarterly data, so (işçi + şirkət) is sufficient.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:34:20 +04:00
Ali 8c5639ff7a change numeric fields in hissə_1 from Data to Currency
gəlirlərcəmi, vergiməbləği, and 3 insurance fields now Currency type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 21:44:08 +04:00
Ali cc55c02999 fix: populate FIN from Employee.passport_number
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 21:32:52 +04:00
Ali ff629e7124 fix: remove FIN lookup - Employee doctype has no 'fin' field
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 21:31:37 +04:00
Ali 38d3208aa4 fix: restore original hissə_1 fields, map report data to existing columns
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>
2026-03-30 21:22:22 +04:00
Ali ecc770ca46 fix: move Company defaults fetch to server-side to avoid Unicode field validation
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>
2026-03-30 20:46:12 +04:00
Ali 9778ccbca8 fix: silently handle missing Company fields in fillFromCompanyDefaults
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>
2026-03-30 20:39:02 +04:00
Ali 63e9ec5ee4 auto-populate hissə_1 from Employee Payroll Register on year/quarter change
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>
2026-03-30 19:53:55 +04:00
Ali 4addeb8a05 push from mvp 2026-03-30 15:43:19 +00:00
Ali 8038965814 push from mvp 2026-03-30 15:42:52 +00:00
Ali 0ca80210a2 push from mvp 2026-03-30 14:48:50 +00:00
Ali 4836088c11 push from mvp 2026-03-26 17:21:22 +00:00
Ali 8c7eabc36d update Employee Payroll Register report config after migrate
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 21:05:42 +04:00
Ali 57f21d3cde simplify Employee Payroll Register: remove total row, keep only date and company filters, hardcode AZN currency and Submitted status
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 20:52:39 +04:00
Ali a8a01de845 add Employee Payroll Register report with hardcoded salary columns
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 20:46:37 +04:00
Ali e5df13a68b fix absence reason field: use absent_reason instead of leave_type
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 19:12:17 +04:00
Ali 1e1822745e remove father_name from Monthly Absence Report
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 18:18:12 +04:00