# ardaekiz0/kdv-capraz-kontrol architecture

> Architecture diagram of the GitHub repository ardaekiz0/kdv-capraz-kontrol, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ardaekiz0/kdv-capraz-kontrol
- Repository: https://github.com/ardaekiz0/kdv-capraz-kontrol

## Overview

KDV Çapraz Kontrol is a Turkish VAT invoice reconciliation desktop application with a batch CLI. Users select invoices and a control ledger, the application reads supported formats, matches invoice and ledger records, and presents discrepancies for review and reporting. Optional taxpayer workflows retrieve e-Arşiv invoices from GİB or Luca ledger data. The README also documents history, dashboards, declaration comparison, Ba/Bs forms, filtering and email. Edges reflect README statements and the supplied source index; several UI and auxiliary modules were not sampled, so uncertain internal links are omitted.

Main entry points: [`main.py`](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/main.py) (Desktop app), [`matcher.py`](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/matcher.py) (Invoice matching), [`dosya.py`](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/dosya.py) (File dispatch), [`mukellef_panel.py`](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/mukellef_panel.py) (Taxpayer panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and retrieval"]
  node_app["Desktop app<br/>[main.py]"]
  node_cli["Batch CLI<br/>[cli.py]"]
  node_taxpayer["Taxpayer panel<br/>[mukellef_panel.py]"]
  node_gib["GİB retrieval<br/>[gib_cekme.py]"]
  node_luca["Luca retrieval<br/>[luca_cekme.py]"]
end

subgraph group_ingest["Document ingestion"]
  node_file_loader["File dispatch<br/>[dosya.py]"]
  node_invoice_pdf["PDF invoices<br/>[efatura.py]"]
  node_invoice_xml["XML invoices<br/>[xml_oku.py]"]
  node_invoice_excel["Excel invoices<br/>[excel_oku.py]"]
  node_voucher["MAHSUP slips<br/>[fis_listesi.py]"]
  node_ocr["Scanned invoices<br/>[ocr.py]"]
  node_ledger["Ledger parsing<br/>[cetvel.py]"]
  node_luca_ledger["Luca ledger import<br/>[luca_cekme.py]"]
end

subgraph group_reconcile["Reconciliation"]
  node_matching["Invoice matching<br/>[matcher.py]"]
  node_returns["Returns parsing"]
  node_rules["VAT rules<br/>[kurallar.py]"]
  node_shared_utils["Data utilities<br/>[utils.py]"]
end

subgraph group_review["Review and analysis"]
  node_review_ui["Results review<br/>[main.py]"]
  node_detail["Invoice details"]
  node_filters["Advanced filters<br/>[filtre_dialog.py]"]
  node_dashboard["Dashboard<br/>[dashboard.py]"]
  node_rate_check["Rate validation<br/>[oran_kontrol.py]"]
  node_declaration["Declaration compare<br/>[beyanname.py]"]
  node_ba_bs["Ba/Bs form"]
end

subgraph group_output["Reports and history"]
  node_history[("Check history<br/>[db.py]")]
  node_excel_report["Excel report<br/>[report.py]"]
  node_pdf_report["PDF report<br/>[report_pdf.py]"]
  node_email["Report email<br/>[email_gonder.py]"]
end

node_user(("Accountant"))
node_gib_service{{"GİB service"}}
node_luca_service{{"Luca service"}}

node_user -->|"selects files"| node_app
node_user -->|"runs batch"| node_cli
node_app -->|"loads files"| node_file_loader
node_cli -.->|"loads files"| node_file_loader
node_file_loader -->|"dispatches PDF"| node_invoice_pdf
node_file_loader -->|"dispatches XML"| node_invoice_xml
node_file_loader -->|"dispatches Excel"| node_invoice_excel
node_file_loader -->|"dispatches slips"| node_voucher
node_invoice_pdf -->|"uses OCR"| node_ocr
node_ledger -->|"uses PDF reader"| node_invoice_pdf
node_ledger -->|"uses OCR"| node_ocr
node_gib -->|"downloads invoices"| node_gib_service
node_gib -->|"parses downloads"| node_invoice_excel
node_luca -->|"downloads ledger"| node_luca_service
node_taxpayer -->|"starts retrieval"| node_gib
node_taxpayer -->|"starts retrieval"| node_luca
node_taxpayer -->|"loads ledger"| node_ledger
node_app -->|"checks records"| node_matching
node_cli -.->|"checks records"| node_matching
node_matching -->|"checks VAT rules"| node_rules
node_matching -->|"checks returns"| node_returns
node_matching -->|"uses utilities"| node_shared_utils
node_app -->|"shows results"| node_review_ui
node_review_ui -->|"opens details"| node_detail
node_review_ui -->|"filters results"| node_filters
node_review_ui -->|"summarizes results"| node_dashboard
node_dashboard -->|"uses results"| node_matching
node_app -->|"checks rates"| node_rate_check
node_app -->|"compares periods"| node_declaration
node_app -->|"creates form"| node_ba_bs
node_app -->|"saves checks"| node_history
node_app -->|"exports report"| node_excel_report
node_app -->|"exports report"| node_pdf_report
node_excel_report -->|"uses results"| node_matching
node_excel_report -->|"uses utilities"| node_shared_utils
node_pdf_report -->|"uses results"| node_matching
node_app -->|"sends report"| node_email

click node_app "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/main.py"
click node_cli "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/cli.py"
click node_taxpayer "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/mukellef_panel.py"
click node_gib "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/gib_cekme.py"
click node_luca "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/luca_cekme.py"
click node_file_loader "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/dosya.py"
click node_invoice_pdf "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/efatura.py"
click node_invoice_xml "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/xml_oku.py"
click node_invoice_excel "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/excel_oku.py"
click node_voucher "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/fis_listesi.py"
click node_ocr "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/ocr.py"
click node_ledger "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/cetvel.py"
click node_luca_ledger "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/luca_cekme.py"
click node_matching "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/matcher.py"
click node_returns "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/iade_ayristirici.py"
click node_rules "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/kurallar.py"
click node_review_ui "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/main.py"
click node_detail "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/fatura_detay_pencere.py"
click node_filters "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/filtre_dialog.py"
click node_dashboard "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/dashboard.py"
click node_rate_check "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/oran_kontrol.py"
click node_declaration "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/beyanname.py"
click node_ba_bs "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/muhtasar_ba_formu.py"
click node_history "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/db.py"
click node_excel_report "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/report.py"
click node_pdf_report "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/report_pdf.py"
click node_email "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/email_gonder.py"
click node_shared_utils "https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_cli,node_taxpayer,node_gib,node_luca toneBlue
class node_file_loader,node_invoice_pdf,node_invoice_xml,node_invoice_excel,node_voucher,node_ocr,node_ledger,node_luca_ledger toneAmber
class node_matching,node_returns,node_rules,node_shared_utils toneMint
class node_review_ui,node_detail,node_filters,node_dashboard,node_rate_check,node_declaration,node_ba_bs toneRose
class node_history,node_excel_report,node_pdf_report,node_email,node_user,node_gib_service,node_luca_service toneIndigo
```

## Components

### Entry and retrieval

- [Desktop app](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/main.py): `main.py`
- [Batch CLI](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/cli.py): `cli.py`
- [Taxpayer panel](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/mukellef_panel.py): `mukellef_panel.py`
- [GİB retrieval](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/gib_cekme.py): `gib_cekme.py`
- [Luca retrieval](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/luca_cekme.py): `luca_cekme.py`

### Document ingestion

- [File dispatch](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/dosya.py): `dosya.py`
- [PDF invoices](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/efatura.py): `efatura.py`
- [XML invoices](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/xml_oku.py): `xml_oku.py`
- [Excel invoices](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/excel_oku.py): `excel_oku.py`
- [MAHSUP slips](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/fis_listesi.py): `fis_listesi.py`
- [Scanned invoices](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/ocr.py): `ocr.py`
- [Ledger parsing](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/cetvel.py): `cetvel.py`
- [Luca ledger import](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/luca_cekme.py): `luca_cekme.py`

### Reconciliation

- [Invoice matching](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/matcher.py): `matcher.py`
- [Returns parsing](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/iade_ayristirici.py): `iade_ayristirici.py`
- [VAT rules](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/kurallar.py): `kurallar.py`
- [Data utilities](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/utils.py): `utils.py`

### Review and analysis

- [Results review](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/main.py): `main.py`
- [Invoice details](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/fatura_detay_pencere.py): `fatura_detay_pencere.py`
- [Advanced filters](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/filtre_dialog.py): `filtre_dialog.py`
- [Dashboard](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/dashboard.py): `dashboard.py`
- [Rate validation](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/oran_kontrol.py): `oran_kontrol.py`
- [Declaration compare](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/beyanname.py): `beyanname.py`
- [Ba/Bs form](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/muhtasar_ba_formu.py): `muhtasar_ba_formu.py`

### Reports and history

- [Check history](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/db.py): `db.py`
- [Excel report](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/report.py): `report.py`
- [PDF report](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/report_pdf.py): `report_pdf.py`
- [Report email](https://github.com/ardaekiz0/kdv-capraz-kontrol/blob/main/email_gonder.py): `email_gonder.py`

### Other components

- **Accountant**
- **GİB service**
- **Luca service**

## Connections

- Accountant → Desktop app: selects files (evidence: `README.md`)
- Accountant → Batch CLI: runs batch (evidence: `README.md`)
- Desktop app → File dispatch: loads files (evidence: `README.md`)
- Batch CLI → File dispatch: loads files
- File dispatch → PDF invoices: dispatches PDF (evidence: `dosya.py`)
- File dispatch → XML invoices: dispatches XML (evidence: `dosya.py`)
- File dispatch → Excel invoices: dispatches Excel (evidence: `dosya.py`)
- File dispatch → MAHSUP slips: dispatches slips (evidence: `dosya.py`)
- PDF invoices → Scanned invoices: uses OCR (evidence: `efatura.py`)
- Ledger parsing → PDF invoices: uses PDF reader (evidence: `cetvel.py`)
- Ledger parsing → Scanned invoices: uses OCR (evidence: `cetvel.py`)
- GİB retrieval → GİB service: downloads invoices (evidence: `README.md`)
- GİB retrieval → Excel invoices: parses downloads (evidence: `gib_cekme.py`)
- Luca retrieval → Luca service: downloads ledger (evidence: `README.md`)
- Taxpayer panel → GİB retrieval: starts retrieval (evidence: `mukellef_panel.py`)
- Taxpayer panel → Luca retrieval: starts retrieval (evidence: `mukellef_panel.py`)
- Taxpayer panel → Ledger parsing: loads ledger (evidence: `README.md`)
- Desktop app → Invoice matching: checks records (evidence: `README.md`)
- Batch CLI → Invoice matching: checks records
- Invoice matching → VAT rules: checks VAT rules (evidence: `matcher.py`)
- Invoice matching → Returns parsing: checks returns (evidence: `matcher.py`)
- Invoice matching → Data utilities: uses utilities (evidence: `matcher.py`)
- Desktop app → Results review: shows results (evidence: `README.md`)
- Results review → Invoice details: opens details (evidence: `README.md`)
- Results review → Advanced filters: filters results (evidence: `README.md`)
- Results review → Dashboard: summarizes results (evidence: `README.md`)
- Dashboard → Invoice matching: uses results (evidence: `dashboard.py`)
- Desktop app → Rate validation: checks rates (evidence: `README.md`)
- Desktop app → Declaration compare: compares periods (evidence: `README.md`)
- Desktop app → Ba/Bs form: creates form (evidence: `README.md`)
- Desktop app → Check history: saves checks (evidence: `README.md`)
- Desktop app → Excel report: exports report (evidence: `README.md`)
- Desktop app → PDF report: exports report (evidence: `README.md`)
- Excel report → Invoice matching: uses results (evidence: `report.py`)
- Excel report → Data utilities: uses utilities (evidence: `report.py`)
- PDF report → Invoice matching: uses results (evidence: `report_pdf.py`)
- Desktop app → Report email: sends report (evidence: `README.md`)
